MyKirito Reincarnation PlugIn

霸權轉生點:不要再按到手軟

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         MyKirito Reincarnation PlugIn
// @namespace    https://github.com/JCxYIS/mykirito-reincarination-plugin
// @version      1.0
// @description  霸權轉生點:不要再按到手軟
// @author       JCxYIS
// @match        https://mykirito.com/*
// @grant        none
// ==/UserScript==

(function()
{
    'use strict';


    // 參數
    const FUNC_NAME_LIST = ["+", "-"];
    const TIMES_LIST = [10, 100]
    let lastPath = ""

    // 進入點
    setInterval ( function ()
        {
            if ( lastPath != location.pathname )
            {
                lastPath = location.pathname;
                main ();
            }
        }
        , 1000
    );



    // 主函式
    function main()
    {
        if(location.pathname != "/reincarnation")
        {
            return;
        }

        console.log("insert reincar")

        // 綁按紐
        let allbuttons = Array.from( document.getElementsByTagName('button') );
        for(let i = 0; i < allbuttons.length && i < 50; i++)
        {
            for(let j = 0; j < FUNC_NAME_LIST.length; j++)
            {
                if(allbuttons[i].innerText === FUNC_NAME_LIST[j] && allbuttons[i].offsetParent !== null) /*.parentElement.style.display != "none"*/
                {

                    // 綁次數
                    for(let k = 0; k < TIMES_LIST.length; k++)
                    {
                        let newButt = allbuttons[i].cloneNode(true);
                        newButt.innerHTML += TIMES_LIST[k];

                        // func
                        newButt.onclick = ()=>
                        {
                            let t = TIMES_LIST[k];
                            function doclick()
                            {
                                // console.log(t);
                                t--;
                                allbuttons[i].click();
                                if(t > 0)
                                    setTimeout(() => {doclick()}, 0);
                            }
                            doclick();
                        };

                        // insert
                        let p = allbuttons[i].parentNode
                        if(allbuttons[i].innerHTML === "-")
                            p.insertBefore(newButt, allbuttons[i].parentNode.firstChild);
                        else
                            p.appendChild(newButt);
                        // console.log(k+" Binded "+newButt.innerHTML);
                    }
                }
            }
        }
    }

})();