Win micromatch in less than a second! this is based off of the original script by , but basically all of the code has been replaced by my own
当前为
// ==UserScript==
// @name Updated Quizlet Micromatch bot
// @namespace BenjaminHinchliff
// @version 0.1
// @description Win micromatch in less than a second! this is based off of the original script by , but basically all of the code has been replaced by my own
// @author You
// @match https://quizlet.com/*/match*
// @grant none
// ==/UserScript==
// this is based off of the original script for this,
// but basically all of the code has been replaced by my own
// a little function to allow the program to click on elements
function clickEvent(element) {
let eve = new CustomEvent("pointerdown", { bubbles: true });
element.dispatchEvent(eve);
}
let rawTerms = Quizlet.matchModeData.terms;
let terms = {};
// get terms from Quizlet object (a global variable because I only want to retrive it once)
for (let i = 0; i < rawTerms.length; i++) {
terms[rawTerms[i].word] = rawTerms[i].definition;
}
// wait until user presses start
document.onclick = ()=>{
// get all the nodes and store them in a variable to avoid re-querying nodes (I know it's live shut up)
let nodes = document.querySelector(".MatchModeQuestionGridBoard-tiles").childNodes;
for (let i = 0; i < nodes.length; i++) {
// get term
let search = nodes[i].childNodes[0].childNodes[0].childNodes[0].childNodes[0].innerHTML;
// match with definition
let dictionaryResult = terms[search];
if(dictionaryResult) {
// find term in nodes and send click events
for (let j = 0; j < nodes.length; j++) {
if (nodes[j].innerHTML.includes(dictionaryResult)) {
setTimeout(() => {
clickEvent(nodes[i].childNodes[0]);
clickEvent(nodes[j].childNodes[0]);
},
i * 50); // this is only here because quizlet doesn't allow score below 0.5 seconds and this roughly comes out to 0.5
}
}
}
}
};