Skip to content

Commit 0807360

Browse files
committed
给jira的标签配色
1 parent 556a0cb commit 0807360

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

jira_label_color.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// ==UserScript==
2+
// @name JIRA标签着色
3+
// @version 0.5.0
4+
// @namespace https://izmj.net
5+
// @description 给jira的标签添加自定义配色
6+
// @author girakoo@163.com
7+
// @match https://*/issues/
8+
// @grant none
9+
// @run-at document_end
10+
// @icon64 https://gitee.com/izmj/web_js/raw/main/img/zmj.png
11+
// ==/UserScript==
12+
13+
(function () {
14+
'use strict';
15+
if (document.title.toLowerCase().includes('jira')) {
16+
// 获取所有class为'jira-issue-status-lozenge'的span元素
17+
var spans = document.querySelectorAll('span.jira-issue-status-lozenge');
18+
19+
// 遍历每个span元素
20+
spans.forEach(function (span) {
21+
// 检查span的文本内容是否为'done'(忽略首尾空白)
22+
if (span.textContent.trim() === 'Done') {
23+
// neutral
24+
span.style.backgroundColor = '#6D737C';
25+
span.style.color = '#E8E9E7'
26+
}
27+
else if (span.textContent.trim() === 'Open') {
28+
// red
29+
span.style.backgroundColor = '#FFDCDA';
30+
span.style.color = '#DB4E45'
31+
}
32+
else if (span.textContent.trim() === '开始解析') {
33+
// yellow
34+
span.style.backgroundColor = '#FFEDC1';
35+
span.style.color = '#B08111'
36+
}
37+
else if (span.textContent.trim() === '解析完成') {
38+
// blue
39+
span.style.backgroundColor = '#D7E2FD'
40+
span.style.color = '#3869DD'
41+
}
42+
else if (span.textContent.trim() === '修改完成') {
43+
// green
44+
span.style.backgroundColor = '#DBF4D6'
45+
span.style.color = '#287C1A'
46+
}
47+
// purple #E7D9FE #7C47D8
48+
// violiet #D7E2FD #3266DC
49+
});
50+
}
51+
})();

0 commit comments

Comments
 (0)