Better notif condition, emote blinking
This commit is contained in:
parent
e8491ab8b0
commit
510fc6d96c
@ -15,7 +15,7 @@
|
|||||||
const RECHECK_TIMER = 5000;
|
const RECHECK_TIMER = 5000;
|
||||||
const INITIAL_TIMER = 2000;
|
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 > 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';
|
||||||
|
|
||||||
var player = document.createElement('audio');
|
var player = document.createElement('audio');
|
||||||
@ -28,20 +28,20 @@ function checkRain() {
|
|||||||
let rainJoinButton = $(RAIN_BUTTON_SELECTOR);
|
let rainJoinButton = $(RAIN_BUTTON_SELECTOR);
|
||||||
let rainAmount = $(RAIN_AMOUNT_SELECTOR).text();
|
let rainAmount = $(RAIN_AMOUNT_SELECTOR).text();
|
||||||
var rainTitle = title + ' (Rain: ' +rainAmount + ')';
|
var rainTitle = title + ' (Rain: ' +rainAmount + ')';
|
||||||
if (rainJoinButton.length == 0) {
|
if (rainJoinButton.length == 0 || rainJoinButton.text().toLowerCase() == 'joined') {
|
||||||
console.log('There is no joinable rain');
|
console.log('There is no joinable rain');
|
||||||
setTitle(rainTitle);
|
setTitle(rainTitle);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
console.log('Rain available to join!');
|
console.log('Rain available to join!');
|
||||||
player.play();
|
player.play();
|
||||||
let blinkTitle = '🌧️ ' + title;
|
let drizzleTitle = '🌧️ ' + title;
|
||||||
let emptyTitle = ' ' + title;
|
let exclaimTitle = '❗ ' + title;
|
||||||
setTitle(blinkTitle);
|
setTitle(drizzleTitle);
|
||||||
let blinkInterval = Math.floor(RECHECK_TIMER / 4);
|
let blinkInterval = Math.floor(RECHECK_TIMER / 4);
|
||||||
setTimeout(() => { setTitle(emptyTitle); }, blinkInterval);
|
setTimeout(() => { setTitle(exclaimTitle); }, blinkInterval);
|
||||||
setTimeout(() => { setTitle(blinkTitle); }, blinkInterval * 2);
|
setTimeout(() => { setTitle(blinkTitle); }, blinkInterval * 2);
|
||||||
setTimeout(() => { setTitle(emptyTitle); }, blinkInterval * 3);
|
setTimeout(() => { setTitle(exclaimTitle); }, blinkInterval * 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setTitle(newTitle) {
|
function setTitle(newTitle) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user