Battle Cats Auto Display

Auto-show enemy lists

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

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Battle Cats Auto Display
// @namespace    http://tampermonkey.net/
// @version      1.1
// @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

    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

    document.addEventListener('keydown', function(e) {
        if (e.ctrlKey && e.shiftKey && e.code === 'KeyS') {
            e.preventDefault();

            const article = document.querySelector('article');
            if (!article) {
                alert('<article> 요소를 찾을 수 없습니다.');
                return;
            }

            html2canvas(article).then(canvas => {
                const link = document.createElement('a');
                link.download = 'article_screenshot.png';
                link.href = canvas.toDataURL();
                link.click();
            });
        }
    });
})();