56 lines
1.8 KiB
JavaScript
56 lines
1.8 KiB
JavaScript
// ==UserScript==
|
|
// @name Easy Skins Coin Claimer
|
|
// @namespace https://pube.tk
|
|
// @version 2025-08-08
|
|
// @description Claims free coins on the info page
|
|
// @author Abhorrent_Anger
|
|
// @match https://easyskins.com/info/*
|
|
// @icon https://www.google.com/s2/favicons?sz=64&domain=easyskins.com
|
|
// @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 = 1000;
|
|
const RELOAD_TIMER = 30 * 60 * 1000;
|
|
const MAIN_WINDOW_SELECTOR = ".content";
|
|
const REWARD_SIDEBAR_BUTTON_SELECTOR = '.menu-item__icon.free-coins';
|
|
const REWARD_MODAL_SELECTOR = '.free-coins-modal';
|
|
const FREE_COINS_BUTTON_ENABLED = 'button.button-get-daily-bonus:not(:disabled)';
|
|
const FREE_COINS_BUTTON = 'button.button-get-daily-bonus';
|
|
|
|
function checkFreeCoins() {
|
|
$(REWARD_SIDEBAR_BUTTON_SELECTOR).click();
|
|
$(FREE_COINS_BUTTON).click();
|
|
}
|
|
|
|
function getCooldown() {
|
|
let time = 0;
|
|
time += $(FREE_COINS_BUTTON + ' .seconds').text() * 1000;
|
|
time += $(FREE_COINS_BUTTON + ' .minutes').text() * 60 * 1000;
|
|
time += $(FREE_COINS_BUTTON + ' .hours').text() * 60 * 60 * 1000;
|
|
return time;
|
|
}
|
|
|
|
function runRoutines() {
|
|
console.log('Checking for free coin claims');
|
|
checkFreeCoins();
|
|
setTimeout(recheck, RECHECK_TIMER);
|
|
}
|
|
|
|
function recheck() {
|
|
let reload_timer = Math.max(RELOAD_TIMER, getCooldown());
|
|
console.log('Sleeping for '+reload_timer+' seconds...');
|
|
setTimeout(reload, reload_timer);
|
|
}
|
|
|
|
function reload() {
|
|
console.log('Reloading...');
|
|
location.reload();
|
|
}
|
|
|
|
waitForKeyElements(MAIN_WINDOW_SELECTOR, () => {
|
|
setTimeout(runRoutines, INITIAL_TIMER);
|
|
}); |