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")]'], // 巨量千川 '^https://.*\\.qianchuan.jinritemai\\.com/.*$': ['//*/div[@class="ovui-popup__mask"]', '//*/div[@class="ovui-modal__wrap"]'], // 京东商智 '^https://.*\\.jd.com/.*$': ['*/div[contains(@class, "refund-wrapper")]', '*/nav[@class="back-to-top"]'] // 淘宝 // 拼多多 } 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);