35 lines
917 B
JavaScript
35 lines
917 B
JavaScript
let currentUrl = window.location.href;
|
|
|
|
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 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 xpath of xpaths) {
|
|
removeElementByXpath(xpath);
|
|
}
|
|
}, 300);
|