Rahina Kabinawa

Win micromatch in < 100 seconds!

Αυτός ο κώδικας δεν πρέπει να εγκατασταθεί άμεσα. Είναι μια βιβλιοθήκη για άλλους κώδικες που περιλαμβάνεται μέσω της οδηγίας meta // @require https://update.sleazyfork.org/scripts/396398/772267/Rahina%20Kabinawa.js

  1. // ==UserScript==
  2. // @name Rahina Kabinawa
  3. // @namespace Danielv123
  4. // @version 3.1
  5. // @description Win micromatch in < 100 seconds!
  6. // @author You
  7. // @match https://quizlet.com/*/micro*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. // this script died when microscatter turned into micromatch, but it still works albeit badly.
  12. // edit: Version 2.0 fixed everything and its now able to get sub 0.5 second times!
  13. function eventFire(el, etype){
  14. if (el.fireEvent) {
  15. el.fireEvent('on' + etype);
  16. } else {
  17. var evObj = document.createEvent('Events');
  18. evObj.initEvent(etype, true, false);
  19. el.dispatchEvent(evObj);
  20. }
  21. }
  22. terms = Quizlet.matchModeData.terms;
  23. wordDefinition = {};
  24. definitionWord = {};
  25. for(let i = 0; i < terms.length; i++){
  26. wordDefinition[terms[i].word] = terms[i].definition;
  27. definitionWord[terms[i].definition] = terms[i].word;
  28. }
  29. firstClick = true;
  30. document.onclick = ()=>{
  31. firstClick = false;
  32. setTimeout(()=>{
  33. // Magic for loop instead
  34. // checks if the combination is right before clicking :)
  35. for(let i=0;i<document.querySelector(".MatchModeQuestionGridBoard-tiles").childNodes.length;i++) {
  36. console.log("i = "+i);
  37. // click it if its unclicked
  38. if(document.querySelector(".MatchModeQuestionGridBoard-tiles").childNodes[0].childNodes.length == 0 || document.querySelector(".MatchModeQuestionGridBoard-tiles").childNodes[1].childNodes[0].className == "MatchModeQuestionGridTile is-selected"){
  39. console.log("Already clicked " + i);
  40. } else {
  41. let word = document.querySelector(".MatchModeQuestionGridBoard-tiles").childNodes[i].childNodes[0].childNodes[0].childNodes[0].childNodes[0].innerHTML.replace(/<!--([\s\S]*?)-->/mig, '');
  42. let translatedWord;
  43. if(wordDefinition[word]){
  44. translatedWord = wordDefinition[word];
  45. } else if(definitionWord[word]){
  46. translatedWord = definitionWord[word];
  47. }
  48. // console.log(translatedWord);
  49. // find another word in the same dataset ID and click that as well
  50. for(let o = 0; o < document.querySelector(".MatchModeQuestionGridBoard-tiles").childNodes.length; o++) {
  51. // console.log("o = " + o );
  52. if(document.querySelector(".MatchModeQuestionGridBoard-tiles").childNodes[o].innerHTML.includes(translatedWord)) {
  53. let x = i;
  54. setTimeout(()=>{
  55. console.log("Found word pair: "+translatedWord+":"+word);
  56. eventFire(document.querySelector(".MatchModeQuestionGridBoard-tiles").childNodes[o].childNodes[0], "pointerdown");
  57. setTimeout(()=>{
  58. eventFire(document.querySelector(".MatchModeQuestionGridBoard-tiles").childNodes[x].childNodes[0], "pointerdown");
  59. },00);
  60. },i*300);
  61. }
  62. }
  63. }
  64. }
  65. },500);
  66. };
  67.  
  68. // brute force, they now penalize faults so this is shit
  69. /*
  70. setInterval(function() {
  71. var dwfg = Math.floor(Math.random() * 16);
  72. // console.log(document.getElementById("cells").childNodes[dwfg].getAttribute("data-type"));
  73. if(document.getElementById("cells").childNodes[dwfg].className == "cell long touching correct" || document.getElementById("cells").childNodes[dwfg].className == "cell long touching touched"){
  74. } else {
  75. eventFire(document.querySelector("#cells").childNodes[dwfg], "click");
  76. }
  77. }, 1);
  78. */
  79. setInterval(function() {
  80. //eventFire(document.querySelector("body > div:nth-child(4) > div > div.UIModal.is-open > div > div > div.HighscoresMessage > div.UIDiv.HighscoresMessage-button > button"), "click");
  81. }, 2000);