Quizlet gravity game cheat

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

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Quizlet gravity game cheat
// @namespace    Danielv123
// @version      2.4
// @description  The correct answer pops up in the browser console and the restart button down left
// @author       You
// @match        https://quizlet.com/*/gravity
// @grant        none
// ==/UserScript==

// Set settings and stuff
if(!localStorage.cheat){
    localStorage.cheatAutoType = false;
    localStorage.cheatActivated =  true;
}

// selectors, if something breaks these probably needs updating
// get word from asteroid
// broken 19.09.17 selector = "#GravityGameTarget > div > div > div > div.ModeLayout-content > div > div.GravityGameplayView-inner > div:nth-child(5) > div > div > div > .TermText > .TermText";
selector = "div > div > div > .TermText > .TermText";

// outputSelector = "#GravityGameTarget > div > div > div > div.ModeLayout-controls > div > div > div > div.ModeControls-main > div.ModeControls-actions > div:nth-child(2) > div > button > span";
outputSelector = "#GravityModeTarget > div > div > div > div.ModeLayout-controls > div > div > div > div.ModeControls-main > div.ModeControls-actions > div:nth-child(2) > div > button > span";

inputSelector = "#GravityGameTarget > div > div > div > div.ModeLayout-content > div > div.GravityGameplayView-inner > div.GravityGameplayView-typingPrompt > span > div > div > div.GravityTypingPrompt-inputWrapper > textarea";

inputRepeatSelector = "#GravityGameTarget > div > div > div > div.ModeLayout-content > div > div.GravityGameplayView-inner > div:nth-child(3) > div > div > div > div.GravityCopyTermView-inputWrapper > textarea";

setInterval(function() {
    // console.log(words);
    if(document.querySelector(selector) && localStorage.cheatActivated == "true"){
        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 translated words
        document.querySelector(outputSelector).innerHTML = translatedWord;
        if(document.querySelector(inputSelector).value == "" && localStorage.cheatAutoType == "true"){
            document.querySelector(inputSelector).value = translatedWord;
        }
    }
}, 100);

// Quizlet.gravityModeData.terms[0].definition gets data straight from quizlet :3
words = {};
for(i = 0; i<Quizlet.gravityModeData.terms.length; i++){
    words[Quizlet.gravityModeData.terms[i].word] = Quizlet.gravityModeData.terms[i].definition;
}