您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Replace zoomable image with clone and close modal on click
// ==UserScript== // @name Mastodon img Zoom Fix and Auto-Close // @description Replace zoomable image with clone and close modal on click // @match https://mastodon.social/* // @run-at document-idle // @version 0.0.1.20250524080115 // @namespace https://greasyfork.org/users/1435046 // ==/UserScript== const observer = new MutationObserver(() => { const oldElement = document.querySelector('.zoomable-image img'); if (oldElement && !oldElement.dataset.replaced) { const newElement = oldElement.cloneNode(true); // deep clone newElement.dataset.replaced = 'true'; // mark the new one oldElement.parentNode.replaceChild(newElement, oldElement); } }); observer.observe(document.body, { childList: true, subtree: true }); document.querySelector('.zoomable-image img') .addEventListener('click', () => { document.querySelector('.media-modal__buttons .icon-button[title="Close"]').click(); });