From 61c008a378ce96d5c8d92c9279f231fbdba9ea05 Mon Sep 17 00:00:00 2001 From: Nicholas Jitkoff Date: Mon, 30 May 2022 10:37:00 -0700 Subject: [PATCH] Update path components --- docs/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/index.js b/docs/index.js index 5ab1228..f87203a 100644 --- a/docs/index.js +++ b/docs/index.js @@ -47,11 +47,11 @@ if (e.data.title) document.title = e.data.title; if (e.data.favicon) setFavicon(e.data.favicon); if (e.data.updateURL) { - let path = "/" + e.data.title.replace(/\s/g, "-"); - if (e.data.description) path += "/d/" + encodeURIComponent(e.data.description); - if (e.data.favicon) path += "/f/" + encodeURIComponent(e.data.favicon); - if (e.data.image) path += "/i/" + encodeURIComponent(btoa(e.data.image)); - window.location.pathname = path; + let path = ["/" + e.data.title.replace(/\s/g, "-")]; + if (e.data.description) path.push("d/" + encodeURIComponent(e.data.description)); + if (e.data.favicon) path.push("f/" + encodeURIComponent(e.data.favicon)); + if (e.data.image) path.push("i/" + encodeURIComponent(btoa(e.data.image))); + window.location.pathname = path.join('/'); } if (e.data.replaceURL) { window.history.replaceState(null, null, e.data.replaceURL);