Better notif condition, emote blinking

This commit is contained in:
Abhorrent_Anger 2025-03-04 17:17:56 +02:00
parent e8491ab8b0
commit 510fc6d96c

View File

@ -15,7 +15,7 @@
const RECHECK_TIMER = 5000;
const INITIAL_TIMER = 2000;
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 > 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';
var player = document.createElement('audio');
@ -28,20 +28,20 @@ function checkRain() {
let rainJoinButton = $(RAIN_BUTTON_SELECTOR);
let rainAmount = $(RAIN_AMOUNT_SELECTOR).text();
var rainTitle = title + ' (Rain: ' +rainAmount + ')';
if (rainJoinButton.length == 0) {
if (rainJoinButton.length == 0 || rainJoinButton.text().toLowerCase() == 'joined') {
console.log('There is no joinable rain');
setTitle(rainTitle);
return false;
}
console.log('Rain available to join!');
player.play();
let blinkTitle = '🌧️ ' + title;
let emptyTitle = ' ' + title;
setTitle(blinkTitle);
let drizzleTitle = '🌧️ ' + title;
let exclaimTitle = '❗ ' + title;
setTitle(drizzleTitle);
let blinkInterval = Math.floor(RECHECK_TIMER / 4);
setTimeout(() => { setTitle(emptyTitle); }, blinkInterval);
setTimeout(() => { setTitle(exclaimTitle); }, blinkInterval);
setTimeout(() => { setTitle(blinkTitle); }, blinkInterval * 2);
setTimeout(() => { setTitle(emptyTitle); }, blinkInterval * 3);
setTimeout(() => { setTitle(exclaimTitle); }, blinkInterval * 3);
}
function setTitle(newTitle) {