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) {
|
function getElementByXpath(path) {
|
||||||
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
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 () {
|
setInterval(function () {
|
||||||
for (let ele of ele_list) {
|
for (let xpath of xpaths) {
|
||||||
removeElementByXpath(ele);
|
removeElementByXpath(xpath);
|
||||||
}
|
}
|
||||||
}, 500); // 300 毫秒
|
}, 300);
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "BotExt",
|
"name": "BotExt",
|
||||||
"version": "0.1.9",
|
"version": "0.1.10",
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"background": {
|
"background": {
|
||||||
"service_worker": "sw.js"
|
"service_worker": "sw.js"
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"matches": [
|
"matches": [
|
||||||
"<all_urls>"
|
"https://www.kdocs.cn/*"
|
||||||
],
|
],
|
||||||
"js": [
|
"js": [
|
||||||
"wps.js"
|
"wps.js"
|
||||||
|
|||||||
Reference in new issue
Block a user