-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinjection.js
More file actions
32 lines (27 loc) · 1.13 KB
/
Copy pathinjection.js
File metadata and controls
32 lines (27 loc) · 1.13 KB
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
(function () {
var url = document.URL.slice(0, -5) + 'issues';
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onreadystatechange = function() { if (xhr.readyState == 4) { onload(xhr.responseText); } }
xhr.send();
function onload (response) {
var $issues_dom = $(response);
var $pr_dom = $(document.body);
// apply labels css
$pr_dom.find('#js-repo-pjax-container').after($issues_dom.find('#issues_list style'));
// get labels
var $injection_labels = {};
$issues_dom.find('.issue-list-item').each(function () {
$injection_labels[$(this).attr('id')] = $(this).find('.list-group-item-name .labels'); // issue_xxx : label objects
});
// apply labels
var $prs = $pr_dom.find('.list-group-item');
$prs.each(function () {
var num = 'issue_' + $(this).find('.list-group-item-number').text().slice(1);
var $label = $injection_labels[num];
if ($label) {
$(this).find('.list-group-item-name .js-navigation-open').after($label);
}
});
}
})()