kukuw.com 作弊工具

点击进入页面直接开始打字

目前为 2023-11-19 提交的版本。查看 最新版本

// ==UserScript==
// @name        kukuw.com 作弊工具
// @namespace   Violentmonkey Scripts
// @match       https://dazi.kukuw.com/typing.html
// @grant       GM_getValue
// @version     0.2
// @run-at      document-idle
// @author      -
// @license     MIT
// @description 点击进入页面直接开始打字
// @inject-into page
// ==/UserScript==
'use strict';
const delay = n => new Promise(r => setTimeout(r, n));

let elem, elem2;

const press = (() => {
    const conf2 = {
        inputType: "insertText",
    };
    function type(key) {
        elem.value += conf2.data = key;
        elem.dispatchEvent(new InputEvent("input", conf2));
    }
    return type;
})();

const listener = new MutationObserver(list => list.forEach(rec => {
    const t = rec.target;
    if (t.className.includes("typing_on")) elem2 = t, main();

}));

document.querySelectorAll("div.typing").forEach(el => listener.observe(el, {attributeFilter: ["class"]}));

elem2 = document.querySelector("div.typing_on");
main();



async function main() {
    elem = elem2.querySelector("input.typing");
    const dest = elem2.querySelector("input[type=hidden]").value;
    if (GM_getValue("split_on", false))
        for (let i = 0, t; t = GM_getValue("split", 3), i < dest.length; i += t) {
            press(dest.substring(i, i+t));
            await delay(GM_getValue("speed_c", 100) + Math.trunc(Math.random() * GM_getValue("speed_v", 30)));
        }
    else
        for (const j of dest) {
            press(j);
            await delay(GM_getValue("speed_c", 100) + Math.trunc(Math.random() * GM_getValue("speed_v", 30)));
        }

}

console.log("running...");