Update rain animation and refactor rain.js comments for clarity
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
// 1. Read Configuration
|
||||
const config = window.SeasonalsPluginConfig?.Rain || {};
|
||||
|
||||
const enabled = config.EnableRain !== undefined ? config.EnableRain : true;
|
||||
@@ -8,7 +7,7 @@ const rainSpeed = config.RainSpeed || 1.0;
|
||||
|
||||
let msgPrinted = false;
|
||||
|
||||
// 2. Toggle Function
|
||||
// Toggle Function
|
||||
function toggleRain() {
|
||||
const container = document.querySelector('.rain-container');
|
||||
if (!container) return;
|
||||
@@ -33,7 +32,6 @@ function toggleRain() {
|
||||
}
|
||||
}
|
||||
|
||||
// 3. MutationObserver
|
||||
const observer = new MutationObserver(toggleRain);
|
||||
observer.observe(document.body, {
|
||||
childList: true,
|
||||
@@ -41,7 +39,6 @@ observer.observe(document.body, {
|
||||
attributes: true
|
||||
});
|
||||
|
||||
// 4. Element Creation
|
||||
function createElements() {
|
||||
const container = document.querySelector('.rain-container') || document.createElement('div');
|
||||
|
||||
@@ -67,7 +64,6 @@ function createElements() {
|
||||
}
|
||||
}
|
||||
|
||||
// 5. Initialization
|
||||
function initializeRain() {
|
||||
if (!enabled) return;
|
||||
createElements();
|
||||
|
||||
Reference in New Issue
Block a user