From 510fc6d96ce33950e710005a8f7043ca4c01f834 Mon Sep 17 00:00:00 2001 From: Abhorrent_Anger Date: Tue, 4 Mar 2025 17:17:56 +0200 Subject: [PATCH] Better notif condition, emote blinking --- SkinraveRainNotifier.user.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/SkinraveRainNotifier.user.js b/SkinraveRainNotifier.user.js index 2baf490..1bc04ae 100644 --- a/SkinraveRainNotifier.user.js +++ b/SkinraveRainNotifier.user.js @@ -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) {