This repository was archived by the owner on Dec 15, 2022. It is now read-only.
forked from quile78/KahootSmasher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
64 lines (55 loc) · 3.16 KB
/
script.js
File metadata and controls
64 lines (55 loc) · 3.16 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
62
63
64
var progress = {type:'RequestAction'};
if(window == window.top && window.location.href=="https://kahoot-smash.tk/")
document.getElementsByTagName("iframe")[0].src = chrome.extension.getURL("backup/index.html");
if(window != window.top && window.location.href=="https://kahoot.it/") {
function TestIfJQAval() {
if($!=undefined)
Run();
else
setTimeout(TestIfJQAval,300);
}
TestIfJQAval();
function Run() {
var newScript = document.createElement('script');
newScript.src = chrome.extension.getURL("smasherBot.js");
newScript.onload = function() {this.remove();};
(document.head || document.documentElement).appendChild(newScript);
setInterval(function() {
UpdateProgress();
chrome.runtime.sendMessage(progress, function(response) {
if(response!=undefined){
if(response.toDecode!="" && response.toDecode!= undefined) {
var script = document.createElement('script');
script.textContent = '$("head").attr("debug",eval("'+response.toDecode+'"))';
(document.head||document.documentElement).appendChild(script);
script.remove();
chrome.runtime.sendMessage({type:'decoded',content:document.getElementsByTagName('head')[0].attributes.debug.value},null);
}
if(response.tokenToAdd!="" && response.tokenToAdd!=undefined) {
var script = document.createElement('script');
if(response.First && response.First!=undefined)
script.textContent =`InitiateSmashAndAddBot('${response.tokenToAdd}',${response.KahootId},${response.NamingConvention},'${response.BaseName}',${response.answerDelay})`
else
script.textContent = 'AddBot("'+ response.tokenToAdd +'")';
(document.head||document.documentElement).appendChild(script);
script.remove();
}
if(response.haltSmash && response.haltSmash!=undefined) {
var script = document.createElement('script');
script.textContent = 'StopSmash()';
(document.head||document.documentElement).appendChild(script);
script.remove();
}
}
});
}, 100);
function UpdateProgress() {
var smashingInfoObject = document.getElementById('smashingInfo').attributes;
progress.redAnswers = smashingInfoObject.redAnswers.value;
progress.greenAnswers = smashingInfoObject.greenAnswers.value;
progress.yellowAnswers = smashingInfoObject.yellowAnswers.value;
progress.blueAnswers = smashingInfoObject.blueAnswers.value;
progress.botsJoined = smashingInfoObject.botsJoined.value;
}
}
}