在看sexkbj的时候总是跳转广告,网站还要求关闭UBlock,关键是有时候关了网站还检测不到,整得我实在受不了,于是用DeepSeek写了一个脚本,专门用来解决点击视频跳转和要求关闭UBlock的问题
// ==UserScript==
// [url=home.php?mod=space&uid=264574]@name[/url] 移除 sexkbj.top 嵌入页面的 AdBlock 提示和遮罩
// @namespace http://tampermonkey.net/
// [url=home.php?mod=space&uid=361048]@Version[/url] 1.1
// @description 删除 embed 页面中的 AdBlock 提示 div 以及全屏透明遮罩
// @author 你
// @match https://sexkbj.top/embed/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const targetText = "Please disable AdBlock to watch this video!";
function removeIt() {
// 1. 删除 AdBlock 文本提示
const xpath = `//div[contains(text(), '${targetText}')]`;
const result = document.evaluate(xpath, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
for (let i = 0; i < result.snapshotLength; i++) {
const el = result.snapshotItem(i);
if (el && el.parentNode) {
el.remove();
}
}
// 2. 删除全屏透明遮罩(特征:z-index:2147483647,inset:0,背景黑,极低透明度)
const divs = document.querySelectorAll('div');
divs.forEach(div => {
const style = div.getAttribute('style') || '';
// 同时满足:全屏固定、z-index为2147483647、背景黑色、透明度0.01
if (style.includes('position:fixed') &&
style.includes('inset:0') &&
style.includes('z-index:2147483647') &&
style.includes('background:black') &&
style.includes('opacity:0.01')) {
div.remove();
console.log('已移除透明遮罩');
}
});
}
// 页面加载完成后立刻执行
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', removeIt);
} else {
removeIt();
}
// 持续监听 DOM 变化,防止它们被重新插入
const observer = new MutationObserver(removeIt);
observer.observe(document.documentElement || document.body, {
childList: true,
subtree: true
});
})();複製代碼
评论 (0)
登录 后参与讨论。
还没有评论,来抢沙发吧。