profitsfly improvement thanks to Anon991299

https://codeberg.org/Amm0ni4/bypass-all-shortlinks-debloated/issues/191
This commit is contained in:
Amm0ni4 2024-12-05 19:12:56 +01:00
parent 6caaceb42c
commit 67d6f6a3dd
3 changed files with 58 additions and 48 deletions

View file

@ -4,7 +4,7 @@
// @run-at document-start // @run-at document-start
// @author Amm0ni4 // @author Amm0ni4
// @noframes // @noframes
// @version 93.2.6 // @version 93.2.7
// @grant GM_setValue // @grant GM_setValue
// @grant GM_getValue // @grant GM_getValue
// @grant GM_addStyle // @grant GM_addStyle

View file

@ -4,7 +4,7 @@
// @run-at document-start // @run-at document-start
// @author Amm0ni4 // @author Amm0ni4
// @noframes // @noframes
// @version 93.2.6 // @version 93.2.7
// @grant GM_setValue // @grant GM_setValue
// @grant GM_getValue // @grant GM_getValue
// @grant GM_addStyle // @grant GM_addStyle
@ -2997,18 +2997,18 @@
const domainRegex = /^https:\/\/.*\.(tradeshowrating.com|historyofyesterday.com|playonpc.online|quins.us)\/.*/; const domainRegex = /^https:\/\/.*\.(tradeshowrating.com|historyofyesterday.com|playonpc.online|quins.us)\/.*/;
if (domainRegex.test(window.location.href)) { if (domainRegex.test(window.location.href)) {
// Back up the current ref url
if (window.location.href.includes("/ref.php")) { if (window.location.href.includes("/ref.php")) {
// Back up the current ref url
GM_setValue("profitsflyLocation", window.location.href); GM_setValue("profitsflyLocation", window.location.href);
} else if (document.readyState === "complete") {
onWindowLoad();
} else {
window.addEventListener('load', onWindowLoad);
} }
window.addEventListener('load', function() { function onWindowLoad() {
// 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 // 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) { if ((Date.now() - GM_getValue("profitsflyGoBackTime", 0)) < 5000) {
for (const button of document.querySelectorAll("button")) { for (const button of document.querySelectorAll("button")) {
if (button.textContent.trim() === "Continue") { if (button.textContent.trim() === "Continue") {
@ -3017,15 +3017,20 @@
} }
} }
} }
} else { return;
}
// Load the backed up url // 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"); const lastLocation = GM_getValue("profitsflyLocation");
if (lastLocation) { if (lastLocation) {
GM_setValue("profitsflyGoBackTime", Date.now()); GM_setValue("profitsflyGoBackTime", Date.now());
GM_setValue("profitsflyOverrideLocation", lastLocation); GM_setValue("profitsflyOverrideLocation", lastLocation);
window.location.href = 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 // 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); setInterval(checkForMessage, 1000);
}); }
} }
})(); })();
//------- //-------

View file

@ -10,18 +10,18 @@
const domainRegex = /^https:\/\/.*\.(tradeshowrating.com|historyofyesterday.com|playonpc.online|quins.us)\/.*/; const domainRegex = /^https:\/\/.*\.(tradeshowrating.com|historyofyesterday.com|playonpc.online|quins.us)\/.*/;
if (domainRegex.test(window.location.href)) { if (domainRegex.test(window.location.href)) {
// Back up the current ref url
if (window.location.href.includes("/ref.php")) { if (window.location.href.includes("/ref.php")) {
// Back up the current ref url
GM_setValue("profitsflyLocation", window.location.href); GM_setValue("profitsflyLocation", window.location.href);
} else if (document.readyState === "complete") {
onWindowLoad();
} else {
window.addEventListener('load', onWindowLoad);
} }
window.addEventListener('load', function() { function onWindowLoad() {
// 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 // 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) { if ((Date.now() - GM_getValue("profitsflyGoBackTime", 0)) < 5000) {
for (const button of document.querySelectorAll("button")) { for (const button of document.querySelectorAll("button")) {
if (button.textContent.trim() === "Continue") { if (button.textContent.trim() === "Continue") {
@ -30,15 +30,20 @@
} }
} }
} }
} else { return;
}
// Load the backed up url // 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"); const lastLocation = GM_getValue("profitsflyLocation");
if (lastLocation) { if (lastLocation) {
GM_setValue("profitsflyGoBackTime", Date.now()); GM_setValue("profitsflyGoBackTime", Date.now());
GM_setValue("profitsflyOverrideLocation", lastLocation); GM_setValue("profitsflyOverrideLocation", lastLocation);
window.location.href = 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 // 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); setInterval(checkForMessage, 1000);
}); }
} }
})(); })();
//------- //-------