-
Notifications
You must be signed in to change notification settings - Fork 0
/
js,js
138 lines (112 loc) · 4.46 KB
/
js,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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
Show a list of team members
- can be used during standup
- can differ per day of the week
Show a list of tips next to title of 4th column of Active Sprint board (the scrumboard)
- Can be used during standup so everybody knows if there is a recurring special topic, like Done? means "Discuss if we get the full sprint Done?", "Arch align" means for us: "Tomorrow there is an architecture alignment. Do we have any topics?"
- Content of list can differ per day of the sprint (1-14n).
Settings in "User Javascript and CSS" plugin
Name: Teams JS
URLs: jira.*RapidBoard.jsp*
Options
- Javascript
- Libraries jQuery 3
*/
var timer;
var jiraLicense = 'server'; // server or cloud
function appendMemberList() {
var oDate = new Date();
var dayOfTheWeek = oDate.getDay();
var jiraColumnHeaderPath = '';
var amemberList = [];
amemberList[1] = "Ni Ri Ad Ge Is Ja (Ke) St Mar Hr (PO)"; // mon
amemberList[2] = "Ni (Pa) Ri Ad Ge Is Ja St Mar Hr (PO)"; // tue
amemberList[3] = "Ni Ri Ad Ge Is Ja St Hr (PO)"; // wed
amemberList[4] = "Ni (Pa) Ri Ad Ge Is Ja (Ke) St Mar Hr (PO)"; // thu
amemberList[5] = "Ni (Pa) Ri Ad Ge Is Ja (Ke) St Mar"; // fri
amemberList[6] = "enjoy_the_weekend"; // Sat
amemberList[0] = "enjoy_the_weekend"; // Sun
var startDateOfSprint = new Date("2021-01-20"); // first standup day of sprint 1
var aMemberList = amemberList[dayOfTheWeek].split(" ");
//shuffleArray(aMemberList); // shuffles the list
var memberList = aMemberList.join(" ");
if (jiraLicense == 'server') {
jiraColumnHeaderPath = '.ghx-column-title';
} else {
jiraColumnHeaderPath = 'h2';
}
// add text to 1st column (if it isnt in there already)
if ($('.ghx-column:nth-child(1) '+jiraColumnHeaderPath+':contains("' + memberList + '")').length === 0) {
$('.ghx-column:nth-child(1) '+jiraColumnHeaderPath).html($('.ghx-column:nth-child(1) '+jiraColumnHeaderPath).html() + " -- " + memberList );
}
// To calculate the time difference between today and the first day of sprint 1
var timeSinceSprintOneStart = oDate.getTime() - startDateOfSprint.getTime();
// To calculate the no. of days
var daysSinceSprintOneStart = Math.floor(timeSinceSprintOneStart / (1000 * 3600 * 24)) + 1;
//console.log("daysSinceSprintOneStart: " + daysSinceSprintOneStart);
// To calculate day since current sprint start (14 dys sprint)
var dayNoOfCurrentSprint = daysSinceSprintOneStart % 14;
//console.log("dayNoOfCurrentSprint: " + dayNoOfCurrentSprint);
// set a tip per sprint day
var aTipList = [];
aTipList[0] = "change"; // tue
aTipList[1] = ""; // wed
aTipList[2] = ""; // thu
aTipList[3] = ""; // fri
aTipList[4] = ""; //
aTipList[5] = ""; //
aTipList[6] = "Sprint status?"; // mon
aTipList[7] = "Arch align?"; // tue
aTipList[8] = ""; // wed
aTipList[9] = "Sprint status?"; // thu
aTipList[10] = ""; // fri
aTipList[11] = ""; //
aTipList[12] = ""; //
aTipList[13] = "GDI align?"; // mon
var tipList = aTipList[dayNoOfCurrentSprint];
// add tiplist (if it isnt in there already)
if ($('.ghx-column:nth-child(4) '+jiraColumnHeaderPath+':contains("' + tipList + '")').length === 0) {
$('.ghx-column:nth-child(4) '+jiraColumnHeaderPath).html($('.ghx-column:nth-child(4) '+jiraColumnHeaderPath).html() + " - " + tipList );
}
}
function shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
}
(function () {
// wait 2 secs for the navbar / header to popup
setTimeout(function() {
$('.aui-nav-item').on('click', function () {
// click on Backlog view button
//if ($.contains(this, $('.agile-icon-plan').get(0))) {
setTimeout(function () {
appendMemberList();
}, 1200);
// }
});
// reinitiate after change of Quick filter or Release/Epic
$(document).on('click', '.js-quickfilter-button, .ghx-classification-item', function (e) {
clearTimeout(timer);
timer = setTimeout(function() {
appendMemberList();
}, 2000)
})
// reinitiate after Click on issue
$(document).on('click', '.ghx-issue', function (e) {
clearTimeout(timer);
timer = setTimeout(function() {
appendMemberList();
}, 1000)
})
// reinitiate after moving an issue
$(document).on('mouseout', '.ghx-issue', function (e) {
clearTimeout(timer);
timer = setTimeout(function() {
appendMemberList();
}, 500)
})
appendMemberList();
}, 2000); // wait for ajax-list to be loaded.. if link fails to show: increase amount here
})();