10ff speed hack

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

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         10ff speed hack
// @namespace    http://tampermonkey.net/
// @version      0.5
// @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 promptValueCheck() {
    desiredSpeedWpm = window.prompt('add the desired Speed Wpm')
    if (desiredSpeedWpm != null && typeof(desiredSpeedWpm*1) == "number") {
        return (true)
    }else {
        return (false)
    }
}

function addWord() {
    try {
        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(eachCharacterInterval)
        }
        inputField.value += " ";
        inputField.dispatchEvent(newInputEvent);
        inputField.value = ''
    }catch {
        clearInterval(intervalMethod)
    }
}

function checkSite() {
    if (promptValueCheck()) {
        let charactersCount = document.querySelector(".place").textContent.length
        let totalTypingTimeSec = (charactersCount /5) / desiredSpeedWpm*1
        eachCharacterInterval = Math.round((totalTypingTimeSec * 60000) / charactersCount)

        inputField = document.getElementsByTagName("input")[0]
        newInputEvent = new InputEvent("input")

        intervalMethod = setInterval(addWord, eachCharacterInterval)
    }
    else {
        console.log("No valid value was entered!")
    }
}

(() =>  {
    let overlayNode = document.getElementsByClassName('overlayer').item(0)
    let config = {
        subtree:true,
        characterData: true
    }

    layerObserver = new MutationObserver(mutated)

    function mutated(mutations){
        mutations.forEach(function(mutation){
            if ( mutation.target.wholeText == "false" ) {
                console.log("The contest is now opened!")
                checkSite()
            }
        })
    }

    layerObserver.observe(overlayNode , config)
})()