MyKirito Reincarnation PlugIn

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);
                    }
                }
            }
        }
    }

})();