Open daily and level cases in a new background tab

This commit is contained in:
Abhorrent_Anger 2025-06-15 14:04:46 +03:00
parent ca2a14c904
commit 9fd59ff6ac

View File

@ -1,12 +1,12 @@
// ==UserScript==
// @name Skinrave Rakeback Collector
// @namespace https://pube.tk
// @version 2025-06-03
// @version 2025-06-15
// @description Claims rewards
// @author Abhorrent_Anger
// @match https://skinrave.gg/en/rewards
// @icon https://www.google.com/s2/favicons?sz=64&domain=skinrave.gg
// @grant none
// @grant GM_openInTab
// @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
@ -16,12 +16,17 @@ const RECHECK_TIMER = 60000;
const INITIAL_TIMER = 2000;
const MAIN_WINDOW_SELECTOR = "div.flex.overflow-y-auto.overflow-x-hidden";
const RAKEBACK_AMOUNT_SELECTOR = 'div[data-testid="rakeback-amount"]';
const TICKET_SELECTOR = 'div[data-testid="reward-ticket-claim-button"] button:not(:disabled)'
const TICKET_SELECTOR = 'div[data-testid="reward-ticket-claim-button"] button:not(:disabled)';
const DAILY_SELECTOR = 'div.flex-1:nth-of-type(2) button:not(:disabled)';
const DAILY_UPGRADE_SELECTOR = 'div.flex.min-h-5.justify-between p';
const LEVEL_SELECTOR = 'div.grid button:not(:disabled):nth-of-type(1)';
const EMPTY_CLAIM = 'Claim 0.00 T';
function runRoutines() {
collectRakeback();
collectTickets();
collectDailyCase();
collectLevelCase();
setTimeout(runRoutines, RECHECK_TIMER);
}
@ -47,6 +52,28 @@ function collectTickets() {
console.log('Attempted to collect tickets');
}
function collectDailyCase() {
let dailyButton = $(DAILY_SELECTOR);
if (dailyButton.length == 0) {
console.log('No daily case to collect');
return false;
}
let dailyType = $(DAILY_UPGRADE_SELECTOR).length > 0 ? dailyUpgrade.text().toLowerCase() : 'case';
GM_openInTab('https://skinrave.gg/en/cs2/case-opening/daily-'.concat(dailyType), true);
console.log('Attempted to open a new daily '.concat(dailyType, ' case window'));
}
function collectLevelCase() {
let levelButton = $(LEVEL_SELECTOR);
if (levelButton.length == 0) {
console.log('No level case to collect');
return false;
}
let levelType = levelButton.parent().parent().find('span').first().text().toLowerCase();
GM_openInTab('https://skinrave.gg/en/cs2/case-opening/'.concat(levelType, '-reward'), true);
console.log('Attempted to open a new '.concat(levelType, ' level case window'));
}
waitForKeyElements(MAIN_WINDOW_SELECTOR, () => {
setTimeout(runRoutines, INITIAL_TIMER);
});