]> git.ardis.lu - zip-page/commitdiff
Update page when preview link is clicked
authorArdis Lu <ardisglu@gmail.com>
Sun, 1 Oct 2023 02:06:20 +0000 (19:06 -0700)
committerArdis Lu <ardisglu@gmail.com>
Sun, 1 Oct 2023 02:06:20 +0000 (19:06 -0700)
index.html

index cc2faeff4613b6f0b73d84ea88d997e998a97fa0..38672421182b2fdb0359fdb22d104dcaf8f5f5a0 100644 (file)
       e.target.elements['url'].innerHTML = `<a href="${url}">${url.substring(0, 60)}${url.length > 60 ? '...' : ''}</a>`;
     });
 
+    addEventListener('hashchange', e => {
+      gzipBase64ToText(new URL(e.newURL).hash.substring(1)).then(html => {
+        document.open();
+        document.write(html);
+        document.close();
+      });
+    });
+
     // Blocks flash of original UI before document.write in the header script executes
     if (location.hash === '') {
       document.querySelector('body').style.setProperty('display', '');
This page took 0.037422 seconds and 4 git commands to generate.