diff --git a/-H b/-H deleted file mode 100644 index 9d20070..0000000 --- a/-H +++ /dev/null @@ -1,6 +0,0 @@ -HTTP/1.1 411 Length Required -Content-Type: text/html; charset=us-ascii -Date: Fri, 03 Nov 2023 16:19:55 GMT -Connection: close -Content-Length: 344 - diff --git a/-s b/-s deleted file mode 100644 index c8f11ce..0000000 --- a/-s +++ /dev/null @@ -1,9 +0,0 @@ -HTTP/1.1 100 Continue - -HTTP/1.1 202 Accepted -Content-Length: 0 -Location: 9a95fdfe-adfe-4e98-be34-70d029205fea -Strict-Transport-Security: max-age=31536000; includeSubDomains -Request-Context: appId=cid-v1:23f44029-850d-47f4-8c9f-200d01ff4866 -Date: Fri, 03 Nov 2023 16:20:15 GMT - diff --git a/crx.zip b/crx.zip deleted file mode 100644 index b74b7cf..0000000 Binary files a/crx.zip and /dev/null differ diff --git a/crx/adblock-cs.js b/crx/adblock-cs.js new file mode 100644 index 0000000..1e05ee3 --- /dev/null +++ b/crx/adblock-cs.js @@ -0,0 +1,20 @@ +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 ele_list = ['//*/div[@class="y-guide"]', '//*/div[@class="auxo-modal-root"]', '//*/div[contains(@class, "index_DragControlle")]'] + +setInterval(function () { + for (let ele of ele_list) { + removeElementByXpath(ele); + } +}, 500); // 300 毫秒 diff --git a/crx/index.js b/crx/index.js index 1421457..00e064d 100644 --- a/crx/index.js +++ b/crx/index.js @@ -1,86 +1,86 @@ -const DYNAMIC_SCRIPT_ID = 'add-record-script'; +// const DYNAMIC_SCRIPT_ID = 'add-record-script'; -async function isDynamicContentScriptRegistered() { - const scripts = await chrome.scripting.getRegisteredContentScripts(); - return scripts.some((s) => s.id === DYNAMIC_SCRIPT_ID); -} +// async function isDynamicContentScriptRegistered() { +// const scripts = await chrome.scripting.getRegisteredContentScripts(); +// return scripts.some((s) => s.id === DYNAMIC_SCRIPT_ID); +// } -async function getActiveTab() { - const [tab] = await chrome.tabs.query({ active: true, lastFocusedWindow: true }); - return tab; -} +// async function getActiveTab() { +// const [tab] = await chrome.tabs.query({ active: true, lastFocusedWindow: true }); +// return tab; +// } -document.querySelector('#addRecord').addEventListener('click', async () => { +// document.querySelector('#addRecord').addEventListener('click', async () => { - console.log('[Demo] =============================================='); - console.log('[Demo] Test send message from popup script to content script'); - const tab = await getActiveTab(); - const ret = await chrome.tabs.sendMessage(tab.id, { msg: 'ping from popup script', func: 'addRecord' }); - console.log('[Demo] receive', ret); +// console.log('[Demo] =============================================='); +// console.log('[Demo] Test send message from popup script to content script'); +// const tab = await getActiveTab(); +// const ret = await chrome.tabs.sendMessage(tab.id, { msg: 'ping from popup script', func: 'addRecord' }); +// console.log('[Demo] receive', ret); -}); +// }); -document.querySelector('#deleteRecord').addEventListener('click', async () => { +// document.querySelector('#deleteRecord').addEventListener('click', async () => { - console.log('[Demo] =============================================='); - console.log('[Demo] Test send message from popup script to content script'); - const tab = await getActiveTab(); - const ret = await chrome.tabs.sendMessage(tab.id, { msg: 'ping from popup script', func: 'deleteRecord' }); - console.log('[Demo] receive', ret); +// console.log('[Demo] =============================================='); +// console.log('[Demo] Test send message from popup script to content script'); +// const tab = await getActiveTab(); +// const ret = await chrome.tabs.sendMessage(tab.id, { msg: 'ping from popup script', func: 'deleteRecord' }); +// console.log('[Demo] receive', ret); -}); +// }); -var port = null; +// var port = null; -function appendMessage(text) { - document.getElementById('response').innerHTML += "
" + text + "
"; -} +// function appendMessage(text) { +// document.getElementById('response').innerHTML += "" + text + "
"; +// } -function updateUiState() { - if (port) { - document.getElementById('connect-button').style.display = 'none'; - document.getElementById('input-text').style.display = 'block'; - document.getElementById('send-message-button').style.display = 'block'; - } else { - document.getElementById('connect-button').style.display = 'block'; - document.getElementById('input-text').style.display = 'none'; - document.getElementById('send-message-button').style.display = 'none'; - } -} +// function updateUiState() { +// if (port) { +// document.getElementById('connect-button').style.display = 'none'; +// document.getElementById('input-text').style.display = 'block'; +// document.getElementById('send-message-button').style.display = 'block'; +// } else { +// document.getElementById('connect-button').style.display = 'block'; +// document.getElementById('input-text').style.display = 'none'; +// document.getElementById('send-message-button').style.display = 'none'; +// } +// } -function sendNativeMessage() { - message = { "text": document.getElementById('input-text').value }; - port.postMessage(message); - appendMessage("Sent message: " + JSON.stringify(message) + ""); -} +// function sendNativeMessage() { +// message = { "text": document.getElementById('input-text').value }; +// port.postMessage(message); +// appendMessage("Sent message: " + JSON.stringify(message) + ""); +// } -function onNativeMessage(message) { - appendMessage("Received message: " + JSON.stringify(message) + ""); -} +// function onNativeMessage(message) { +// appendMessage("Received message: " + JSON.stringify(message) + ""); +// } -function onDisconnected() { - appendMessage("Failed to connect: " + chrome.runtime.lastError.message); - port = null; - updateUiState(); -} +// function onDisconnected() { +// appendMessage("Failed to connect: " + chrome.runtime.lastError.message); +// port = null; +// updateUiState(); +// } -function connect() { - var hostName = "com.google.chrome.botext"; - appendMessage("Connecting to native messaging host " + hostName + "") - port = chrome.runtime.connectNative(hostName); - port.onMessage.addListener(onNativeMessage); - port.onDisconnect.addListener(onDisconnected); - updateUiState(); -} +// function connect() { +// var hostName = "com.google.chrome.botext"; +// appendMessage("Connecting to native messaging host " + hostName + "") +// port = chrome.runtime.connectNative(hostName); +// port.onMessage.addListener(onNativeMessage); +// port.onDisconnect.addListener(onDisconnected); +// updateUiState(); +// } -document.addEventListener('DOMContentLoaded', function () { - document.getElementById('connect-button').addEventListener( - 'click', connect); - document.getElementById('send-message-button').addEventListener( - 'click', sendNativeMessage); - updateUiState(); -}); +// document.addEventListener('DOMContentLoaded', function () { +// document.getElementById('connect-button').addEventListener( +// 'click', connect); +// document.getElementById('send-message-button').addEventListener( +// 'click', sendNativeMessage); +// updateUiState(); +// }); diff --git a/crx/manifest.json b/crx/manifest.json index be12106..ae2993e 100644 --- a/crx/manifest.json +++ b/crx/manifest.json @@ -24,6 +24,15 @@ ], "run_at": "document_end", "world": "MAIN" + }, + { + "matches": [ + "https://*.jinritemai.com/*" + ], + "js": [ + "adblock-cs.js" + ], + "run_at": "document_end" } ], "permissions": [ diff --git a/crx/sw.js b/crx/sw.js index 0dd5f81..6c9526b 100644 --- a/crx/sw.js +++ b/crx/sw.js @@ -23,30 +23,30 @@ // } // }); -let port; +// let port; -function sendMessage(message) { - if (!port) { - // this will run the first time to launch the native host, and save the connection to that instance in the port - port = chrome.runtime.connectNative('com.woni.chrome.botext'); - } - // Convert the message to a Uint8Array. - var encoder = new TextEncoder(); - var messageBytes = encoder.encode(message); - // Send the message length as a 32-bit integer. - var buffer = new ArrayBuffer(4); - var view = new DataView(buffer); - view.setUint32(0, messageBytes.length, true); - port.postMessage(buffer); +// function sendMessage(message) { +// if (!port) { +// // this will run the first time to launch the native host, and save the connection to that instance in the port +// port = chrome.runtime.connectNative('com.woni.chrome.botext'); +// } +// // Convert the message to a Uint8Array. +// var encoder = new TextEncoder(); +// var messageBytes = encoder.encode(message); +// // Send the message length as a 32-bit integer. +// var buffer = new ArrayBuffer(4); +// var view = new DataView(buffer); +// view.setUint32(0, messageBytes.length, true); +// port.postMessage(buffer); - // Send the message content. - port.postMessage(messageBytes); -} +// // Send the message content. +// port.postMessage(messageBytes); +// } -sendMessage('message 1'); -sendMessage('message 2'); -sendMessage('message 3'); +// sendMessage('message 1'); +// sendMessage('message 2'); +// sendMessage('message 3'); diff --git a/publish-addon.sh b/publish-addon.sh index 7dc680c..6074670 100644 --- a/publish-addon.sh +++ b/publish-addon.sh @@ -67,7 +67,7 @@ check_publish_response=$(curl -s \ -H "Authorization: Bearer $token" \ https://api.addons.microsoftedge.microsoft.com/v1/products/$product_id/submissions/operations/{$operation_id}) -# echo $check_publish_response +# echo $check_publish_response # 使用 jq 提取 errorCode errorCode=$(echo $check_publish_response | jq -r '.errorCode') @@ -75,6 +75,7 @@ errorCode=$(echo $check_publish_response | jq -r '.errorCode') # 检查 errorCode 是否为 null if [ "$errorCode" = "null" ]; then echo "Submit successful." + rm $file_name else echo "Operation failed. Error code: $errorCode" errors=$(echo $check_publish_response | jq -r '.message')