Initial commit
This commit is contained in:
commit
b53d1910c7
11
LICENSE
Normal file
11
LICENSE
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
|
Version 2, December 2004
|
||||||
|
|
||||||
|
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.
|
||||||
|
|
||||||
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. You just DO WHAT THE FUCK YOU WANT TO.
|
11
README.md
Normal file
11
README.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# SkinraveRainNotifier
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
* [Tampermonkey](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=en) (Chrome)
|
||||||
|
* [Greasemonkey](https://addons.mozilla.org/en-us/firefox/addon/greasemonkey/) (Firefox)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
1. Ensure that you have either Tampermonkey or Greasemonkey installed.
|
||||||
|
2. Download the script [`SkinraveRainNotifier.user.js`](SkinraveRainNotifier.user.js?raw=true).
|
||||||
|
3. Confirm that you want to install the script.
|
||||||
|
4. The script should now be installed and ready to use. Open [any](https://skinrave.gg/) page.
|
58
SkinraveRainNotifier.user.js
Normal file
58
SkinraveRainNotifier.user.js
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @name Skinrave Rain Notifier
|
||||||
|
// @namespace http://tampermonkey.net/
|
||||||
|
// @version 2025-03-03
|
||||||
|
// @description Not
|
||||||
|
// @author You
|
||||||
|
// @match https://skinrave.gg/*
|
||||||
|
// @icon https://www.google.com/s2/favicons?sz=64&domain=skinrave.gg
|
||||||
|
// @grant none
|
||||||
|
// @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 = 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_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');
|
||||||
|
player.src = 'https://cdn.pixabay.com/download/audio/2022/03/15/audio_05a708055d.mp3?filename=water-drop-85731.mp3';
|
||||||
|
player.preload = 'auto';
|
||||||
|
|
||||||
|
var title = TITLE;
|
||||||
|
|
||||||
|
function checkRain() {
|
||||||
|
let rainJoinButton = $(RAIN_BUTTON_SELECTOR);
|
||||||
|
let rainAmount = $(RAIN_AMOUNT_SELECTOR).text();
|
||||||
|
title = TITLE + ' (' +rainAmount + ')';
|
||||||
|
if (rainJoinButton.length == 0) {
|
||||||
|
console.log('There is no joinable rain');
|
||||||
|
setTitle(title);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
console.log('Rain available to join!');
|
||||||
|
player.play();
|
||||||
|
let blinkTitle = '(🌧️) ' + title
|
||||||
|
setTitle(blinkTitle);
|
||||||
|
let blinkInterval = Math.floor(RECHECK_TIMER / 4);
|
||||||
|
setTimeout(() => { setTitle(title); }, blinkInterval);
|
||||||
|
setTimeout(() => { setTitle(blinkTitle); }, blinkInterval * 2);
|
||||||
|
setTimeout(() => { setTitle(title); }, blinkInterval * 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setTitle(newTitle) {
|
||||||
|
document.title = newTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
function runRoutines() {
|
||||||
|
checkRain();
|
||||||
|
setTimeout(runRoutines, RECHECK_TIMER);
|
||||||
|
}
|
||||||
|
|
||||||
|
waitForKeyElements(MAIN_WINDOW_SELECTOR, () => {
|
||||||
|
setTimeout(runRoutines, INITIAL_TIMER);
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user