mirror of
https://github.com/ranaldsgift/KefinTweaks.git
synced 2026-11-05 15:52:47 +01:00
Fix home screen snowflake overlay performance issue...for real this time?
This commit is contained in:
+10
-5
@@ -168,11 +168,16 @@
|
||||
}
|
||||
|
||||
if (enableSeasonalAnimations) {
|
||||
// Use the snowverlay.js script to add snowflakes to the background
|
||||
const snowverlayScriptSrc = (window.KefinTweaksConfig.kefinTweaksRoot || '') + 'scripts/snowverlay.js';
|
||||
const snowverlayScript = document.createElement('script');
|
||||
snowverlayScript.src = snowverlayScriptSrc;
|
||||
document.head.appendChild(snowverlayScript);
|
||||
// Check if snowverlay script is already added
|
||||
const snowverlayScript = document.querySelector('script[src*="snowverlay.js"]');
|
||||
|
||||
if (!snowverlayScript) {
|
||||
// Use the snowverlay.js script to add snowflakes to the background
|
||||
const snowverlayScriptSrc = (window.KefinTweaksConfig.kefinTweaksRoot || '') + 'scripts/snowverlay.js';
|
||||
const snowverlayScript = document.createElement('script');
|
||||
snowverlayScript.src = snowverlayScriptSrc;
|
||||
document.head.appendChild(snowverlayScript);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (isValentinesPeriod()) {
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
function addSnowverlay() {
|
||||
// Check if snowverlay canvas is already added
|
||||
const snowverlayCanvas = document.querySelector('.snowverlay');
|
||||
if (snowverlayCanvas) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Configuration constants
|
||||
const CANVAS_HEIGHT_PX = 160;
|
||||
const SNOWFLAKE_AMOUNT = 15;
|
||||
|
||||
Reference in New Issue
Block a user