The correct answer pops up in the browser console and the feedback button down left
当前为
// ==UserScript==
// @name Quizlet gravity game "helper"
// @namespace Danielv123
// @version 1.4
// @description The correct answer pops up in the browser console and the feedback button down left
// @author You
// @match https://quizlet.com/*/gravity
// @grant none
// ==/UserScript==
selector = "#GravityGameTarget > div > div > div > div.ModeLayout-content > div > div.GravityGameplayView-inner > div:nth-child(5) > div > div > div > .TermText > .TermText";
setInterval(function() {
//console.log(words);
translatedWord = words[document.querySelector(selector).innerHTML.replace(RegExp(
'<!--[\\s\\S]*?(?:-->)?'
+ '<!---+>?' // A comment with no body
+ '|<!(?![dD][oO][cC][tT][yY][pP][eE]|\\[CDATA\\[)[^>]*>?'
+ '|<[?][^>]*>?', // A pseudo-comment
'g'), "")];
//console.log(translatedWord);
// update the feedback button with one of our AJAX words
// select the "Restart" button
document.querySelector("#GravityGameTarget > div > div > div > div.ModeLayout-controls > div > div > div > div.ModeControls-main > div.ModeControls-actions > div:nth-child(2) > div > button > span").innerHTML = translatedWord;
}, 100);
// load words using AJAX on load
words = {};
function loadXMLDoc(link) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == XMLHttpRequest.DONE ) {
if (xmlhttp.status == 200) {
words = {};
var element = document.createElement('div');
element.insertAdjacentHTML('beforeend', xmlhttp.responseText);
adsaf = element.querySelectorAll(".TermText");
for(i=0;i<adsaf.length;i+=2){
words[adsaf[i].innerHTML] = adsaf[i+1].innerHTML;
}
}
}
};
xmlhttp.open("GET", link, true);
xmlhttp.send();
}
loadXMLDoc("https://quizlet.com/"+document.location.pathname.split("/")[1]+"/original?_pjax");