splay = 'none';
          }
      });

      // Update event listeners for page unload
      window.addEventListener('beforeunload', cleanupLogSource);
      window.addEventListener('unload', cleanupLogSource);


      window.onload = function() {
        // Run the confetti function only once by storing the state in localStorage
        if(!localStorage.getItem('confettiRun')) {
          setTimeout(() => {
            confetti();
            localStorage.setItem('confettiRun', 'true');
          }, 1000);