Reload the page after the timeout
This commit is contained in:
parent
f139496c3e
commit
bf69b30453
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Get Drop Free Case Claimer
|
// @name Get Drop Free Case Claimer
|
||||||
// @namespace https://pube.tk
|
// @namespace https://pube.tk
|
||||||
// @version 2025-09-20
|
// @version 2025-09-21
|
||||||
// @description Claims free cases
|
// @description Claims free cases
|
||||||
// @author Abhorrent_Anger
|
// @author Abhorrent_Anger
|
||||||
// @match https://getdrop.org/case/free*
|
// @match https://getdrop.org/case/free*
|
||||||
@ -14,8 +14,10 @@
|
|||||||
|
|
||||||
const INITIAL_TIMER = 2000;
|
const INITIAL_TIMER = 2000;
|
||||||
const RECHECK_TIMER = 60 * 1000;
|
const RECHECK_TIMER = 60 * 1000;
|
||||||
|
const RELOAD_TIMER = 30 * 60 * 1000;
|
||||||
const MAIN_WINDOW_SELECTOR = "main";
|
const MAIN_WINDOW_SELECTOR = "main";
|
||||||
const FREE_CASE_BUTTON = '.free-open.btn-opencase span';
|
const FREE_CASE_BUTTON = '.free-open.btn-opencase span';
|
||||||
|
const MINUTE_SELECTOR = '.number.min.m';
|
||||||
|
|
||||||
function clickFreeCase() {
|
function clickFreeCase() {
|
||||||
$(FREE_CASE_BUTTON).click();
|
$(FREE_CASE_BUTTON).click();
|
||||||
@ -27,6 +29,24 @@ function runRoutines() {
|
|||||||
setTimeout(runRoutines, RECHECK_TIMER);
|
setTimeout(runRoutines, RECHECK_TIMER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setupReload() {
|
||||||
|
let reload_timer = Math.max(RELOAD_TIMER, getCooldown());
|
||||||
|
console.log('Sleeping for '+reload_timer+' seconds...');
|
||||||
|
setTimeout(reload, reload_timer);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCooldown() {
|
||||||
|
let time = 0;
|
||||||
|
time += ($(MINUTE_SELECTOR).text() * 60 * 1000) + 60 * 1000;
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
function reload() {
|
||||||
|
console.log('Reloading...');
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
|
||||||
waitForKeyElements(MAIN_WINDOW_SELECTOR, () => {
|
waitForKeyElements(MAIN_WINDOW_SELECTOR, () => {
|
||||||
setTimeout(runRoutines, INITIAL_TIMER);
|
setTimeout(runRoutines, INITIAL_TIMER);
|
||||||
|
setTimeout(setupReload, RECHECK_TIMER);
|
||||||
});
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user