Battle Cats Auto Display

Auto-show enemy lists

当前为 2025-04-11 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Battle Cats Auto Display
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Auto-show enemy lists
// @author       HmmmE
// @match        https://ponosgames.com/information/appli/battlecats/stage/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function tryRunScript() {
        const ready = typeof setCurrentStageIndex === "function" &&
                      document.querySelector('[id$="enemy_list_1"]');

        if (!ready) return false;

        // 1. Set high stage index
        setCurrentStageIndex(10000);

        // 2. Show all *_enemy_list_1
        document.querySelectorAll('[id$="enemy_list_1"]').forEach(function(el) {
            if (el.id.startsWith("stage") && el.id.includes("_enemy_list_1")) {
                el.style.display = "";
            }
        });

        // 3. Show all *_enemy_list
        document.querySelectorAll('[id$="enemy_list"]').forEach(function(el) {
            if (el.id.startsWith("stage") && el.id.includes("_enemy_list")) {
                el.style.display = "";
            }
        });

        return true;
    }

    // Add a delay (in milliseconds)
    const delayTime = 100; // 0.1 seconds delay (you can adjust this value)

    setTimeout(function() {
        // Keep checking until ready
        const interval = setInterval(() => {
            const success = tryRunScript();
            if (success) clearInterval(interval); // Stop checking when successful
        }, 300); // Check every 300ms
    }, delayTime); // Wait for the specified delay
})();