-
Notifications
You must be signed in to change notification settings - Fork 0
/
jira_planning_view_tasks_block_colours.user.js
48 lines (37 loc) · 1.69 KB
/
jira_planning_view_tasks_block_colours.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// ==UserScript==
// @name jira_planning_view_tasks_block_colours
// @namespace http://example.com
// @description TODO
// @include *http://jira4.nap/*
// ==/UserScript==
/*
DESCRIPTION:
Give the tasks on Jira's "Task Board" (List View) solid background colours.
This is much better than Jira's built-in:
Tools | User Preferences | General | Look and Feel | Background Colour
...because those colours are too faint to see.
SEE ALSO:
Reference documentation for "document.evaluate":
https://developer.mozilla.org/en/docs/Introduction_to_using_XPath_in_JavaScript
*/
// keep tampermonkey syntax checker happy:
$ = $;
// The divs with the Jira ticket number in
var allDivs1 = document.evaluate('//div[@class="gh-subhead"]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
// Change the background colour of the ticket number div
for (var i=0;i<allDivs1.snapshotLength;i++) {
var thisDiv = allDivs1.snapshotItem(i);
var bgcolour = thisDiv.parentNode.style.getPropertyValue('background-color');
thisDiv.style.setProperty('background-color', bgcolour);
console.log("div bgcolor -> "+bgcolour);
console.log(thisDiv);
}
// The divs with the ticket summary in
var allDivs2 = document.evaluate('//div[@title="Summary"]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
// Change the background colour of the ticket summary div
for (var i=0;i<allDivs2.snapshotLength;i++) {
var thisDiv = allDivs2.snapshotItem(i);
var bgcolour = thisDiv.parentNode.parentNode.parentNode.style.getPropertyValue('background-color');
thisDiv.style.setProperty('background-color', bgcolour);
console.log("div bgcolor -> "+bgcolour);
console.log(thisDiv);