Facebook
From Aqua Zebra, 10 Months ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 91
  1. function eventFire(el, etype){
  2.   if (el.fireEvent) {
  3.     el.fireEvent('on' + etype);
  4.   } else {
  5.     var evObj = document.createEvent('Events');
  6.     evObj.initEvent(etype, true, false);
  7.     el.dispatchEvent(evObj);
  8.   }
  9. }
  10. terms = Quizlet.matchModeData.terms;
  11. wordDefinition = {};
  12. definitionWord = {};
  13. for(let i = 0; i < terms.length; i++){
  14.     wordDefinition[terms[i].word] = terms[i].definition;
  15.     definitionWord[terms[i].definition] = terms[i].word;
  16. }
  17. firstClick = true;
  18. document.onclick = ()=>{
  19.     firstClick = false;
  20.     setTimeout(()=>{
  21.         // Magic for loop instead
  22.         // checks if the combination is right before clicking :)
  23.         for(let i=0;i<document.querySelector(".MatchModeQuestionGridBoard-tiles").childNodes.length;i++) {
  24.             console.log("i = "+i);
  25.             // click it if its unclicked
  26.             if(document.querySelector(".MatchModeQuestionGridBoard-tiles").childNodes[0].childNodes.length == 0 || document.querySelector(".MatchModeQuestionGridBoard-tiles").childNodes[1].childNodes[0].className == "MatchModeQuestionGridTile is-selected"){
  27.                 console.log("Already clicked " + i);
  28.             } else {
  29.                 let word = document.querySelector(".MatchModeQuestionGridBoard-tiles").childNodes[i].childNodes[0].childNodes[0].childNodes[0].childNodes[0].innerHTML.replace(/<!--([\s\S]*?)-->/mig, '');
  30.                 let translatedWord;
  31.                 if(wordDefinition[word]){
  32.                     translatedWord = wordDefinition[word];
  33.                 } else if(definitionWord[word]){
  34.                     translatedWord = definitionWord[word];
  35.                 }
  36.                 // console.log(translatedWord);
  37.                 // find another word in the same dataset ID and click that as well
  38.                 for(let o = 0; o < document.querySelector(".MatchModeQuestionGridBoard-tiles").childNodes.length; o++) {
  39.                     // console.log("o = " + o );
  40.                     if(document.querySelector(".MatchModeQuestionGridBoard-tiles").childNodes[o].innerHTML.includes(translatedWord)) {
  41.                         let x = i;
  42.                         setTimeout(()=>{
  43.                             console.log("Found word pair: "+translatedWord+":"+word);
  44.                             eventFire(document.querySelector(".MatchModeQuestionGridBoard-tiles").childNodes[o].childNodes[0], "pointerdown");
  45.                             setTimeout(()=>{
  46.                                 eventFire(document.querySelector(".MatchModeQuestionGridBoard-tiles").childNodes[x].childNodes[0], "pointerdown");
  47.                             },00);
  48.                         },i*300);
  49.                     }
  50.                 }
  51.             }
  52.         }
  53.     },500);
  54. };
  55.  
  56. // brute force, they now penalize faults so this is shit
  57. /*
  58. setInterval(function() {
  59.     var dwfg = Math.floor(Math.random() * 16);
  60.     // console.log(document.getElementById("cells").childNodes[dwfg].getAttribute("data-type"));
  61.     if(document.getElementById("cells").childNodes[dwfg].className == "cell long touching correct" || document.getElementById("cells").childNodes[dwfg].className == "cell long touching touched"){
  62.     } else {
  63.         eventFire(document.querySelector("#cells").childNodes[dwfg], "click");
  64.     }
  65. }, 1);
  66. */
  67. setInterval(function() {
  68.     //eventFire(document.querySelector("body > div:nth-child(4) > div > div.UIModal.is-open > div > div > div.HighscoresMessage > div.UIDiv.HighscoresMessage-button > button"), "click");
  69. }, 2000);