{
"manifest_version": 2,
"name": "anything",
"version": "1.0",
"description": "anything",
"content_scripts": [
{
"matches": ["*://baidu.com/*"],
"js": ["js/index.js"]
}
]
}
必备manifest.json文件,内容自定义
参考:用js写谷歌浏览器插件_js浏览器插件怎么使用_乌龟壳的博客-CSDN博客
生成的文件是:
success
manifest.json
{
"manifest_version": 2,
"name": "www.sl999.info",
"version": "1.0",
"description": "display no advertisement",
"content_scripts": [
{
"matches": ["https://www.sl999.info/*"],
"js": ["index.js"]
}
]
}
网址不是.com
遇上div.wrapped,只显示内部的<main>标签
const wrappedDivs = document.querySelectorAll('div.wrapped');
// Loop through each wrapped div
wrappedDivs.forEach(div => {
// Use div.querySelector() to select the main element within the current div
const mainElement = div.querySelector('main');
// Set the innerHTML of the current div to the HTML of the main element
div.innerHTML = mainElement.innerHTML;
});
修改匹配网址,直接修改manifest.json即可,再重新加载插件即可,不用删除原有和再生成