From 67d6f6a3dd15cd28ffa754e4ad7f167a97e97fd0 Mon Sep 17 00:00:00 2001 From: Amm0ni4 Date: Thu, 5 Dec 2024 19:12:56 +0100 Subject: [PATCH] profitsfly improvement thanks to Anon991299 https://codeberg.org/Amm0ni4/bypass-all-shortlinks-debloated/issues/191 --- Bypass_All_Shortlinks.meta.js | 2 +- Bypass_All_Shortlinks.user.js | 53 ++++++++++--------- .../profitsfly_reload_helper.user.js | 51 ++++++++++-------- 3 files changed, 58 insertions(+), 48 deletions(-) diff --git a/Bypass_All_Shortlinks.meta.js b/Bypass_All_Shortlinks.meta.js index 0c6c103..169ecd2 100644 --- a/Bypass_All_Shortlinks.meta.js +++ b/Bypass_All_Shortlinks.meta.js @@ -4,7 +4,7 @@ // @run-at document-start // @author Amm0ni4 // @noframes -// @version 93.2.6 +// @version 93.2.7 // @grant GM_setValue // @grant GM_getValue // @grant GM_addStyle diff --git a/Bypass_All_Shortlinks.user.js b/Bypass_All_Shortlinks.user.js index c169606..98bd318 100644 --- a/Bypass_All_Shortlinks.user.js +++ b/Bypass_All_Shortlinks.user.js @@ -4,7 +4,7 @@ // @run-at document-start // @author Amm0ni4 // @noframes -// @version 93.2.6 +// @version 93.2.7 // @grant GM_setValue // @grant GM_getValue // @grant GM_addStyle @@ -2997,35 +2997,40 @@ const domainRegex = /^https:\/\/.*\.(tradeshowrating.com|historyofyesterday.com|playonpc.online|quins.us)\/.*/; if (domainRegex.test(window.location.href)) { - // Back up the current ref url if (window.location.href.includes("/ref.php")) { + // Back up the current ref url GM_setValue("profitsflyLocation", window.location.href); + } else if (document.readyState === "complete") { + onWindowLoad(); + } else { + window.addEventListener('load', onWindowLoad); } - window.addEventListener('load', function() { - // Check if the current URL is just the domain - const url = new URL(window.location.href); - const path = url.pathname; - if (path === "/" || path === "") { - if (document.body.textContent.includes("You have 2 active sessions.")) { - // Click the continue button if a backed up url was loaded in the last 5 seconds - if ((Date.now() - GM_getValue("profitsflyGoBackTime", 0)) < 5000) { - for (const button of document.querySelectorAll("button")) { - if (button.textContent.trim() === "Continue") { - button.click(); - break; - } + function onWindowLoad() { + // Click the continue button if a backed up url was loaded in the last 5 seconds + if (document.body.textContent.includes("You have 2 active sessions.")) { + if ((Date.now() - GM_getValue("profitsflyGoBackTime", 0)) < 5000) { + for (const button of document.querySelectorAll("button")) { + if (button.textContent.trim() === "Continue") { + button.click(); + break; } } - } else { - // Load the backed up url - const lastLocation = GM_getValue("profitsflyLocation"); - if (lastLocation) { - GM_setValue("profitsflyGoBackTime", Date.now()); - GM_setValue("profitsflyOverrideLocation", lastLocation); - window.location.href = lastLocation; - } } + return; + } + + // Load the backed up url + if (GM_getValue("profitsflyLocation") + && !document.body.textContent.includes("Less than 18 seconds have passed between actions. Robot verification failed, please try again...") + && !document.body.textContent.includes("Please wait...")) { + const lastLocation = GM_getValue("profitsflyLocation"); + if (lastLocation) { + GM_setValue("profitsflyGoBackTime", Date.now()); + GM_setValue("profitsflyOverrideLocation", lastLocation); + window.location.href = lastLocation; + } + return; } // Function to check for messages like "Click any ad & keep it open for 15 seconds to continue" and reload the page if one exists @@ -3062,7 +3067,7 @@ } setInterval(checkForMessage, 1000); - }); + } } })(); //------- diff --git a/extra_bypasses/profitsfly_reload_helper.user.js b/extra_bypasses/profitsfly_reload_helper.user.js index d10fcc5..49c915f 100644 --- a/extra_bypasses/profitsfly_reload_helper.user.js +++ b/extra_bypasses/profitsfly_reload_helper.user.js @@ -10,35 +10,40 @@ const domainRegex = /^https:\/\/.*\.(tradeshowrating.com|historyofyesterday.com|playonpc.online|quins.us)\/.*/; if (domainRegex.test(window.location.href)) { - // Back up the current ref url if (window.location.href.includes("/ref.php")) { + // Back up the current ref url GM_setValue("profitsflyLocation", window.location.href); + } else if (document.readyState === "complete") { + onWindowLoad(); + } else { + window.addEventListener('load', onWindowLoad); } - window.addEventListener('load', function() { - // Check if the current URL is just the domain - const url = new URL(window.location.href); - const path = url.pathname; - if (path === "/" || path === "") { - if (document.body.textContent.includes("You have 2 active sessions.")) { - // Click the continue button if a backed up url was loaded in the last 5 seconds - if ((Date.now() - GM_getValue("profitsflyGoBackTime", 0)) < 5000) { - for (const button of document.querySelectorAll("button")) { - if (button.textContent.trim() === "Continue") { - button.click(); - break; - } + function onWindowLoad() { + // Click the continue button if a backed up url was loaded in the last 5 seconds + if (document.body.textContent.includes("You have 2 active sessions.")) { + if ((Date.now() - GM_getValue("profitsflyGoBackTime", 0)) < 5000) { + for (const button of document.querySelectorAll("button")) { + if (button.textContent.trim() === "Continue") { + button.click(); + break; } } - } else { - // Load the backed up url - const lastLocation = GM_getValue("profitsflyLocation"); - if (lastLocation) { - GM_setValue("profitsflyGoBackTime", Date.now()); - GM_setValue("profitsflyOverrideLocation", lastLocation); - window.location.href = lastLocation; - } } + return; + } + + // Load the backed up url + if (GM_getValue("profitsflyLocation") + && !document.body.textContent.includes("Less than 18 seconds have passed between actions. Robot verification failed, please try again...") + && !document.body.textContent.includes("Please wait...")) { + const lastLocation = GM_getValue("profitsflyLocation"); + if (lastLocation) { + GM_setValue("profitsflyGoBackTime", Date.now()); + GM_setValue("profitsflyOverrideLocation", lastLocation); + window.location.href = lastLocation; + } + return; } // Function to check for messages like "Click any ad & keep it open for 15 seconds to continue" and reload the page if one exists @@ -75,7 +80,7 @@ } setInterval(checkForMessage, 1000); - }); + } } })(); //-------