]> git.ardis.lu - ard.is/commitdiff
Directly inject button in RAF loop
authorArdis Lu <ardisglu@gmail.com>
Tue, 19 Mar 2024 04:52:09 +0000 (21:52 -0700)
committerArdis Lu <ardisglu@gmail.com>
Tue, 19 Mar 2024 04:52:09 +0000 (21:52 -0700)
Fixes issue where the button will not appear if the tab is inactive

index.html

index eadad86591f7114cadda922d7e871c1a858bd0b3..3be59ad88586db91285bfb769fe397cb84d546ef 100644 (file)
       const currentFrame = Math.floor((timestamp - start) / msPerFrame);
       if (currentFrame >= frames.length) {
         asciiContainer.textContent = ascii;
+        asciiContainer.insertAdjacentElement('beforeend', button)
         return;
       }
       asciiContainer.textContent = frames[currentFrame];
         });
       }
     });
-    setTimeout(() => {
-      asciiContainer.insertAdjacentElement('beforeend', button);
-    }, msPerFrame * totalFrames + 500);
 
     // Inject obfuscated email. To block low-effort scraping.
     const addr = document.querySelector('address > a');
This page took 0.034533 seconds and 4 git commands to generate.