Quizlet gravity cheat by Grizzle

Answers in the bottom left corner

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Quizlet gravity cheat by Grizzle
// @namespace    Grizzlesnitz
// @version      1.0
// @description  Answers in the bottom left corner
// @author       You
// @match        https://quizlet.com/*/gravity
// @grant        none
// ==/UserScript==

// Set settings and stuff
if(!localStorage.cheat){
    localStorage.cheatAutoType = true;
    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;
}