fix some bugs
This commit is contained in:
1 parent
f245fb048b
commit
e50e68963f
2 files changed
+20
-6
No files matched your search
+18
-4
@@ -1,3 +1,5 @@
|
||||
let currentUrl = window.location.href;
|
||||
|
||||
function getElementByXpath(path) {
|
||||
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
||||
}
|
||||
@@ -11,10 +13,22 @@ function removeElementByXpath(path) {
|
||||
}
|
||||
}
|
||||
|
||||
const ele_list = ['//*/div[@class="y-guide"]', '//*/div[@class="auxo-modal-root"]', '//*/div[contains(@class, "index_DragControlle")]']
|
||||
const host_xpath_mapping = {
|
||||
'^https://.*\\.jinritemai\\.com/.*$':
|
||||
['//*/div[@class="y-guide"]', '//*/div[@class="auxo-modal-root"]', '//*/div[contains(@class, "index_DragControlle")]']
|
||||
}
|
||||
|
||||
var xpaths = [];
|
||||
|
||||
for (let pattern in host_xpath_mapping) {
|
||||
// console.log(pattern);
|
||||
if (new RegExp(pattern).test(currentUrl)) {
|
||||
xpaths = host_xpath_mapping[pattern];
|
||||
}
|
||||
}
|
||||
|
||||
setInterval(function () {
|
||||
for (let ele of ele_list) {
|
||||
removeElementByXpath(ele);
|
||||
for (let xpath of xpaths) {
|
||||
removeElementByXpath(xpath);
|
||||
}
|
||||
}, 500); // 300 毫秒
|
||||
}, 300);
|
||||
Reference in new issue
Block a user