您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Fixes the stupid bug where you cant edit costumes correctly in Scratch.
// ==UserScript== // @name Scratch Costume Editor Fix // @namespace http://tampermonkey.net/ // @version 0.1 // @description Fixes the stupid bug where you cant edit costumes correctly in Scratch. // @match https://scratch.mit.edu/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; function clickBtn(label) { const btn = document.querySelector(`[aria-label="${label}"]`); if (btn) btn.click(); } function runFix() { console.log("[ScratchFix] Running sequence..."); clickBtn("Copy"); setTimeout(() => { clickBtn("Convert to Bitmap"); setTimeout(() => { clickBtn("Delete"); setTimeout(() => { clickBtn("Convert to Vector"); setTimeout(() => { clickBtn("Paste"); }, 400); }, 400); }, 400); }, 400); } // watch for switching/selecting costumes const observer = new MutationObserver((mutations) => { for (const m of mutations) { if (m.target && m.target.closest && m.target.closest('.costumes-panel')) { runFix(); break; } } }); function startObserver() { const panel = document.querySelector('.costumes-panel'); if (panel) { observer.observe(panel, { childList: true, subtree: true }); console.log("[ScratchFix] Watching costume panel."); } else { setTimeout(startObserver, 1000); } } startObserver(); })();