79 lines
2.9 KiB
JavaScript
79 lines
2.9 KiB
JavaScript
// ==UserScript==
|
|
// @name Skinrave Rakeback Collector
|
|
// @namespace https://pube.tk
|
|
// @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 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
|
|
// ==/UserScript==
|
|
|
|
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 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);
|
|
}
|
|
|
|
function collectRakeback() {
|
|
$(RAKEBACK_AMOUNT_SELECTOR).each(function () {
|
|
let button = $(this).parent().children('button').eq(0);
|
|
if (button.text() == EMPTY_CLAIM || button.prop('disabled')) {
|
|
console.log('Skipped an empty rakeback');
|
|
return;
|
|
}
|
|
button.click();
|
|
console.log('Attempted to claim a rakeback');
|
|
});
|
|
}
|
|
|
|
function collectTickets() {
|
|
let ticketButton = $(TICKET_SELECTOR);
|
|
if (ticketButton.length == 0) {
|
|
console.log('No tickets to collect');
|
|
return false;
|
|
}
|
|
ticketButton.click();
|
|
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);
|
|
}); |