const loadingContainer = document.querySelector(".loading"); const loadingBg = document.querySelector(".loading-bg"); const triggerLoading = () => { if (loadingContainer.style.display === "none") { loadingContainer.style.display = "flex"; } else { loadingContainer.style.display = "none"; } if (loadingBg.style.display === "none") { loadingBg.style.display = "block"; } else { loadingBg.style.display = "none"; } }; // Check if these functions already exist in the global scope before declaring if (typeof window.loadingOn !== 'function') { window.loadingOn = () => { loadingContainer.style.display = "flex"; loadingBg.style.display = "block"; }; } if (typeof window.loadingOff !== 'function') { window.loadingOff = () => { loadingContainer.style.display = "none"; loadingBg.style.display = "none"; }; }