From 460c71ef0ed57673753c187e5e6c77427e8f3c75 Mon Sep 17 00:00:00 2001 From: PhilReact Date: Mon, 4 Nov 2024 13:01:40 +0200 Subject: [PATCH] fix issue blocking --- public/content-script.js | 6 +++--- public/disable-gateway-message.js | 26 -------------------------- public/disable-gateway-popup.js | 28 ---------------------------- public/document_end.js | 7 ------- public/document_start.js | 6 ------ 5 files changed, 3 insertions(+), 70 deletions(-) delete mode 100644 public/disable-gateway-message.js delete mode 100644 public/disable-gateway-popup.js delete mode 100644 public/document_end.js delete mode 100644 public/document_start.js diff --git a/public/content-script.js b/public/content-script.js index 51fecbf..7cb53f7 100644 --- a/public/content-script.js +++ b/public/content-script.js @@ -802,14 +802,14 @@ if (!window.hasAddedQortalListener) { window.hasAddedQortalListener = true; //qortalRequests const listener = async (event) => { - event.preventDefault(); // Prevent default behavior - event.stopImmediatePropagation(); // Stop other listeners from firing + // Verify that the message is from the web page and contains expected data if (event.source !== window || !event.data || !event.data.action) return; if (event?.data?.requestedHandler !== 'UI') return; - + event.preventDefault(); // Prevent default behavior + event.stopImmediatePropagation(); // Stop other listeners from firing await new Promise((res)=> { chrome?.runtime?.sendMessage( { diff --git a/public/disable-gateway-message.js b/public/disable-gateway-message.js deleted file mode 100644 index 361bc67..0000000 --- a/public/disable-gateway-message.js +++ /dev/null @@ -1,26 +0,0 @@ -// (function() { -// // Immediately disable qdnGatewayShowModal if it exists - - -// // Now, let's wrap the handleResponse function with the new condition -// const originalHandleResponse = window.handleResponse; // Save the original handleResponse function - -// if (typeof originalHandleResponse === 'function') { -// // Create the wrapper function to enhance the original handleResponse -// window.handleResponse = function(event, response) { -// // Check if the response contains the specific error message -// if (response && typeof response === 'string' && response.includes("Interactive features were requested")) { -// console.log('Response contains "Interactive features were requested", skipping processing.'); -// return; // Skip further processing -// } - -// // Call the original handleResponse for normal processing -// originalHandleResponse(event, response); -// }; - -// console.log('handleResponse has been enhanced to skip specific error handling.'); -// } else { -// console.log('No handleResponse function found to enhance.'); -// } - -// })(); diff --git a/public/disable-gateway-popup.js b/public/disable-gateway-popup.js deleted file mode 100644 index 1e81ed0..0000000 --- a/public/disable-gateway-popup.js +++ /dev/null @@ -1,28 +0,0 @@ - -// (function() { -// console.log('External script loaded to disable qdnGatewayShowModal'); - -// const timeoutDuration = 5000; // Set timeout duration to 5 seconds (5000ms) -// let elapsedTime = 0; // Track the time that has passed - -// // Poll for qdnGatewayShowModal and disable it once it's defined -// const checkQdnGatewayInterval = setInterval(() => { -// elapsedTime += 100; // Increment elapsed time by the polling interval (100ms) - -// if (typeof window.qdnGatewayShowModal === 'function') { -// console.log('Disabling qdnGatewayShowModal'); - -// // Disable qdnGatewayShowModal function -// window.qdnGatewayShowModal = function(message) { -// console.log('qdnGatewayShowModal function has been disabled.'); -// }; - -// // Stop checking once qdnGatewayShowModal has been disabled -// clearInterval(checkQdnGatewayInterval); -// } else if (elapsedTime >= timeoutDuration) { -// console.log('Timeout reached, stopping polling for qdnGatewayShowModal.'); -// clearInterval(checkQdnGatewayInterval); // Stop checking after 5 seconds -// } -// }, 100); // Check every 100ms - -// })(); diff --git a/public/document_end.js b/public/document_end.js deleted file mode 100644 index 748d513..0000000 --- a/public/document_end.js +++ /dev/null @@ -1,7 +0,0 @@ - -const script2 = document.createElement('script'); -script2.src = chrome.runtime.getURL('disable-gateway-message.js'); // Reference the external script -document.documentElement.appendChild(script2); // Inject it into the page -script2.onload = function() { - script2.remove(); // Clean up after the script has been injected and run -}; \ No newline at end of file diff --git a/public/document_start.js b/public/document_start.js deleted file mode 100644 index b105ed5..0000000 --- a/public/document_start.js +++ /dev/null @@ -1,6 +0,0 @@ -const script = document.createElement('script'); -script.src = chrome.runtime.getURL('disable-gateway-popup.js'); // Reference the external script -document.documentElement.appendChild(script); // Inject it into the page -script.onload = function() { - script.remove(); // Clean up after the script has been injected and run -}; \ No newline at end of file