add adblock content script

This commit is contained in:
jianxin committed 2023-11-04 08:19:08 +08:00
1 parent 5dba81e4a4
commit f245fb048b
8 files changed
+117 -102

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
function getElementByXpath(path) {
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}
function removeElementByXpath(path) {
var element = getElementByXpath(path);
if (element) {
element.remove();
} else {
// console.log("No element found with the provided XPath: " + path);
}
}
const ele_list = ['//*/div[@class="y-guide"]', '//*/div[@class="auxo-modal-root"]', '//*/div[contains(@class, "index_DragControlle")]']
setInterval(function () {
for (let ele of ele_list) {
removeElementByXpath(ele);
}
}, 500); // 300 毫秒