一、测试网址 https://www.yy6080.info/
manifest.json
{
"manifest_version": 2,
"name": "NoAd",
"version": "1.0.0",
"description": "",
"icons":
{
"16": "icon/icon.png",
"48": "icon/icon.png",
"128": "icon/icon.png"
},
"content_scripts":
[
{
"matches": ["*://www.yy6080.info/*"],
"js": ["js/content-scripts.js"],
"run_at": "document_end",
"all_frames":true
}
],
"permissions":["*://www.yy6080.info/*"],
"browser_action":{},
"options_ui":
{
"chrome_style": true
}
}
二、content-scripts
function getElement(element) {
if (element.parentElement === document.body ) {
return element
} else
return getElement(element.parentElement)
}
function filter() {
for (let i of document.getElementsByTagName('a')) {
if (i.href !== "javascript:;" && new RegExp(location.origin).test(i.href) =

本文介绍了一个用于去除特定网址广告的Chrome扩展脚本。通过在页面加载完成后移除不匹配当前域名的链接、图片、视频和iframe元素,达到去广告的目的。示例代码仅适用于https://www.yy6080.info/,其他网址需根据实际调整。
最低0.47元/天 解锁文章
9403

被折叠的 条评论
为什么被折叠?



