53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
// ==UserScript==
|
|
// @name Get Drop Free Case Claimer
|
|
// @namespace https://pube.tk
|
|
// @version 2025-09-28
|
|
// @description Claims free cases
|
|
// @author Abhorrent_Anger
|
|
// @match https://getdrop.org/case/free*
|
|
// @match https://getdrop.org/*/case/free*
|
|
// @icon https://www.google.com/s2/favicons?sz=64&domain=getdrop.org
|
|
// @grant none
|
|
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
|
|
// @require https://cdn.jsdelivr.net/gh/CoeJoder/waitForKeyElements.js@v1.3/waitForKeyElements.js
|
|
// @run-at document-end
|
|
// ==/UserScript==
|
|
|
|
const INITIAL_TIMER = 2000;
|
|
const RECHECK_TIMER = 60 * 1000;
|
|
const RELOAD_TIMER = 30 * 60 * 1000;
|
|
const MAIN_WINDOW_SELECTOR = "main";
|
|
const FREE_CASE_BUTTON = '.free-open.btn-opencase span';
|
|
const MINUTE_SELECTOR = '.number.min.m';
|
|
|
|
function clickFreeCase() {
|
|
$(FREE_CASE_BUTTON).click();
|
|
}
|
|
|
|
function runRoutines() {
|
|
console.log('Checking for free coin claims...');
|
|
clickFreeCase();
|
|
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, () => {
|
|
setTimeout(runRoutines, INITIAL_TIMER);
|
|
setTimeout(setupReload, RECHECK_TIMER);
|
|
}); |