Quizlet gravity game "helper"

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

目前为 2016-09-29 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Quizlet gravity game "helper"
  3. // @namespace Danielv123
  4. // @version 1.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. selector = "#GravityGameTarget > div > div.GravityGameplayView > div.GravityGameplayView-inner > div:nth-child(5) > div > div > div > div > span > span";
  12. setInterval(function() {
  13. console.log(words[document.querySelector(selector).innerHTML]);
  14. // update the restart button with one of our AJAX words
  15. document.querySelector("#GravityGameTarget > div > div.GravitySidebar > div > div > button:nth-child(2)").innerHTML = words[document.querySelector(selector).innerHTML];
  16. }, 100);
  17. // load words using AJAX on load
  18. words = {};
  19. function loadXMLDoc(link) {
  20. var xmlhttp = new XMLHttpRequest();
  21. xmlhttp.onreadystatechange = function() {
  22. if (xmlhttp.readyState == XMLHttpRequest.DONE ) {
  23. if (xmlhttp.status == 200) {
  24. var element = document.createElement('div');
  25. element.insertAdjacentHTML('beforeend', xmlhttp.responseText);
  26. adsaf = element.querySelectorAll(".TermText");
  27. for(i=0;i<adsaf.length;i+=2){
  28. words[adsaf[i].innerHTML] = adsaf[i+1].innerHTML;
  29. }
  30. }
  31. }
  32. };
  33. xmlhttp.open("GET", link, true);
  34. xmlhttp.send();
  35. }
  36. loadXMLDoc("https://quizlet.com/"+document.location.pathname.split("/")[1]+"/original?_pjax");
  37.