From d596042c20897415ae9988c563fd5dff86d7774f Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Sat, 30 Sep 2023 19:06:20 -0700 Subject: [PATCH] Update page when preview link is clicked --- index.html | 8 ++++++++ 1 file changed, 8 insertions(+) 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', ''); -- 2.47.3