function matchTemuDomain(url) { const urlPattern = /https:\/\/([\da-z\.-]+)\.kuajingmaihuo\.com\// return urlPattern.test(url); } function init() { if (matchTemuDomain(window.location.href)) { let j = 0 let timer = setInterval(() => { let models = document.querySelectorAll('div[class^="MDL_header"]') let flag = false for (let i = 0; i < models.length; i++) { if (models[i].textContent.includes("商品降价提醒") || models[i].textContent.includes("降价,提升竞争力,避免限制备货")) { const popup = document.createElement("div") popup.innerText = "拒绝调价" const styles = { padding: "8px", background: "#fb7701", color: "#fff", display: 'inline', borderRadius: "8px", cursor: "pointer" } for (const e in styles) { popup.style[e] = styles[e] } models[i].appendChild(popup) popup.addEventListener('click', async () => { let tbodyObj = models[i].parentElement.querySelector('tbody') let trList = tbodyObj.querySelectorAll('tr') for (let i = 0; i < trList.length; i++) { let tdObj = trList[i].querySelector('td:last-child') let firstLabelObj = tdObj.querySelector('div label:first-child') if (firstLabelObj.getAttribute("data-checked")) { let labelObj = tdObj.querySelector('div label:nth-child(2)') let radioObj = labelObj.querySelector('div[class^="RD_radioWrapper"]') // await sleepSync(50) radioObj.click() } } }) flag = true } } const regex = /price-adjust-confirm[^\n]+content/ let modelsAll = document.querySelectorAll('div[class*="price-adjust-confirm"]') const results = Array.from(modelsAll).filter(item => regex.test(item.getAttribute('class'))) for (let i = 0; i < results.length; i++) { let tipsObj = results[i].querySelector('div[class*="_tips"]') let spanObj = tipsObj.querySelector('div span:last-child') if (spanObj) { const popup = document.createElement("div") popup.innerText = "拒绝调价" const styles = { padding: "8px", background: "#fb7701", color: "#fff", display: 'inline', borderRadius: "8px", cursor: "pointer" } for (const e in styles) { popup.style[e] = styles[e] } spanObj.appendChild(popup) popup.addEventListener('click', async () => { let tbodyObj = results[i].querySelector('tbody') let trList = tbodyObj.querySelectorAll('tr') for (let i = 0; i < trList.length; i++) { let tdObj = trList[i].querySelector('td:last-child') let firstLabelObj = tdObj.querySelector('div label:first-child') if (firstLabelObj.getAttribute("data-checked")) { let labelObj = tdObj.querySelector('div label:nth-child(2)') let radioObj = labelObj.querySelector('div[class^="RD_radioWrapper"]') // await sleepSync(50) radioObj.click() } } }) flag = true } } let models2 = document.querySelectorAll('div[class^="modal-content_platBanner"]') for (let i = 0; i < models2.length; i++) { let tipsObj = models2[i].parentElement.querySelector('div[class^="modal-content_content"]') let spanObj = tipsObj.querySelector('div span:last-child') if (spanObj) { const popup = document.createElement("div") popup.innerText = "拒绝调价" const styles = { padding: "8px", background: "#fb7701", color: "#fff", display: 'inline', borderRadius: "8px", cursor: "pointer" } for (const e in styles) { popup.style[e] = styles[e] } spanObj.appendChild(popup) popup.addEventListener('click', async () => { let tbodyObj = models2[i].parentElement.querySelector('tbody') let trList = tbodyObj.querySelectorAll('tr') for (let i = 0; i < trList.length; i++) { let tdObj = trList[i].querySelector('td:last-child') let firstLabelObj = tdObj.querySelector('div label:first-child') if (firstLabelObj && firstLabelObj.getAttribute("data-checked")) { let labelObj = tdObj.querySelector('div label:nth-child(2)') let radioObj = labelObj.querySelector('div[class^="RD_radioWrapper"]') // await sleepSync(50) radioObj.click() } } }) flag = true } } let models3 = document.querySelectorAll('div[class^="modal-content_content"]') for (let i = 0; i < models3.length; i++) { let tipsObj = models3[i].parentElement.querySelector('div[class^="modal-content_content"]') let spanObj = tipsObj.querySelector('div span:last-child') if (spanObj) { const popup = document.createElement("div") popup.innerText = "拒绝调价" const styles = { padding: "8px", background: "#fb7701", color: "#fff", display: 'inline', borderRadius: "8px", cursor: "pointer" } for (const e in styles) { popup.style[e] = styles[e] } spanObj.appendChild(popup) popup.addEventListener('click', async () => { let tbodyObj = models3[i].parentElement.querySelector('tbody') let trList = tbodyObj.querySelectorAll('tr') for (let i = 0; i < trList.length; i++) { let tdObj = trList[i].querySelector('td:last-child') let firstLabelObj = tdObj.querySelector('div label:first-child') if (firstLabelObj && firstLabelObj.getAttribute("data-checked")) { let labelObj = tdObj.querySelector('div label:nth-child(2)') let radioObj = labelObj.querySelector('div[class^="RD_radioWrapper"]') // await sleepSync(50) radioObj.click() } } }) flag = true } } /*let models3 = document.querySelectorAll('div[class^="price-adjust-confirm-new_content"]') for (let i = 0; i < models3.length; i++) { let tipsObj = models3[i].querySelector('div[class^="price-adjust-confirm-new_tips"]') let spanObj = tipsObj.querySelector('div span:last-child') if (spanObj) { const popup = document.createElement("div") popup.innerText = "拒绝调价" const styles = { padding: "8px", background: "#fb7701", color: "#fff", display: 'inline', borderRadius: "8px", cursor: "pointer" } for (const e in styles) { popup.style[e] = styles[e] } spanObj.appendChild(popup) popup.addEventListener('click', async () => { let tbodyObj = models3[i].querySelector('tbody') let trList = tbodyObj.querySelectorAll('tr') for (let i = 0; i < trList.length; i++) { let tdObj = trList[i].querySelector('td:last-child') let firstLabelObj = tdObj.querySelector('div label:first-child') if (firstLabelObj.getAttribute("data-checked")) { let labelObj = tdObj.querySelector('div label:nth-child(2)') let radioObj = labelObj.querySelector('div[class^="RD_radioWrapper"]') // await sleepSync(50) radioObj.click() } } }) flag = true } } let models4 = document.querySelectorAll('div[class^="price-adjust-confirm-system-old_contentWrp"]') for (let i = 0; i < models4.length; i++) { let tipsObj = models4[i].querySelector('div[class^="price-adjust-confirm-system-old_tips"]') let spanObj = tipsObj.querySelector('div span:last-child') if (spanObj) { const popup = document.createElement("div") popup.innerText = "拒绝调价" const styles = { padding: "8px", background: "#fb7701", color: "#fff", display: 'inline', borderRadius: "8px", cursor: "pointer" } for (const e in styles) { popup.style[e] = styles[e] } spanObj.appendChild(popup) popup.addEventListener('click', async () => { let tbodyObj = models4[i].querySelector('tbody') let trList = tbodyObj.querySelectorAll('tr') for (let i = 0; i < trList.length; i++) { let tdObj = trList[i].querySelector('td:last-child') let firstLabelObj = tdObj.querySelector('div label:first-child') if (firstLabelObj.getAttribute("data-checked")) { let labelObj = tdObj.querySelector('div label:nth-child(2)') let radioObj = labelObj.querySelector('div[class^="RD_radioWrapper"]') // await sleepSync(50) radioObj.click() } } }) flag = true } } let models5 = document.querySelectorAll('div[class^="new-price-adjust-confirm_content"]') for (let i = 0; i < models5.length; i++) { let tipsObj = models5[i].querySelector('div[class^="new-price-adjust-confirm_tips"]') let spanObj = tipsObj.querySelector('div span:last-child') if (spanObj) { const popup = document.createElement("div") popup.innerText = "拒绝调价" const styles = { padding: "8px", background: "#fb7701", color: "#fff", display: 'inline', borderRadius: "8px", cursor: "pointer" } for (const e in styles) { popup.style[e] = styles[e] } spanObj.appendChild(popup) popup.addEventListener('click', async () => { let tbodyObj = models5[i].querySelector('tbody') let trList = tbodyObj.querySelectorAll('tr') for (let i = 0; i < trList.length; i++) { let tdObj = trList[i].querySelector('td:last-child') let firstLabelObj = tdObj.querySelector('div label:first-child') if (firstLabelObj.getAttribute("data-checked")) { let labelObj = tdObj.querySelector('div label:nth-child(2)') let radioObj = labelObj.querySelector('div[class^="RD_radioWrapper"]') // await sleepSync(50) radioObj.click() } } }) flag = true } } let models6 = document.querySelectorAll('div[class^="grape-price-adjust-confirm_content"]') for (let i = 0; i < models6.length; i++) { let tipsObj = models6[i].querySelector('div[class^="grape-price-adjust-confirm_tips"]') let spanObj = tipsObj.querySelector('div span:last-child') if (spanObj) { const popup = document.createElement("div") popup.innerText = "拒绝调价" const styles = { padding: "8px", background: "#fb7701", color: "#fff", display: 'inline', borderRadius: "8px", cursor: "pointer" } for (const e in styles) { popup.style[e] = styles[e] } spanObj.appendChild(popup) popup.addEventListener('click', async () => { let tbodyObj = models6[i].querySelector('tbody') let trList = tbodyObj.querySelectorAll('tr') for (let i = 0; i < trList.length; i++) { let tdObj = trList[i].querySelector('td:last-child') let firstLabelObj = tdObj.querySelector('div label:first-child') if (firstLabelObj.getAttribute("data-checked")) { let labelObj = tdObj.querySelector('div label:nth-child(2)') let radioObj = labelObj.querySelector('div[class^="RD_radioWrapper"]') // await sleepSync(50) radioObj.click() } } }) flag = true } }*/ if (flag) { clearInterval(timer) } else { j++ if (j == 10) { clearInterval(timer) } } }, 3000) // document.body.appendChild(popup) } } /* function createElement() { const popup = document.createElement("div") popup.innerText = "拒绝调价" const styles = { position: "fixed", right: '10px', top: '60px', zIndex: 999999, padding: "8px", background: "#409EFF", color: "#fff", borderRadius: "8px", cursor: "pointer" } for (const e in styles) { popup.style[e] = styles[e] } popup.addEventListener('click', async () => { let divObj1 = document.querySelector('div[class^="price-adjust-confirm-system_contentWrp"]') if (divObj1) { let tbodyObj = divObj1.querySelector('tbody') let trList = tbodyObj.querySelectorAll('tr') for (let i = 0; i < trList.length; i++) { let tdObj = trList[i].querySelector('td:last-child') let labelObj = tdObj.querySelector('div label:last-child') let radioObj = labelObj.querySelector('div[class^="RD_radioWrapper"]') // await sleepSync(50) radioObj.click() } } let divObj2 = document.querySelector('div[class^="price-adjust-confirm_header"]') if (divObj2) { let divObj = divObj2.nextElementSibling let tbodyObj = divObj.querySelector('tbody') let trList = tbodyObj.querySelectorAll('tr') for (let i = 0; i < trList.length; i++) { let tdObj = trList[i].querySelector('td:last-child') let labelObj = tdObj.querySelector('div label:last-child') //let radioObj = labelObj.querySelector("[type='radio']") // await sleepSync(50) let radioObj = labelObj.querySelector('div[class^="RD_radioWrapper"]') radioObj.click() } } let divObj3 = document.querySelector('div[class^="price-adjust-confirm-new_banner"]') if (divObj3) { let divObj = divObj3.nextElementSibling let tbodyObj = divObj.querySelector('tbody') let trList = tbodyObj.querySelectorAll('tr') for (let i = 0; i < trList.length; i++) { let tdObj = trList[i].querySelector('td:last-child') let labelObj = tdObj.querySelector('div label:last-child') //let radioObj = labelObj.querySelector("[type='radio']") // await sleepSync(50) let radioObj = labelObj.querySelector('div[class^="RD_radioWrapper"]') radioObj.click() } } }) return popup } */ init()