Skip to content

Instantly share code, notes, and snippets.

@Himura2la
Last active May 20, 2022 14:23
Show Gist options
  • Save Himura2la/c5ff2fc5a716af4cdc07ffc4a8bfaa52 to your computer and use it in GitHub Desktop.
Save Himura2la/c5ff2fc5a716af4cdc07ffc4a8bfaa52 to your computer and use it in GitHub Desktop.
awfice-style URL encoder/decoder
<body><style>textarea{width:99%;height:49%;}body{margin:0;}textarea{width:99%;font-size:18px;padding:0.5em}</style><textarea placeholder="Decoded" id="d"></textarea><textarea placeholder="Encoded" id="e"></textarea><script>document.querySelectorAll("textarea").forEach(t=>t.addEventListener("keyup",function(e){switch(e.target.id){case"d":document.getElementById("e").value=encodeURIComponent(e.target.value);break;case"e":document.getElementById("d").value=decodeURIComponent(e.target.value);break;}}))</script></body>

The world smallest percent-encoding converter

Copy and add to bookmarks or open in the URL bar:

data:text/html,<body><style>textarea{width:99%;height:49%;}body{margin:0;}textarea{width:99%;font-size:18px;padding:0.5em}</style><textarea placeholder="Decoded" id="d"></textarea><textarea placeholder="Encoded" id="e"></textarea><script>document.querySelectorAll("textarea").forEach(t=>t.addEventListener("keyup",function(e){switch(e.target.id){case"d":document.getElementById("e").value=encodeURIComponent(e.target.value);break;case"e":document.getElementById("d").value=decodeURIComponent(e.target.value);break;}}))</script></body>

Try it!

Inspired by awfice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment