添加 移除SaToken的弹窗.js
This commit is contained in:
parent
6397ced695
commit
e8fb29e389
42
移除SaToken的弹窗.js
Normal file
42
移除SaToken的弹窗.js
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
Loading…
Reference in New Issue
Block a user