// ==UserScript== // @name 加多重buff的广告拦截脚本(改) // @author ChatGPT // @description 去广告脚本,可能有误杀,可以在脚本菜单禁用当前域名拦截,二改,优化了标识符替换和元素拦截,删除部分规则,尽量只做悬浮元素移除。 // @version 12.2 // @grant GM_registerMenuCommand // @grant GM_setValue // @grant GM_getValue // @grant GM_addStyle // @match *://*/* // @exclude *://www.colamanhua.com/* // @exclude *://*.bing.com/* // @exclude *://*.iqiyi.com/* // @exclude *://*.qq.com/* // @exclude *://*.v.qq.com/* // @exclude *://*.sohu.com/* // @exclude *://*.mgtv.com/* // @exclude *://*.ifeng.com/* // @exclude *://*.pptv.com/* // @exclude *://*.sina.com.cn/* // @exclude *://*.56.com/* // @exclude *://*.cntv.cn/* // @exclude *://*.tudou.com/* // @exclude *://*.baofeng.com/* // @exclude *://*.le.com/* // @exclude *://*.pps.tv/* // @exclude *://*.www.fun.tv/* // @exclude *://*.baidu.com/* // @exclude *://*.meipai.com/* // @exclude *://*.ku6.com/* // @exclude *://*.v1.cn/* // @exclude *://*.baomihua.com/* // @exclude *://*.wasu.cn/* // @exclude *://*.aipai.com/* // @exclude *://*.tvsou.com/* // @exclude *://*.6.cn/* // @exclude *://*.zhiyin.cn/* // @exclude *://*.1905.com/* // @exclude *://*.kankan.com/* // @exclude *://*.douyu.com/* // @exclude *://*.huya.com/* // @exclude *://*.longzhu.com/* // @exclude *://*.yy.com/* // @exclude *://*.hao123.com/* // @exclude *://*.kugou.com/* // @exclude *://*.9xiu.com/* // @exclude *://*.huomao.com/* // @exclude *://*.yizhibo.com/* // @exclude *://*.weibo.com/* // @exclude *://*.vmovier.com/* // @exclude *://*.bale.cn/* // @exclude *://*.cuctv.com/* // @exclude *://*.people.com.cn/* // @exclude *://*.cctv.com/* // @exclude *://*.jstv.com/* // @exclude *://*.brtn.cn/* // @exclude *://*.zjstv.com/* // @exclude *://*.iqilu.com/* // @exclude *://*.gdtv.com.cn/* // @exclude *://*.ahtv.cn/* // @exclude *://*.tvb.com/* // @exclude *://*.tvmao.com/* // @exclude *://*.douban.com/* // @exclude *://*.mtime.com/* // @exclude *://*.163.com/* // @exclude *://*.bilibili.com/* // @exclude *://*.www.gov.cn/* // @exclude *://*.kumi.cn/* // @exclude *://*.61.com/* // @exclude *://*.u17.com/* // @exclude *://*.stnn.cc/* // @exclude *://*.huanqiu.com/* // @exclude *://*.cankaoxiaoxi.com/* // @exclude *://*.takungpao.com/* // @exclude *://*.thepaper.cn/* // @exclude *://*.xinhuanet.com/* // @exclude *://*.chinanews.com/* // @exclude *://*.southcn.com/* // @exclude *://*.wenming.cn/* // @exclude *://*.81.cn/* // @exclude *://*.china.com/* // @exclude *://*.cnr.cn/* // @exclude *://*.cri.cn/* // @exclude *://*.youth.cn/* // @exclude *://*.71.cn/* // @exclude *://*.qdaily.com/* // @exclude *://*.k618.cn/* // @exclude *://*.infzm.com/* // @exclude *://*.legaldaily.com.cn/* // @exclude *://*.cyol.net/* // @exclude *://*.bjnews.com.cn/* // @exclude *://*.wenweipo.com/* // @exclude *://*.12371.cn/* // @exclude *://*.gmw.cn/* // @exclude *://*.hsw.cn/* // @exclude *://*.dahe.cn/* // @exclude *://*.nfcmag.com/* // @exclude *://*.chinadaily.com.cn/* // @exclude *://*.gxnews.com.cn/* // @exclude *://*.xfrb.com.cn/* // @exclude *://*.ycwb.com/* // @exclude *://*.sxrb.com/* // @exclude *://*.dbw.cn/* // @exclude *://*.fjsen.com/* // @exclude *://*.dzwww.com/* // @exclude *://*.cnhubei.com/* // @exclude *://*.oeeee.com/* // @exclude *://*.cqnews.net/* // @exclude *://*.inewsweek.cn/* // @exclude *://*.yangtse.com/* // @exclude *://*.lifeweek.com.cn/* // @exclude *://*.kankanews.com/* // @exclude *://*.cpd.com.cn/* // @exclude *://*.haiwainet.cn/* // @exclude *://*.banyuetan.org/* // @exclude *://*.cnautonews.com/* // @exclude *://*.yidianzixun.com/* // @exclude *://*.sinovision.net/* // @exclude *://*.un.org/* // @exclude *://*.cnn.com/* // @exclude *://*.tianya.cn/* // @exclude *://*.crntt.com/* // @exclude *://*.tiexue.net/* // @exclude *://*.kdnet.net/* // @exclude *://*.m4.cn/* // @exclude *://*.ifengweekly.com/* // @exclude *://*.guancha.cn/* // @exclude *://*.aisixiang.com/* // @exclude *://*.qidian.com/* // @exclude *://*.faloo.com/* // @exclude *://*.readnovel.com/* // @exclude *://*.hongxiu.com/* // @exclude *://*.xxsy.net/* // @exclude *://*.fmx.cn/* // @exclude *://*.xs8.cn/* // @exclude *://*.jjwxc.net/* // @exclude *://*.zongheng.com/* // @exclude *://*.kanshu.com/* // @exclude *://*.zhulang.com/* // @exclude *://*.19lou.com/* // @exclude *://*.17k.com/* // @exclude *://*.3gsc.com.cn/* // @exclude *://*.heiyan.com/* // @exclude *://*.qdmm.com/* // @exclude *://*.hongshu.com/* // @exclude *://*.motie.com/* // @exclude *://*.kujiang.com/* // @exclude *://*.shuhai.com/* // @exclude *://*.xiang5.com/* // @exclude *://*.hbooker.com/* // @exclude *://*.lkong.net/* // @exclude *://*.txtbook.com.cn/* // @exclude *://*.ximalaya.com/* // @exclude *://*.lrts.me/* // @exclude *://*.qingting.fm/* // @exclude *://*.tingbook.com/* // @exclude *://*.zhihu.com/* // @exclude *://*.nlc.cn/* // @exclude *://*.docin.com/* // @exclude *://*.storychina.cn/* // @exclude *://*.duokan.com/* // @exclude *://*.jianshu.com/* // @exclude *://*.dangdang.com/* // @exclude *://*.migu.cn/* // @exclude *://*.amazon.cn/* // @exclude *://*.newsmth.net/* // @exclude *://*.voc.com.cn/* // @exclude *://*.mop.com/* // @exclude *://*.xici.net/* // @exclude *://*.news.cn/* // @exclude *://*.oneniceapp.com/* // @exclude *://*.hupu.com/* // @exclude *://*.taobao.com/* // @exclude *://*.renren.com/* // @exclude *://*.kaixin001.com/* // @exclude *://*.muyewx.com/* // @exclude *://*.renhe.cn/* // @exclude *://*.blogchina.com/* // @exclude *://*.trueme.net/* // @exclude *://*.bokee.com/* // @exclude *://*.hexun.com/* // @exclude *://*.cnblogs.com/* // @exclude *://*.cnstock.com/* // @exclude *://*.eastmoney.com/* // @exclude *://*.lofter.com/* // @exclude *://*.baike.com/* // @exclude *://*.duitang.com/* // @exclude *://*.guokr.com/* // @exclude *://*.360doc.com/* // @exclude *://*.qiushibaike.com/* // @exclude *://*.paidai.com/* // @exclude *://*.hualongxiang.com/* // @exclude *://*.rednet.cn/* // @exclude *://*.xmfish.com/* // @exclude *://*.liba.com/* // @exclude *://*.hefei.cc/* // @exclude *://*.cnnb.com/* // @exclude *://*.qingdaonews.com/* // @exclude *://*.taihe.com/* // @exclude *://*.kuwo.cn/* // @exclude *://*.1ting.com/* // @exclude *://*.9ku.com/* // @exclude *://*.9sky.com/* // @exclude *://*.yue365.com/* // @exclude *://*.xiami.com/* // @exclude *://*.vvvdj.com/* // @exclude *://*.5ydj.com/* // @exclude *://*.dj97.com/* // @exclude *://*.ik123.com/* // @exclude *://*.djye.com/* // @exclude *://*.y2002.com/* // @exclude *://*.yinyuetai.com/* // @exclude *://*.letv.com/* // @exclude *://*.guqu.net/* // @exclude *://*.changba.com/* // @exclude *://*.a8.com/* // @exclude *://*.mvbox.cn/* // @exclude *://*.tan8.com/* // @exclude *://*.musicool.cn/* // @exclude *://*.ccshao.com/* // @exclude *://*.besgold.com/* // @exclude *://*.moofeel.com/* // @exclude *://*.douban.fm/* // @exclude *://*.kaolafm.com/* // @exclude *://*.zol.com.cn/* // @exclude *://*.pconline.com.cn/* // @exclude *://*.pcpop.com/* // @exclude *://*.imobile.com.cn/* // @exclude *://*.cnmo.com/* // @exclude *://*.it168.com/* // @exclude *://*.gfan.com/* // @exclude *://*.feng.com/* // @exclude *://*.xiaomi.cn/* // @exclude *://*.ip138.com/* // @exclude *://*.10086.cn/* // @exclude *://*.10010.com/* // @exclude *://*.win001.com.cn/* // @exclude *://*.qimao.com/* // @exclude *://*.ciweimao.com/* // @exclude *://*.sina.cn/* // @exclude *://*.zhangyue.com/* // @exclude *://*.shuqi.com/* // @exclude *://*.tadu.com/* // @exclude *://*.luochu.com/* // @exclude *://*.360.cn/* // @exclude *://*.qwsy.com/* // @exclude *://*.cmread.com/* // @exclude *://*.ruochu.com/* // @exclude *://*.luochen.com/* // @exclude *://*.3g.cn/* // @exclude *://*.shucong.com/* // @exclude *://*.qrxs.cn/* // @exclude *://*.10000read.com/* // @exclude *://*.tiandizw.com/* // @exclude *://*.qingoo.cn/* // @exclude *://*.zhangwen.cn/* // @exclude *://*.xmkanshu.com/* // @exclude *://*.hnquxing.com/* // @exclude *://*.51changdu.cn/* // @exclude *://*.mingqingxiaoshuo.com/* // @exclude *://*.china.com.cn/* // @exclude *://*.jcrb.com/* // @exclude *://*.cfi.cn/* // @exclude *://*.cyol.com/* // @exclude *://*.chnews.net/* // @exclude *://*.cngold.org/* // @exclude *://*.anhuinews.cc/* // @exclude *://*.huxiu.com/* // @exclude *://*.winshang.com/* // @exclude *://*.eastday.com/* // @exclude *://*.leju.com/* // @exclude *://*.10jqka.com.cn/* // @exclude *://*.fx678.com/* // @exclude *://*.m.fun.tv/* // @exclude *://*.acfun.cn/* // @exclude *://*.znds.com/* // @exclude *://*.km.com/* // @exclude *://*.huajiao.com/* // @exclude *://*.zhibo8.cc/* // @exclude *://*.kanman.com/* // @exclude *://*.dongmanmanhua.cn/* // @exclude *://*.mkzhan.com/* // @exclude *://*.manhuatai.com/* // @exclude *://*.kuaikanmanhua.com/* // @exclude *://*.dm5.com/* // @exclude *://*.iyouman.com/* // @exclude *://*.manhuadao.cn/* // @exclude *://*.shenmantang.com/* // @exclude *://*.manmanapp.com/* // @exclude *://*.kumanhua.net/* // @exclude *://*.xinmanhua.net/* // @exclude *://*.bymanhua.com/* // @exclude *://*.kaimanhua.com/* // @exclude *://*.isamanhua.com/* // @exclude *://*.sfacg.com/* // @exclude *://*.myfcomic.com/* // @exclude *://*.shenglifubang.cn/* // @exclude *://*.soudongman.com/* // @exclude *://*.qiremanhua.com/* // @exclude *://*.buka.cn/* // @exclude *://*.taomanhua.com/* // @exclude *://*.yizhikan.com/* // @exclude *://*.zymk.cn/* // @exclude *://*.chjak.cn/* // @exclude *://*.ixigua.com/* // @exclude *://*.diyidan.com/* // @exclude *://*.1kkk.com/* // @exclude *://*.4399dmw.com/* // @exclude *://*.manmankan.com/* // @exclude *://*.17173.com/* // @exclude *://*.78dm.net/* // @exclude *://*.manben.com/* // @exclude *://*.gdtv.cn/* // @exclude *://*.m1905.com/* // @exclude *://*.lcread.com/* // @exclude *://*.sxcnw.net/* // @exclude *://*.lingyun5.com/* // @exclude *://*.laikan.com/* // @exclude *://*.ihuaben.com/* // @exclude *://*.4yt.net/* // @exclude *://*.bayueju.com/* // @exclude *://*.zuitang.com/* // @exclude *://*.iyunyue.com/* // @exclude *://*.fbook.net/* // @exclude *://*.so.com/* // @exclude *://*.nipic.com/* // @exclude *://*.npc.gov.cn/* // @exclude *://*.ltaaa.com/* // @exclude *://*.zuowen.com/* // @exclude *://*.rain8.com/* // @exclude *://*.pingshu8.com/* // @exclude *://*.yymp3.com/* // @exclude *://*.5nd.com/* // @exclude *://*.mtv123.com/* // @exclude *://*.yy8844.cn/* // @exclude *://*.djkk.com/* // @exclude *://*.ce.cn/* // @exclude *://*.cac.gov.cn/* // @exclude *://*.chinanews.com.cn/* // @exclude *://*.dayoo.com/* // @exclude *://*.shenchuang.com/* // @exclude *://*.cqwb.com.cn/* // @exclude *://*.sznews.com/* // @exclude *://*.zjol.com.cn/* // @exclude *://*.sh.cn/* // @exclude *://*.xilu.com/* // @exclude *://*.miercn.com/* // @exclude *://*.nba.com/* // @exclude *://*.yicai.com/* // @exclude *://*.caixin.com/* // @exclude *://*.zgjrjw.com/* // @exclude *://*.eeo.com.cn/* // @exclude *://*.nbd.com.cn/* // @exclude *://*.guandian.cn/* // @exclude *://*.chinavalue.net/* // @exclude *://*.chinaventure.com.cn/* // @exclude *://*.ebusinessreview.cn/* // @exclude *://*.iceo.com.cn/* // @exclude *://*.jjckb.cn/* // @exclude *://*.cb.com.cn/* // @exclude *://*.dmkb.net/* // @exclude *://*.iheima.com/* // @exclude *://*.titan24.com/* // @exclude *://*.sport.gov.cn/* // @exclude *://*.cba.net.cn/* // @exclude *://*.thecfa.cn/* // @exclude *://*.lottery.gov.cn/* // @exclude *://*.nowscore.com/* // @exclude *://*.7m.cn/* // @exclude *://*.leisu.com/* // @exclude *://*.gooooal.com/* // @run-at document-start // @namespace https://greasyfork.org/users/452911 // ==/UserScript== (function() { 'use strict'; // 获取当前网站URL,并根据其生成一个唯一的存储键 var storageKey = window.location.hostname; // 根据存储键获取已保存的设置(如果存在) var isEnabled = GM_getValue(storageKey, true); function showAlert() { (function() { var g_times = 0, itids = [], timer; function myfun() { //隐藏元素 itids.push( setTimeout(function() { var styleTag = document.createElement('style'); styleTag.innerHTML = ` .hidden-element { display: none !important; visibility: hidden; opacity: 0; z-index: -999; width: 0; height: 0; pointer-events: none; position: absolute; left: -9999px; top: -9999px; } `; document.head.appendChild(styleTag); var elements = document.querySelectorAll("[style*='background-image:url(data:image/'],[id][class][classname],[ontouchstar],[class*='_'][id*='_']"); for (var i = 0; i < elements.length; i++) { var zIndex = parseInt(elements[i].style.zIndex); if (zIndex > 600) { elements[i].classList.add('hidden-element'); } } }, 350) ); if (g_times >= 6) { window.clearInterval(timer); } g_times++; } itids.push( setTimeout(function() { //主循环计时器 timer = setInterval(myfun, 500); itids.push(timer); myfun(); }, 500) ); })(); //通用规则 // 假定的输入字符串,分为三部分 const input1 = `##[style*='width: 100vw; background: url'][style$='no-repeat; position: fixed;'][style*='0px 0px / 100vw '] ##[style="position:absolute !important;padding:0px !important;margin:0px !important;width:100% !important;font-size:0px !important;line-height:0px !important;"] ##[style*="background-image:url(data:image/"] ##[class][style*="px; top: 0px; left: 0px; z-index"][style$="width: 100vw; position: relative;"] ##body > [style$="background-size: 407px 101px !important;"] ##body > [style$="background-size: 407px 104px !important;"] ##body > [style$="background-size: 407px 127.188px !important;"] ##body > [style$="background-size: 407px 127px !important;"] ##body > [style$="background-size: 407px 128px !important;"] ##body > [style$="background-size: 407px 129px !important;"] ##body > [style$="background-size: 407px 130px !important;"] ##body > [style$="background-size: 407px 132px !important;"] ##body > [style$="background-size: 407px 135px !important;"] ##body > [style$="background-size: 407px 95px !important;"] ##body > [style$="width:9.6vw;height:8.5vw;background: #000;opacity:0.01;"] ##body > [style$="width:9.6vw;height:8.5vw;background:#000;opacity:0.01;"] ##body > [style*="background"][style*="#000"][style$="opacity:0.01;"] ##body > [style*="position:fixed; bottom:0vw; left:0vw; z-index:"] ##body > [style="display: block; z-index: 2147483646; width: 14px; position: fixed; height: 14px; left: 1px; bottom: 129px; box-sizing: content-box;"] ##body > [style="display: block; z-index: 2147483646; width: 14px; position: fixed; height: 14px; left: 1px; top: 129px; box-sizing: content-box;"] ##body > [style^="display: block; z-index: 2147483647; width: 10%;"][style$="!important;"] ##body > [style^="display: block;"][style*="129px;"] ##body > [style^="position: fixed; z-index: 100; display: block; left: 0px; width: 36px;"] ##body > div#dontfoid ##body > div#fixedban ##body > div.demo-wrapper[style="display:none;"] + div[id][class] ##body > div[class$="c"][style="bottom: 135px;"] ##body > div[class$="h"][style="bottom: 135px;"] ##body > div[class$="m"][style="display: block; width: 100%; height: 135px;"] ##body > div[class="swiper swiper-initialized swiper-horizontal swiper-ios swiper-backface-hidden"] ##body > div[class][style="bottom: 104px;"] ##body > div[class][style="bottom: 129px;"] ##body > div[class][style="bottom: 135px;"] ##body > div[class][style="display: block; width: 100%; height: 129px;"] ##body > div[class][style="display: block; width: 100%; height: 135px;"] ##body > div[class][style="display: block; width: 100%; left: 0px; position: fixed; z-index: 2147483646; height: 95px; top: 101px;"] ##body > div[class][style="top: 104px;"] ##body > div[class][style="top: 129px;"] ##body > div[class][style="top: 135px;"] ##body > div[class][style^="display: block; width: 100%; left: 0px; position: fixed; z-index: 2147"][style$="top: 135px;"] ##body > div[class][style^="display: block; width: 100%; left: 0px; position: fixed; z-index: 21474"] ##body > div[id^="a17"] > div[id^="u17"] ##body > div[style$="background: #000;opacity:0.01;"] ##body > div[style^="position: fixed; inset: 0px; z-index: 2147483647; background: black; opacity: 0.01;"] ##body > embed[id][src*="://"][src$="="] ##body > embed[id][src^="https:///"] ##body > span[style*="bottom:"][style*="30vh"][style*="position"][style*="fixed"] ##div[class^="is_"] > a > img[referrerpolicy="no-referrer"] ##div[class][style$="0vh; width: 0vw; bottom: 0px; left: 0px;"] ##div[class][style$="background-size: 393px 131px !important;"] ##div[class][style*="100vw"][style*="no-repeat"][style*="background:"][style*="0px"] ##div[class][style*="9.6vw;"][style$="background: #000;opacity:0.01;"],div[class][style*="9.6vw;"][style$="background:#000;opacity:0.01;"],div[class][style*="131px"][style*="bottom"],div[style*="bottom:0vw;"][style*="9.6vw;"][style$="background: #000;opacity:0.01;"],div[style*="bottom:0vw;"][style*="9.6vw;"][style$="background:#000;opacity:0.01;"] ##div[class][style*="bottom: 0px; left: 0px; animation: 1.5s ease 0.2s infinite normal none running shakegwegs; z-index:"][style$="width: 100vw; position: fixed;"] ##div[class][style*="bottom: 0px; left: 0px; z-index:"][style*="0px 0px"][style*="no-repeat"] ##div[class][style*="display: block;"][style*="131px;"],div[class][style*="width: 100%;"][style*="131px;"],div[class][style*="z-index: 2147483646;"][style*="131px"],div[class][style*="position: fixed;"][style*="131px"],div[class][style*="z-index:"][style*="display: block;"][style$="98px;"] ##div[class][style*="top: 0px; left: 0px; animation: 1.5s ease 0.2s infinite normal none running shakegwegs; z-index:"][style*="100vw;"] ##div[class][style*="z-index:"][style*="0px 0px / 100vw"][style*="no-repeat"] ##div[class][style="display: block; width: 100%; height: 100%; left: 0px; bottom: 0px; position: fixed; z-index: 2147483646;"] ##div[class][style^="line-height:"][style*="/"][style*="100vw"][style*="0px"][style*="animation"][style*="infinite"][style*="background:"] `; const input2 = `##div[class][style*="9.6vw;"][style$="background: #000;opacity:0.01;"],div[class][style*="9.6vw;"][style$="background:#000;opacity:0.01;"],div[class][style*="131px"][style*="bottom"],div[style*="bottom:0vw;"][style*="9.6vw;"][style$="background: #000;opacity:0.01;"],div[style*="bottom:0vw;"][style*="9.6vw;"][style$="background:#000;opacity:0.01;"]`; // 函数用来处理单个输入字符串并添加样式 function addCustomStyle(input) { // 移除前两个字符 ('##'),拼接它们为CSS选择器 const selector = input.split('\n').map(line => line.slice(2)).join(','); // 定义CSS规则 const cssRule = `${selector} {display: none !important;visibility: hidden; opacity: 0; z-index: -999; width: 0; height: 0; pointer-events: none; position: absolute; left: -9999px; top: -9999px;}`; // 如果 GM_addStyle 函数存在,则应用样式 if (typeof GM_addStyle === 'function') { GM_addStyle(cssRule); } else { console.error('GM_addStyle is not available. Ensure you are running this script in a userscript manager environment like Tampermonkey or Greasemonkey.'); } } // 对每一个输入执行函数 addCustomStyle(input1); // 为第一部分的选择器应用样式 addCustomStyle(input2); // 为第二部分的选择器应用样式 (function() { const FAKE_PLATFORM = 'Mac'; const spoofNavigator = new Proxy(navigator, { get(target, prop) { if (prop === 'platform') { return FAKE_PLATFORM; } return typeof target[prop] === 'function' ? target[prop].bind(target) : target[prop]; }, getOwnPropertyDescriptor(target, prop) { if (prop === 'platform') { return { value: FAKE_PLATFORM, writable: false, configurable: true, enumerable: true }; } return Object.getOwnPropertyDescriptor(target, prop); } }); try { if (Object.getOwnPropertyDescriptor(navigator, 'platform')) { navigator.__defineGetter__('platform', function() { return FAKE_PLATFORM; }); } else { Object.defineProperty(navigator, 'platform', { get: function() { return FAKE_PLATFORM; }, configurable: true, enumerable: true }); } Object.defineProperty(window, 'navigator', { value: spoofNavigator, writable: false, configurable: true }); Object.defineProperty(Navigator.prototype, 'platform', { get: function() { return FAKE_PLATFORM; }, configurable: true, enumerable: true }); const originalIndexOf = String.prototype.indexOf; String.prototype.indexOf = function(searchString) { if (this === FAKE_PLATFORM) { if (searchString === 'Win' || searchString === 'Linux' || searchString === 'X11') { return -1; } if (searchString === 'Mac') { return 0; } } return originalIndexOf.apply(this, arguments); }; } catch (e) { console.warn('Platform spoofing fallback:', e); window.navigator = spoofNavigator; } Object.freeze(window.navigator); // 确保在DOM加载前生效 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function() { Object.defineProperty(window, 'navigator', { value: spoofNavigator, writable: false }); }); } })(); } // 根据保存的设置来启用或禁用弹出提示框功能 if (isEnabled) { showAlert(); } // 创建油猴菜单项,在菜单中添加“启用”和“禁用”选项 GM_registerMenuCommand(isEnabled ? '禁用buff拦截' : '启用buff拦截', function() { isEnabled = !isEnabled; GM_setValue(storageKey, isEnabled); if (isEnabled) { showAlert(); } }); })();