diff --git a/dist/assets/index-972128bb.js b/dist/assets/index-34aaa091.js similarity index 96% rename from dist/assets/index-972128bb.js rename to dist/assets/index-34aaa091.js index 27f5f5e..595d726 100644 --- a/dist/assets/index-972128bb.js +++ b/dist/assets/index-34aaa091.js @@ -85,7 +85,7 @@ function setQuery() { const paramString = params.toString(); if (paramString && "?" + paramString !== location.search) { console.debug("history push"); - history.pushState(null, "", `${location.pathname}?${params.toString()}`); + history.pushState(null, "", `${location.pathname}?${paramString}`); } else if (!paramString && location.search) { console.debug("resetting history"); history.pushState(null, "", "/"); @@ -106,7 +106,12 @@ ${formatMillions(leftover)} overkilled ${overkillRatio} times`; dom.resultElem.innerText = output; setQuery(); } +function resetCalc() { + dom.form.reset(); + dom.resultElem.innerText = ""; +} function restoreState() { + resetCalc(); const params = new URLSearchParams(location.search); if (!params.size) return; diff --git a/dist/index.html b/dist/index.html index b82d4ea..1a21aac 100644 --- a/dist/index.html +++ b/dist/index.html @@ -15,7 +15,7 @@ - + diff --git a/src/index.ts b/src/index.ts index e408c18..7a03705 100644 --- a/src/index.ts +++ b/src/index.ts @@ -27,7 +27,7 @@ function setQuery() { const paramString = params.toString(); if (paramString && "?" + paramString !== location.search) { console.debug("history push"); - history.pushState(null, "", `${location.pathname}?${params.toString()}`); + history.pushState(null, "", `${location.pathname}?${paramString}`); } else if (!paramString && location.search) { console.debug("resetting history"); history.pushState(null, "", "/"); @@ -54,7 +54,13 @@ ${formatMillions(leftover)} overkilled ${overkillRatio} times`; setQuery(); } +function resetCalc() { + dom.form.reset(); + dom.resultElem.innerText = ""; +} + function restoreState() { + resetCalc(); const params = new URLSearchParams(location.search); if (!params.size) return; console.debug("restoring state");