-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathskipper.js
More file actions
61 lines (56 loc) · 2.46 KB
/
skipper.js
File metadata and controls
61 lines (56 loc) · 2.46 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
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
chrome.storage.local.get(['skipEnabled', 'stealthEnabled', 'background'], function (result) {
console.log(result.skipEnabled);
console.log(result.stealthEnabled);
console.log(result.background);
enabled = result.skipEnabled;
stealth = result.stealthEnabled;
background = result.background;
if(result.background == undefined){
background = "#06172A";
}
document.body.style.background = background;
if (enabled == true) {
if (!stealth) {
var loadingScreen = document.createElement("div");
loadingScreen.innerHTML = "<div style='width: 100vw; height: 100vh; z-index=10000000000000000; background: " + background + "; text-align: center; position: fixed; top: 0vh; color: white;' id='skipper-loading-popup'><!--<h1>Skipping Echo Test. Please Wait...</h1>--><img style=' margin-top: 45vh' src='https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fgifimage.net%2Fwp-content%2Fuploads%2F2017%2F09%2Fajax-loading-gif-transparent-background-8.gif&f=1&nofb=1' width='50px'></div>";
document.body.appendChild(loadingScreen);
document.getElementById("app").style.opacity = "0";
}
function eventFire(el, etype) {
if (el.fireEvent) {
el.fireEvent('on' + etype);
} else {
var evObj = document.createEvent('Events');
evObj.initEvent(etype, true, false);
el.dispatchEvent(evObj);
}
}
var loadInterval = setInterval(isLoaded, 100);
function isLoaded() {
if (document.getElementsByClassName('jumbo--Z12Rgj4')[0] !== undefined) { /* The buttons have loaded, click them */
console.log("Loaded!");
eventFire(document.getElementsByClassName('jumbo--Z12Rgj4')[0], 'click');
if (!stealth) {
document.getElementsByClassName("portal--27FHYi")[0].style.opacity = "0";
}
clearInterval(loadInterval);
setTimeout(function () { //Give the first prompt 500ms to close, then start checking the buttons again
var loadInterval = setInterval(isEchoLoaded, 100);
}, 500);
} else {
console.log("Not Loaded!")
}
}
function isEchoLoaded() {
if (document.getElementsByClassName('jumbo--Z12Rgj4')[0] !== undefined) { /* The buttons have loaded, click them */
eventFire(document.getElementsByClassName('jumbo--Z12Rgj4')[0], 'click');
if (!stealth) {
document.getElementById('skipper-loading-popup').style.display = 'none';
document.getElementById("app").style.opacity = "1";
document.getElementsByClassName("portal--27FHYi")[0].style.opacity = "1";
}
clearInterval(loadInterval);
}
}
}
});