Quizlet gravity game "helper"

The correct answer pops up in the browser console (ctrl+shift+I on chrome)

目前為 2016-09-01 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Quizlet gravity game "helper"
  3. // @namespace Danielv123
  4. // @version 1.0
  5. // @description The correct answer pops up in the browser console (ctrl+shift+I on chrome)
  6. // @author You
  7. // @match https://quizlet.com/*/gravity
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. selector = "#GravityGameTarget > div > div.GravityGameplayView > div.GravityGameplayView-inner > div:nth-child(5) > div > div > div > div > span > span";
  12. setInterval(function() {
  13.  
  14. console.log(words[document.querySelector(selector).innerHTML]);
  15. document.querySelector("#GravityGameTarget > div > div.GravitySidebar > div > div > button:nth-child(2)").innerHTML = words[document.querySelector(selector).innerHTML]
  16.  
  17. }, 100)
  18.  
  19. words = {}
  20.  
  21.  
  22. function loadXMLDoc(link) {
  23. var xmlhttp = new XMLHttpRequest();
  24. xmlhttp.onreadystatechange = function() {
  25. if (xmlhttp.readyState == XMLHttpRequest.DONE ) {
  26. if (xmlhttp.status == 200) {
  27. var element = document.createElement('div');
  28. element.insertAdjacentHTML('beforeend', xmlhttp.responseText);
  29. adsaf = element.querySelectorAll(".TermText");
  30. for(i=0;i<adsaf.length;i+=2){
  31. words[adsaf[i].innerHTML] = adsaf[i+1].innerHTML;
  32. }
  33. }
  34. }
  35. };
  36. xmlhttp.open("GET", link, true);
  37. xmlhttp.send();
  38. }
  39. loadXMLDoc("https://quizlet.com/"+document.location.pathname.substring(1, 9)+"/original?_pjax");