Support higher level daily cases and level cases, close out the tab after opening

This commit is contained in:
Abhorrent_Anger 2025-06-15 14:04:24 +03:00
parent c25cab4f70
commit 91b22c31ec

View File

@ -1,12 +1,13 @@
// ==UserScript== // ==UserScript==
// @name Skinrave Daily Case Opener // @name Skinrave Daily Case Opener
// @namespace https://pube.tk // @namespace https://pube.tk
// @version 2025-06-03 // @version 2025-06-15
// @description Opens daily cases // @description Opens daily cases
// @author Abhorrent_Anger // @author Abhorrent_Anger
// @match https://skinrave.gg/en/cs2/case-opening/daily-case // @match https://skinrave.gg/en/cs2/case-opening/daily-*
// @match https://skinrave.gg/en/cs2/case-opening/*-reward
// @icon https://www.google.com/s2/favicons?sz=64&domain=skinrave.gg // @icon https://www.google.com/s2/favicons?sz=64&domain=skinrave.gg
// @grant none // @grant window.close
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js // @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 // @require https://cdn.jsdelivr.net/gh/CoeJoder/waitForKeyElements.js@v1.3/waitForKeyElements.js
// @run-at document-end // @run-at document-end
@ -15,16 +16,19 @@
const RECHECK_TIMER = 60000; const RECHECK_TIMER = 60000;
const INITIAL_TIMER = 2000; const INITIAL_TIMER = 2000;
const MAIN_WINDOW_SELECTOR = "div.flex.overflow-y-auto.overflow-x-hidden"; 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)'; const OPEN_BUTTON_SELECTOR = 'div[data-testid="case-opening-control-panel"] button:not(:disabled)';
function openDailyCase() { function openDailyCase() {
let openButton = $(OPEN_BUTTON_SELECTOR); let openButton = $(OPEN_BUTTON_SELECTOR);
if (openButton.length == 0) { if (openButton.length == 0) {
console.log('No daily cases to open'); console.log('No daily cases to open');
return false;
} }
else {
openButton.click(); openButton.click();
console.log('Attempted to open a daily case'); console.log('Attempted to open a daily case');
}
console.log('Attempting to close out the tab...');
setTimeout(window.close, INITIAL_TIMER);
} }
function runRoutines() { function runRoutines() {