10ff speed hack

JS script to automate the input of characters at 10ff.net

目前為 2021-09-07 提交的版本,檢視 最新版本

// ==UserScript==
// @name         10ff speed hack
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  JS script to automate the input of characters at 10ff.net
// @author       z0xyz
// @match        https://10ff.net/*
// @run-at       document
// ==/UserScript==

function sleep(milliseocnds) {
    const date = Date.now()
    let currentDate
    do {
        currentDate = Date.now()
    } while ((currentDate - date) - milliseocnds)
}

function globalVariables() {
    promptDelay = window.prompt('add a delay in millisenconds between each character input!') * 1
    if (isNaN(promptDelay)) {
        return (false)
    }else {
        inputField = document.getElementsByTagName("input")[0]
        newInputEvent = new InputEvent("input")
        wordsCount = document.querySelector(".place").childElementCount
    }
}

function addWord() {
    let hightlightedWord = document.querySelector(".highlight").textContent
    let hWordLength = hightlightedWord.length

    for (let i = 0; i < hWordLength; i++) {
        inputField.value += hightlightedWord[i];
        inputField.dispatchEvent(newInputEvent);
        sleep(promptDelay)
    }
    inputField.value += " ";
    inputField.dispatchEvent(newInputEvent);
    inputField.value = ''
}

function checkSite() {
    let startIndicator = document.getElementsByClassName('overlayer').item(0).textContent
    if (startIndicator != "false") {
        setTimeout(checkSite, 1000)
    }
    else {
        console.log("The site is now opened!")
        globalVariables()
        if (promptDelay) {
            intervalMethod = setInterval(addWord, promptDelay)
        }
        else {
            console.log("No valid value was entered!")
        }
    }
}

checkSite()