Greasy Fork

Greasy Fork is available in English.

一键撸猫

一键撸猫帮助你更好的撸猫

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         一键撸猫
// @namespace    knva
// @version      0.4
// @homepage     http://greasyfork.icu/zh-CN/scripts/381918
// @description  一键撸猫帮助你更好的撸猫
// @author       knva
// @match        https://likexia.gitee.io/cat-zh/
// @grant        none
// ==/UserScript==

(function () {
    'use strict';
    var UI = {
        Btn: (pclass, text) => {
            return `<div class="btn nosel modern ${pclass}" style="position: relative; display: block;"  > <div class="btnContent" title=""><span>${text}</span></div></div>`;
        },
    };
    var WG = {
        init: () => {
            var html = UI.Btn("startbtn1", '开始采集') + UI.Btn("startbtn2", '开始精炼');

            $("#gameContainerId").after(html);
            ; $(".startbtn1").on("click", () => {
                WG.starttimer(0);
                if (WG.p_timer[0] == null) {
                    $(".startbtn1 span").text('开始采集')
                } else {
                    $(".startbtn1 span").text('停止采集')
                }
            })
                ; $(".startbtn2").on("click", () => {
                    WG.starttimer(1);
                    if (WG.p_timer[1] == null) {
                        $(".startbtn2 span").text('开始精炼')
                    } else {
                        $(".startbtn2 span").text('停止精炼')
                    }
                })
        },
        sleep: () => {
        },
        p_timer: [null, null],
        starttimer: p => {
            if (WG.p_timer[p] != null) {
                clearInterval(WG.p_timer[p]);
                WG.p_timer[p]=null;
                return;
            }
            if (p == 0) {
                WG.p_timer[p] = setInterval(() => {
                    $.each($(".btn"), function () {
                        if ($(this).html().indexOf("采集猫薄荷") >= 0) {
                            $(this).click();
                        }
                    });
                }, 1);
            }
            if (p == 1) {
                WG.p_timer[p] = setInterval(() => {
                    $.each($(".btn"), function () {
                        if ($(this).html().indexOf("精炼猫薄荷") >= 0) {
                            $(this).click();
                        }
                    });
                }, 100);
            }
        },
        stoptimer: () => {
            for (let item of WG.p_timer) {
                clearInterval(item);
            }
        }

    }
    // Your code here...

    $(document).ready(function () {
        WG.init();


    });
})();