From e8fb29e389bfdd5a182b061d352f1cfab25713bc Mon Sep 17 00:00:00 2001 From: 8ga Date: Sun, 1 Feb 2026 15:40:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E7=A7=BB=E9=99=A4SaToken?= =?UTF-8?q?=E7=9A=84=E5=BC=B9=E7=AA=97.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 移除SaToken的弹窗.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 移除SaToken的弹窗.js diff --git a/移除SaToken的弹窗.js b/移除SaToken的弹窗.js new file mode 100644 index 0000000..5dc88a8 --- /dev/null +++ b/移除SaToken的弹窗.js @@ -0,0 +1,42 @@ +// ==UserScript== +// @name 移除SaToken的弹窗 +// @namespace http://tampermonkey.net/ +// @version 1.0 +// @description 移除SaToken的弹窗 +// @author 8ga +// @match https://sa-token.cc/* +// @grant none +// ==/UserScript== + +(function () { + 'use strict'; + + // 立即检查一次(防止页面已加载完成) + removePasswordModal(); + + // 使用 MutationObserver 监听 DOM 变化 + const observer = new MutationObserver((mutations) => { + for (const mutation of mutations) { + if (mutation.type === 'childList') { + // 如果新增节点中有目标元素,立即移除 + if (document.getElementById('passwordModal')) { + removePasswordModal(); + } + } + } + }); + + // 开始监听整个 document 的子节点变化(包括深层嵌套) + observer.observe(document.body, { + childList: true, + subtree: true + }); + + function removePasswordModal() { + const modal = document.getElementById('passwordModal'); + if (modal && modal.parentNode) { + console.log('[Tampermonkey] 已移除 passwordModal 弹窗'); + modal.remove(); + } + } +})(); \ No newline at end of file