2024-11-08 17:05:35 +05:00
// ==UserScript==
// @name profitsfly reload helper
2025-02-20 03:46:38 +05:00
// @include /^https:\/\/(.*\.|)(playonpc.online|quins.us|(retrotechreborn|insurelean|ecosolardigest).com|gally.shop|qanin.xyz|evegor.net)\/.*/
2024-11-08 17:05:35 +05:00
// @run-at document-start
// ==/UserScript==
//---profitsfly reload helper----
( function ( ) {
"use strict" ;
2025-02-20 03:46:38 +05:00
const domainRegex = /^https:\/\/(.*\.|)(playonpc.online|quins.us|(retrotechreborn|insurelean|ecosolardigest).com|gally.shop|qanin.xyz|evegor.net)\/.*/ ;
2024-11-08 17:05:35 +05:00
if ( domainRegex . test ( window . location . href ) ) {
2024-12-14 04:13:19 +05:00
// ---RELOAD DEAD-END PAGES---
2025-01-16 18:47:07 +05:00
if ( document . readyState === "complete" ) {
2024-12-05 23:12:56 +05:00
onWindowLoad ( ) ;
} else {
window . addEventListener ( 'load' , onWindowLoad ) ;
2024-12-04 01:49:08 +05:00
}
2024-12-05 23:12:56 +05:00
function onWindowLoad ( ) {
2024-11-23 14:17:56 +05:00
2025-02-12 03:19:33 +05:00
// Continue immediately on the "Shortened link (Waiting)" page
if ( document . title === "Shortened link (Waiting)" && ! window . location . href . includes ( "continue=true" ) ) {
// add continue=true to the URL
window . location . href = window . location . href + '&continue=true' ;
}
2024-12-04 01:49:08 +05:00
// Function to check for messages like "Click any ad & keep it open for 15 seconds to continue" and reload the page if one exists
let reloading = false ;
2024-11-08 17:05:35 +05:00
function checkForMessage ( ) {
const paragraphs = document . getElementsByTagName ( "p" ) ;
for ( let p of paragraphs ) {
if ( / . * c l i c k . + a d . * t o . + c o n t i n u e . * / i s . t e s t ( p . t e x t C o n t e n t ) & & i s E l e m e n t V i s i b l e A n d E n a b l e d ( p ) ) {
2024-11-23 14:17:56 +05:00
if ( ! reloading ) location . reload ( ) ; // Reload the page
reloading = true ;
2024-11-08 17:05:35 +05:00
return ; // Exit the function after reloading
}
}
2025-01-02 19:29:24 +05:00
if ( /Less than.+passed between actions.+try again/ . test ( document . body . textContent ) ) {
2024-11-27 22:51:11 +05:00
if ( ! reloading ) location . reload ( ) ; // Reload the page
reloading = true ;
return ; // Exit the function after reloading
}
2024-11-08 17:05:35 +05:00
}
// Helper function to determine if an element is visible and enabled
function isElementVisibleAndEnabled ( el ) {
// Check if the element and all its parents are visible
let currentElement = el ;
while ( currentElement ) {
const style = getComputedStyle ( currentElement ) ;
if ( style . display === "none" || style . visibility === "hidden" ) {
return false ; // Element or parent is not visible
}
currentElement = currentElement . parentElement ; // Move up the DOM tree
}
// Check if the button is enabled
return ! el . disabled ;
}
setInterval ( checkForMessage , 1000 ) ;
2024-12-05 23:12:56 +05:00
}
2024-12-14 04:13:19 +05:00
2025-01-18 15:59:06 +05:00
// ---After DOM loaded---
2024-12-14 04:13:19 +05:00
document . addEventListener ( 'DOMContentLoaded' , function ( ) {
2025-01-18 15:59:06 +05:00
2025-02-04 17:43:23 +05:00
// Set auxiliary variables
window . assDidCkeDone = true ;
2025-01-18 15:59:06 +05:00
// ---Remove YouTube modal and banner---
// (alternative with uBO : https://github.com/uBlockOrigin/uAssets/discussions/17361#discussioncomment-11864776)
if ( unsafeWindow . youtubeVideoStepProceed ) { unsafeWindow . youtubeVideoStepProceed ( ) ; }
const stickyBanner = document . querySelector ( ".mg-sticky-banner" ) ;
if ( stickyBanner ) { stickyBanner . style . display = "none" ; }
// ---Skip timers---
2025-01-26 23:51:40 +05:00
const forcedTimerInitialValue = 7 ;
2024-12-14 04:13:19 +05:00
function setTimer ( ) {
2025-01-26 23:51:40 +05:00
if ( window . wT9882 > forcedTimerInitialValue ) {
2025-02-04 00:14:57 +05:00
window . wT9882 = 1 ;
2024-12-14 04:13:19 +05:00
}
}
2025-01-26 23:51:40 +05:00
window . wT9882 = forcedTimerInitialValue ;
2025-02-04 00:14:57 +05:00
setInterval ( setTimer , 1000 ) ; //This function exists because if the site detects an adblocker, it switches the timer to 30, and that only happens in the last second or so
2024-12-14 04:13:19 +05:00
/* ------------ 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 ( ) ;
} ) ;
2024-11-08 17:05:35 +05:00
}
} ) ( ) ;
//-------