forked from veikus/ingresshelper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent.js
37 lines (28 loc) · 1 KB
/
content.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
(function() {
check();
docum = document.getElementsByClassName("button_link")[0].href;
chrome.runtime.sendMessage({ reflink: docum });
chrome.runtime.sendMessage({ action: 'getExtScripts' }, function(val) {
val.forEach(loadExternal);
});
function check() {
var elemIITC = document.querySelector('#innerstatus .map .help'),
elemIntel = document.getElementById('loading_msg');
if (elemIITC && elemIITC.innerHTML === 'done') {
sendCompleteMessage();
} else if (elemIntel && elemIntel.style.display === 'none') {
sendCompleteMessage();
} else {
setTimeout(check, 100);
}
}
function sendCompleteMessage() {
chrome.runtime.sendMessage({ action: 'complete' });
}
function loadExternal(url) {
var s = document.createElement('script');
s.type = 'text/javascript';
s.src = url;
document.getElementsByTagName('head')[0].appendChild(s);
}
}());