Quizlet gravity game cheat

The correct answer pops up in the browser console and the restart button down left

目前为 2017-02-23 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Quizlet gravity game cheat
  3. // @namespace Danielv123
  4. // @version 2.2
  5. // @description The correct answer pops up in the browser console and the restart button down left
  6. // @author You
  7. // @match https://quizlet.com/*/gravity
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. // Set settings and stuff
  12. if(!localStorage.cheat){
  13. localStorage.cheatAutoType = false;
  14. localStorage.cheatActivated = true;
  15. }
  16.  
  17. // selectors, if something breaks these probably needs updating
  18. // get word from asteroid
  19. selector = "#GravityGameTarget > div > div > div > div.ModeLayout-content > div > div.GravityGameplayView-inner > div:nth-child(5) > div > div > div > .TermText > .TermText";
  20. outputSelector = "#GravityGameTarget > div > div > div > div.ModeLayout-controls > div > div > div > div.ModeControls-main > div.ModeControls-actions > div:nth-child(2) > div > button > span";
  21. inputSelector = "#GravityGameTarget > div > div > div > div.ModeLayout-content > div > div.GravityGameplayView-inner > div.GravityGameplayView-typingPrompt > span > div > div > div.GravityTypingPrompt-inputWrapper > textarea";
  22. inputRepeatSelector = "#GravityGameTarget > div > div > div > div.ModeLayout-content > div > div.GravityGameplayView-inner > div:nth-child(3) > div > div > div > div.GravityCopyTermView-inputWrapper > textarea";
  23.  
  24. setInterval(function() {
  25. // console.log(words);
  26. if(document.querySelector(selector).innerHTML && localStorage.cheatActivated == "true"){
  27. translatedWord = words[document.querySelector(selector).innerHTML.replace(RegExp(
  28. '<!--[\\s\\S]*?(?:-->)?'
  29. + '<!---+>?' // A comment with no body
  30. + '|<!(?![dD][oO][cC][tT][yY][pP][eE]|\\[CDATA\\[)[^>]*>?'
  31. + '|<[?][^>]*>?', // A pseudo-comment
  32. 'g'), "")];
  33. console.log(translatedWord);
  34. // update the feedback button with one of our translated words
  35. document.querySelector(outputSelector).innerHTML = translatedWord;
  36. if(document.querySelector(inputSelector).value == "" && localStorage.cheatAutoType == "true"){
  37. document.querySelector(inputSelector).value = translatedWord;
  38. }
  39. }
  40. }, 100);
  41.  
  42. // Quizlet.gravityData.terms[0].definition gets data straight from quizlet :3
  43. words = {};
  44. for(i = 0; i<Quizlet.gravityData.terms.length; i++){
  45. words[Quizlet.gravityData.terms[i].word] = Quizlet.gravityData.terms[i].definition;
  46. }