forked from UndercoverGoose/classroom-cheats
-
Notifications
You must be signed in to change notification settings - Fork 2
/
script.js
72 lines (69 loc) · 2.53 KB
/
script.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
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
65
66
67
68
69
70
/* Made By UndercoverGoose V1-Beta */
let autoclick = false;
if(location.href.indexOf("flashcards") !== -1) {
(function(){ //Grabs quizizz answers (requires flashcards)
answers=[];
questions=[];
function xr(x){
if(document.getElementsByClassName("question-text")[x].parentNode.childNodes[1]!==undefined){
return document.getElementsByClassName("question-text")[x].parentNode.childNodes[1].src.split("?")[0];
}else{
return "";
}
};
function mat(x){
let o="";
if(x.match(/[a-z,0-9-~!-?-@-^-%]/gi)!==null){
o = x.match(/[a-z,0-9-~!-?-@-^]/gi).join("");
}
return o;
}
for(let x=0;x<document.getElementsByClassName("question-text").length;x++){
questions.push(xr(x)+mat(document.getElementsByClassName("question-text")[x].textContent));
}
for(let x=0;x<document.getElementsByClassName("answer-text").length;x++){
answers.push(mat(document.getElementsByClassName("answer-text")[x].textContent));
}
localStorage.setItem("_answers", answers.join("\\n"));
localStorage.setItem("_questions", questions.join("\\n"));
alert(`Quizizz Flashcards Saved\n\n${answers.length} Answers : ${questions.length} Questions`);
})();
}else {
(function(){
answers=localStorage.getItem("_answers").split("\\n");
questions=localStorage.getItem("_questions").split("\\n");
function mat(x){
let o="";
if(x.match(/[a-z,0-9-~!-?-@-^-%]/gi)!==null){
o=x.match(/[a-z,0-9-~!-?-@-^]/gi).join("");
}
return o;
};
function xr(){
if(document.getElementsByClassName("question-media")[0]!==undefined){
return document.getElementsByClassName("question-media")[0].childNodes[0].src.split("?")[0];
}else{
return "";
}
};
function foreva(){
try{
let grabbed=xr()+mat(document.getElementsByClassName("resizeable question-text-color")[0].textContent);
for(let x=1;x<document.getElementsByClassName("option").length+1;x++){
let choice=mat(document.getElementsByClassName("resizeable")[x].textContent);
if(choice===answers[questions.indexOf(grabbed)]){
document.getElementsByClassName("option")[x-1].childNodes[0].childNodes[0].style.background="black";
if(autoclick) {
document.getElementsByClassName("option")[x-1].childNodes[0].childNodes[0].click();
}
}
}
}
catch(error){}
}
setInterval(foreva,0);
})();
}
window.onkeypress = function(e) {
autoclick = (e.key === "a");
}