From 0cf8f7a2fd5b08b20443ded68f0951a27d926e4c Mon Sep 17 00:00:00 2001 From: Dan Palmer Date: Sat, 30 Nov 2024 02:03:10 -0500 Subject: [PATCH] feat: Add `?engine` query parameter to url (#38) * feat: Add `?engine` query parameter to url * Update index.html set the history state by the value of engine --------- Co-authored-by: Dreampuf --- index.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index b5df499..025cca1 100644 --- a/index.html +++ b/index.html @@ -383,8 +383,13 @@ } function updateState() { - var content = encodeURIComponent(editor.getSession().getDocument().getValue()); - history.pushState({"content": content}, "", "#" + content) + const updatedUrl = new URL(window.location) + // Hash + const content = encodeURIComponent(editor.getSession().getDocument().getValue()); + updatedUrl.hash = content + // Search params + updatedUrl.searchParams.set("engine", engineEl.value) + history.pushState({"content": content, "engine": engineEl.value}, "", updatedUrl.toString()) } function updateOutput(result) {