blob: 24d09ac25424896014a4e501e0c303a7783455ab (
plain)
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
|
(function() {
var jira_person_header_class_name = '.ghx-heading';
var person_headers;
// Removes spaces from a string
function slugify (str) {
return str.replace(/ /g, '');
}
function do_when (when, action) {
var timeout;
window.clearTimeout(timeout);
if (when()) {
action();
}
else {
timeout = window.setTimeout(function() {
do_when(when, action)
}, 500);
}
}
do_when(
function() {
person_headers = document.querySelectorAll(jira_person_header_class_name);
return person_headers.length;
},
function () {
Array.prototype.forEach.call(
person_headers,
function(element) {
element.setAttribute('id', slugify(element.firstChild.textContent));
}
);
}
);
})();
|