From 51087c75d181ae1af3c53cf0aa8ea7123e30565e Mon Sep 17 00:00:00 2001 From: Amm0ni4 Date: Sat, 14 Dec 2024 00:13:19 +0100 Subject: [PATCH] Fix profitsfly timer skipping (by Anon991299) https://codeberg.org/Amm0ni4/bypass-all-shortlinks-debloated/issues/191 --- Bypass_All_Shortlinks.meta.js | 2 +- Bypass_All_Shortlinks.user.js | 76 +++++++++++++++---- extra_bypasses/extra_bypasses.user.js | 13 ---- .../profitsfly_reload_helper.user.js | 61 ++++++++++++++- 4 files changed, 122 insertions(+), 30 deletions(-) diff --git a/Bypass_All_Shortlinks.meta.js b/Bypass_All_Shortlinks.meta.js index d806eda..34c614f 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.11 +// @version 93.2.12 // @grant GM_setValue // @grant GM_getValue // @grant GM_addStyle diff --git a/Bypass_All_Shortlinks.user.js b/Bypass_All_Shortlinks.user.js index a6cf9fc..a9de94d 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.11 +// @version 93.2.12 // @grant GM_setValue // @grant GM_getValue // @grant GM_addStyle @@ -2673,19 +2673,6 @@ /^https:\/\/[^\/]+\/safe\.php\?link=https:\/\/modijiurl\.com\/[^\/]+\/\?mid=.*$/.test(url) && browserIsFirefox() ? redirect(url.split('?link=')[1]) : null; /^https:\/\/modijiurl\.com\/[^\/]+\/\?mid=.*$/.test(url) ? redirectIfNotDisabled('#getLinkButton') : null; - // profitsfly partly skip timer -// /^https:\/\/.*\.(tradeshowrating.com|historyofyesterday.com|playonpc.online|quins.us)\/.*/.test(url) ? (() => { -// afterDOMLoaded(function() { -// function setTimer() { -// if (window.wT9882 > 5) { -// window.wT9882 = 1; -// } -// } -// window.wT9882 = 5; -// setInterval(setTimer, 1000); -// }); -// })() : null; - // sittingonclouds.com .net /paster.gg/.test(url) ? redirect(decodeURIComponent(url.split('&link=')[1].split('&')[0])) : null; @@ -3004,6 +2991,8 @@ const domainRegex = /^https:\/\/.*\.(tradeshowrating.com|historyofyesterday.com|playonpc.online|quins.us)\/.*/; if (domainRegex.test(window.location.href)) { + + // ---RELOAD DEAD-END PAGES--- if (window.location.href.includes("/ref.php")) { // Back up the current ref url GM_setValue("profitsflyLocation", window.location.href); @@ -3075,11 +3064,68 @@ setInterval(checkForMessage, 1000); } + + + // ---SKIP TIMERS--- + document.addEventListener('DOMContentLoaded', function() { + function setTimer() { + if (window.wT9882 > 3) { + window.wT9882 = 1; + } + } + window.wT9882 = 3; + setInterval(setTimer, 1000); + + /* ------------ Protect buttons from being removed ------------ */ + // Protect all buttons currently in the DOM + function protectButtons() { + const buttons = document.querySelectorAll("button"); + buttons.forEach((button) => protectElement(button)); + } + + // Protect a specific button by overriding its removal methods + function protectElement(element) { + if (element.__protected) return; // Avoid double protection + + // Override remove() + const originalRemove = element.remove; + element.remove = () => {}; + + // Flag element as protected + element.__protected = true; + } + + // Monitor the DOM for dynamically added buttons + const observer = new MutationObserver((mutationsList) => { + mutationsList.forEach((mutation) => { + mutation.addedNodes.forEach((node) => { + if (node.tagName === "BUTTON") { + // Protect new button + protectElement(node); + } + }); + + mutation.removedNodes.forEach((node) => { + if (node.tagName === "BUTTON") { + // A button was removed. Re-add it: + mutation.target.appendChild(node); // Re-add the button + protectElement(node); // Re-protect it + } + }); + }); + }); + + // Start observing the document for changes + observer.observe(document.body, { childList: true, subtree: true }); + + // Protect buttons already in the DOM + protectButtons(); + }); + } })(); //------- - // ----- Bypass Rinku ------ // source: https://codeberg.org/Amm0ni4/bypass-all-shortlinks-debloated/issues/165 // example: https://rinku.me/0XLi6 diff --git a/extra_bypasses/extra_bypasses.user.js b/extra_bypasses/extra_bypasses.user.js index 85690b3..60b2dd4 100644 --- a/extra_bypasses/extra_bypasses.user.js +++ b/extra_bypasses/extra_bypasses.user.js @@ -1147,19 +1147,6 @@ /^https:\/\/[^\/]+\/safe\.php\?link=https:\/\/modijiurl\.com\/[^\/]+\/\?mid=.*$/.test(url) && browserIsFirefox() ? redirect(url.split('?link=')[1]) : null; /^https:\/\/modijiurl\.com\/[^\/]+\/\?mid=.*$/.test(url) ? redirectIfNotDisabled('#getLinkButton') : null; - // profitsfly partly skip timer -// /^https:\/\/.*\.(tradeshowrating.com|historyofyesterday.com|playonpc.online|quins.us)\/.*/.test(url) ? (() => { -// afterDOMLoaded(function() { -// function setTimer() { -// if (window.wT9882 > 5) { -// window.wT9882 = 1; -// } -// } -// window.wT9882 = 5; -// setInterval(setTimer, 1000); -// }); -// })() : null; - // sittingonclouds.com .net /paster.gg/.test(url) ? redirect(decodeURIComponent(url.split('&link=')[1].split('&')[0])) : null; diff --git a/extra_bypasses/profitsfly_reload_helper.user.js b/extra_bypasses/profitsfly_reload_helper.user.js index 49c915f..ed7bd1b 100644 --- a/extra_bypasses/profitsfly_reload_helper.user.js +++ b/extra_bypasses/profitsfly_reload_helper.user.js @@ -10,6 +10,8 @@ const domainRegex = /^https:\/\/.*\.(tradeshowrating.com|historyofyesterday.com|playonpc.online|quins.us)\/.*/; if (domainRegex.test(window.location.href)) { + + // ---RELOAD DEAD-END PAGES--- if (window.location.href.includes("/ref.php")) { // Back up the current ref url GM_setValue("profitsflyLocation", window.location.href); @@ -81,7 +83,64 @@ setInterval(checkForMessage, 1000); } + + + // ---SKIP TIMERS--- + document.addEventListener('DOMContentLoaded', function() { + function setTimer() { + if (window.wT9882 > 3) { + window.wT9882 = 1; + } + } + window.wT9882 = 3; + setInterval(setTimer, 1000); + + /* ------------ Protect buttons from being removed ------------ */ + // Protect all buttons currently in the DOM + function protectButtons() { + const buttons = document.querySelectorAll("button"); + buttons.forEach((button) => protectElement(button)); + } + + // Protect a specific button by overriding its removal methods + function protectElement(element) { + if (element.__protected) return; // Avoid double protection + + // Override remove() + const originalRemove = element.remove; + element.remove = () => {}; + + // Flag element as protected + element.__protected = true; + } + + // Monitor the DOM for dynamically added buttons + const observer = new MutationObserver((mutationsList) => { + mutationsList.forEach((mutation) => { + mutation.addedNodes.forEach((node) => { + if (node.tagName === "BUTTON") { + // Protect new button + protectElement(node); + } + }); + + mutation.removedNodes.forEach((node) => { + if (node.tagName === "BUTTON") { + // A button was removed. Re-add it: + mutation.target.appendChild(node); // Re-add the button + protectElement(node); // Re-protect it + } + }); + }); + }); + + // Start observing the document for changes + observer.observe(document.body, { childList: true, subtree: true }); + + // Protect buttons already in the DOM + protectButtons(); + }); + } })(); //------- -