Auto-show enemy lists
当前为
// ==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();
});
}
});
})();