SkinraveDailyCaseOpener/SkinraveDailyCaseOpener.user.js
2025-06-03 09:46:40 +03:00

37 lines
1.2 KiB
JavaScript

// ==UserScript==
// @name Skinrave Daily Case Opener
// @namespace https://pube.tk
// @version 2025-06-03
// @description Opens daily cases
// @author Abhorrent_Anger
// @match https://skinrave.gg/en/cs2/case-opening/daily-case
// @icon https://www.google.com/s2/favicons?sz=64&domain=skinrave.gg
// @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 RECHECK_TIMER = 60000;
const INITIAL_TIMER = 2000;
const MAIN_WINDOW_SELECTOR = "div.flex.overflow-y-auto.overflow-x-hidden";
const OPEN_BUTTON_SELECTOR = '#case-daily-case div[data-testid="case-opening-control-panel"] button:not(:disabled)';
function openDailyCase() {
let openButton = $(OPEN_BUTTON_SELECTOR);
if (openButton.length == 0) {
console.log('No daily cases to open');
return false;
}
openButton.click();
console.log('Attempted to open a daily case');
}
function runRoutines() {
openDailyCase();
setTimeout(runRoutines, RECHECK_TIMER);
}
waitForKeyElements(MAIN_WINDOW_SELECTOR, () => {
setTimeout(runRoutines, INITIAL_TIMER);
});