From: Ardis Lu Date: Sun, 1 Oct 2023 02:06:20 +0000 (-0700) Subject: Update page when preview link is clicked X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=d596042c20897415ae9988c563fd5dff86d7774f;p=zip-page Update page when preview link is clicked --- diff --git a/index.html b/index.html index cc2faef..3867242 100644 --- a/index.html +++ b/index.html @@ -144,6 +144,14 @@ e.target.elements['url'].innerHTML = `${url.substring(0, 60)}${url.length > 60 ? '...' : ''}`; }); + 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', '');