Last active
September 9, 2018 16:33
-
-
Save AndrewYatzkan/0df341156239e521c4b142a8850d149d to your computer and use it in GitHub Desktop.
Quizlet Scatter Cheat (0.0 seconds)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Author : https://github.com/Andrew-9 | |
* Description : Quizlet Scatter Cheat, works in 0.0 seconds. | |
************************************************************************ | |
* Note: This only works in microscatter before you have start the game | |
************************************************************************ | |
*/ | |
// Click the start button | |
document.getElementsByClassName("UIButton--hero")[0].click(); | |
// This makes the code wait .5 seconds before executing. | |
// You can edit that number at the end of the script, | |
// but currently Quizlet doesn't accept times faster than this | |
setTimeout(() => { | |
var q = document.getElementsByClassName("MatchModeQuestionGridBoard-tile"); | |
var e = document.createEvent("MouseEvents"); | |
e.initMouseEvent("pointerdown"); | |
var t = []; | |
// This is the key to the script, all the answers are stored in this variable | |
var l = window.Quizlet["matchModeData"].terms; | |
function click(n) { | |
// This clicks on the tile. It took some digging through the | |
// source code, but you can only use a script to click on a | |
// tile using the "pointerdown" event. | |
q[n].children[0].dispatchEvent(e); | |
} | |
function pair(a, b) { | |
// You give this function two indexes and it clicks on both of the tiles | |
click(a); | |
click(b); | |
} | |
for (var i = 0; i < q.length; i++) { | |
// This removes the newline at the end of the text | |
// I could just use indexOf instead of ==, but that | |
// could cause problems, so I did this instead | |
t[i] = q[i].innerText.replace(/\n$/,""); | |
} | |
for (var i = 0; i < l.length; i++) { | |
let p = []; | |
for (var j = 0; j < q.length; j++) { | |
// This checks everything in the game against the "answer key" | |
// Each index includes the word and definition, so this | |
// will give us each pairs indexes | |
if (t[j] == l[i].word || t[j] == l[i].definition) p[p.length] = j; | |
} | |
// If we have the indexes for this pair, click 'em! | |
if (p.length) pair(p[0], p[1]); | |
} | |
}, 500); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment