您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Auto-show enemy lists
当前为
- // ==UserScript==
- // @name Battle Cats Auto Display
- // @namespace http://tampermonkey.net/
- // @version 1.2
- // @description Auto-show enemy lists
- // @author HmmmE
- // @match https://ponosgames.com/information/appli/battlecats/stage/*
- // @grant none
- // @require https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js
- // ==/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;
- }
- // 지연 실행
- const delayTime = 100; // 0.1초
- setTimeout(function() {
- const interval = setInterval(() => {
- const success = tryRunScript();
- if (success) clearInterval(interval);
- }, 300);
- }, delayTime);
- // 추가 기능: Ctrl + Shift + S로 <article> 캡처
- 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 urlPath = new URL(window.location.href).pathname;
- const pathParts = urlPath.split('/');
- let filename = 'stage';
- const stageIndex = pathParts.indexOf('stage');
- if (stageIndex !== -1) {
- const maybeLang = pathParts[stageIndex + 1];
- const maybeStage = pathParts[stageIndex + 2] || maybeLang;
- if (maybeStage.endsWith('.html')) {
- if (maybeLang !== undefined && maybeLang !== maybeStage) {
- filename += `_${maybeLang}`;
- }
- filename += `_${maybeStage.replace('.html', '')}`;
- }
- }
- // 이미지 저장
- const link = document.createElement('a');
- link.download = `${filename}.png`;
- link.href = canvas.toDataURL();
- link.click();
- });
- }
- });
- })();