This commit is contained in:
Abhorrent_Anger 2025-03-04 00:45:19 +02:00
parent b53d1910c7
commit f66e64cbf7

View File

@ -17,21 +17,20 @@ 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 RAIN_BUTTON_SELECTOR = 'body > div.flex.overflow-y-auto.overflow-x-hidden > div.z-30.fixed.bg-object-bg.border-l.border-gray-90.right-0 > div > div.flex.flex-wrap.gap-2.relative > div.mt-3.w-full.rounded > div > button.relative.z-10.inline-flex.items-center.justify-center.rounded:not(.cursor-not-allowed) > span'; const RAIN_BUTTON_SELECTOR = 'body > div.flex.overflow-y-auto.overflow-x-hidden > div.z-30.fixed.bg-object-bg.border-l.border-gray-90.right-0 > div > div.flex.flex-wrap.gap-2.relative > div.mt-3.w-full.rounded > div > button.relative.z-10.inline-flex.items-center.justify-center.rounded:not(.cursor-not-allowed) > span';
const RAIN_AMOUNT_SELECTOR = 'body > div.flex.overflow-y-auto.overflow-x-hidden > div.z-30.fixed.bg-object-bg.border-l.border-gray-90.right-0 > div > div.flex.flex-wrap.gap-2.relative > div > div > span > span > span > span'; const RAIN_AMOUNT_SELECTOR = 'body > div.flex.overflow-y-auto.overflow-x-hidden > div.z-30.fixed.bg-object-bg.border-l.border-gray-90.right-0 > div > div.flex.flex-wrap.gap-2.relative > div > div > span > span > span > span';
const TITLE = 'SkinRave.GG';
var player = document.createElement('audio'); var player = document.createElement('audio');
player.src = 'https://cdn.pixabay.com/download/audio/2022/03/15/audio_05a708055d.mp3?filename=water-drop-85731.mp3'; player.src = 'https://cdn.pixabay.com/download/audio/2022/03/15/audio_05a708055d.mp3?filename=water-drop-85731.mp3';
player.preload = 'auto'; player.preload = 'auto';
var title = TITLE; var title = document.title;
function checkRain() { function checkRain() {
let rainJoinButton = $(RAIN_BUTTON_SELECTOR); let rainJoinButton = $(RAIN_BUTTON_SELECTOR);
let rainAmount = $(RAIN_AMOUNT_SELECTOR).text(); let rainAmount = $(RAIN_AMOUNT_SELECTOR).text();
title = TITLE + ' (' +rainAmount + ')'; var rainTitle = title + ' (Rain: ' + rainAmount + ')';
if (rainJoinButton.length == 0) { if (rainJoinButton.length == 0) {
console.log('There is no joinable rain'); console.log('There is no joinable rain');
setTitle(title); setTitle(rainTitle);
return false; return false;
} }
console.log('Rain available to join!'); console.log('Rain available to join!');
@ -39,9 +38,9 @@ function checkRain() {
let blinkTitle = '(🌧️) ' + title let blinkTitle = '(🌧️) ' + title
setTitle(blinkTitle); setTitle(blinkTitle);
let blinkInterval = Math.floor(RECHECK_TIMER / 4); let blinkInterval = Math.floor(RECHECK_TIMER / 4);
setTimeout(() => { setTitle(title); }, blinkInterval); setTimeout(() => { setTitle(rainTitle); }, blinkInterval);
setTimeout(() => { setTitle(blinkTitle); }, blinkInterval * 2); setTimeout(() => { setTitle(blinkTitle); }, blinkInterval * 2);
setTimeout(() => { setTitle(title); }, blinkInterval * 3); setTimeout(() => { setTitle(rainTitle); }, blinkInterval * 3);
} }
function setTitle(newTitle) { function setTitle(newTitle) {
@ -54,5 +53,6 @@ function runRoutines() {
} }
waitForKeyElements(MAIN_WINDOW_SELECTOR, () => { waitForKeyElements(MAIN_WINDOW_SELECTOR, () => {
title = document.title;
setTimeout(runRoutines, INITIAL_TIMER); setTimeout(runRoutines, INITIAL_TIMER);
}); });