improve profitsfly reload

https://codeberg.org/Amm0ni4/bypass-all-shortlinks-debloated/issues/191
This commit is contained in:
Amm0ni4 2024-11-23 10:17:56 +01:00
parent 0356f69da8
commit d318178ec8
3 changed files with 10 additions and 4 deletions

View file

@ -4,7 +4,7 @@
// @run-at document-start // @run-at document-start
// @author Amm0ni4 // @author Amm0ni4
// @noframes // @noframes
// @version 93.1.9 // @version 93.1.10
// @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.1.9 // @version 93.1.10
// @grant GM_setValue // @grant GM_setValue
// @grant GM_getValue // @grant GM_getValue
// @grant GM_addStyle // @grant GM_addStyle
@ -2991,12 +2991,15 @@
const domainRegex = /^https:\/\/.*\.(tradeshowrating\.com|historyofyesterday\.com)\/.*/; const domainRegex = /^https:\/\/.*\.(tradeshowrating\.com|historyofyesterday\.com)\/.*/;
if (domainRegex.test(window.location.href)) { if (domainRegex.test(window.location.href)) {
window.addEventListener('load', function() { window.addEventListener('load', function() {
let reloading = false;
// Functions to check for messages like "Click any ad & keep it open for 15 seconds to continue" and reload the page if one exists // Functions to check for messages like "Click any ad & keep it open for 15 seconds to continue" and reload the page if one exists
function checkForMessage() { function checkForMessage() {
const paragraphs = document.getElementsByTagName("p"); const paragraphs = document.getElementsByTagName("p");
for (let p of paragraphs) { for (let p of paragraphs) {
if (/.*click.+ad.*to.+continue.*/is.test(p.textContent) && isElementVisibleAndEnabled(p)) { if (/.*click.+ad.*to.+continue.*/is.test(p.textContent) && isElementVisibleAndEnabled(p)) {
location.reload(); // Reload the page if (!reloading) location.reload(); // Reload the page
reloading = true;
return; // Exit the function after reloading return; // Exit the function after reloading
} }
} }

View file

@ -11,12 +11,15 @@
const domainRegex = /^https:\/\/.*\.(tradeshowrating\.com|historyofyesterday\.com)\/.*/; const domainRegex = /^https:\/\/.*\.(tradeshowrating\.com|historyofyesterday\.com)\/.*/;
if (domainRegex.test(window.location.href)) { if (domainRegex.test(window.location.href)) {
window.addEventListener('load', function() { window.addEventListener('load', function() {
let reloading = false;
// Functions to check for messages like "Click any ad & keep it open for 15 seconds to continue" and reload the page if one exists // Functions to check for messages like "Click any ad & keep it open for 15 seconds to continue" and reload the page if one exists
function checkForMessage() { function checkForMessage() {
const paragraphs = document.getElementsByTagName("p"); const paragraphs = document.getElementsByTagName("p");
for (let p of paragraphs) { for (let p of paragraphs) {
if (/.*click.+ad.*to.+continue.*/is.test(p.textContent) && isElementVisibleAndEnabled(p)) { if (/.*click.+ad.*to.+continue.*/is.test(p.textContent) && isElementVisibleAndEnabled(p)) {
location.reload(); // Reload the page if (!reloading) location.reload(); // Reload the page
reloading = true;
return; // Exit the function after reloading return; // Exit the function after reloading
} }
} }