Skip to content

Commit

Permalink
v0.33.1 == shorter, less escaped, share urls
Browse files Browse the repository at this point in the history
  • Loading branch information
ldemailly committed Aug 3, 2024
1 parent 7087256 commit a534e04
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions _includes/grol_wasm.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,15 @@
document.getElementById('addParamButton').addEventListener('click', () => {
const paramValue = document.getElementById('input').value
const url = new URL(window.location)
url.searchParams.set('c', paramValue)
window.history.pushState({}, '', url)
function customEscape(str) {
return str.replace(/\+/g, '%2B')
.replace(/ /g, '+')
.replace(/\n/g, '%0A')
.replace(/</g, '%3C')
}
const encodedValue = customEscape(paramValue)
const newUrl = `${url.origin}${url.pathname}?c=${encodedValue}`
window.history.pushState({}, '', newUrl)
});
</script>

Expand Down
Binary file modified grol.wasm
Binary file not shown.

0 comments on commit a534e04

Please sign in to comment.