mirror of
https://github.com/ranaldsgift/KefinTweaks.git
synced 2026-11-05 15:52:47 +01:00
Improve performance of snowflakes: Thanks wernox!
This commit is contained in:
1 parent
87168bc66d
commit
6cdb126187
2 files changed
+136
-20
No files matched your search
+5
-20
@@ -168,26 +168,11 @@
|
||||
}
|
||||
|
||||
if (enableSeasonalAnimations) {
|
||||
// Import the Flurry module and leverage it from jQuery. /scripts/third party/flurry.js by appending it to the head
|
||||
const flurryScriptSrc = (window.KefinTweaksConfig.kefinTweaksRoot || '') + 'scripts/third party/jquery.flurry.min.js';
|
||||
|
||||
// Function to run flurry safely
|
||||
const startFlurry = () => {
|
||||
if (window.jQuery && typeof window.jQuery.fn.flurry === 'function') {
|
||||
window.jQuery("body").flurry();
|
||||
}
|
||||
};
|
||||
|
||||
// Check if script is already present
|
||||
if (!document.querySelector(`script[src="${flurryScriptSrc}"]`)) {
|
||||
const flurryScript = document.createElement('script');
|
||||
flurryScript.src = flurryScriptSrc;
|
||||
flurryScript.onload = startFlurry; // Run after load
|
||||
document.head.appendChild(flurryScript);
|
||||
} else {
|
||||
// Script loaded, try running directly
|
||||
startFlurry();
|
||||
}
|
||||
// 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()) {
|
||||
|
||||
Reference in new issue
Block a user