Skip to content

Instantly share code, notes, and snippets.

@theSoberSobber
Last active December 28, 2025 10:37
Show Gist options
  • Select an option

  • Save theSoberSobber/d42a4b514a25ca47a0bf612deab036d1 to your computer and use it in GitHub Desktop.

Select an option

Save theSoberSobber/d42a4b514a25ca47a0bf612deab036d1 to your computer and use it in GitHub Desktop.
Minimal Shareable URL notepad created for testing exe.dev: https://kernel-griffin.exe.xyz/
<html>
<head>
<title>Notepad</title>
<style>
#txt {
width: 100%;
height: 60%;
}
#cpy {
width: 100%;
height: 10%;
}
</style>
</head>
<body>
<div>
<textarea id="txt"></textarea>
<button id="cpy">Copy Shareable URL</button>
</div>
</body>
<script>
txt.focus();
const contentParam = "b64content";
const debounceTime = 1; // seconds
const revertCpyButtonColorTime = 3; // seconds
// encoder/decoder are just b64 encoder and decoders
const decoder = atob;
const encoder = btoa;
if(window.location.search.includes(contentParam)){
let params = window.location.search.replace("?", "").split("=");
let val = "";
for(let i in params){
if(params[i]==contentParam){
try {
val = decoder(params[i-'0'+1]);
} catch (e){
val = "the b64 you got in the url was invalid dawg..."
}
break;
}
}
txt.value = val;
}
let old = null;
txt.addEventListener("keyup", () => {
if(old!=null) clearTimeout(old);
old = setTimeout(doUrlStuff, debounceTime*1000);
})
const doUrlStuff = () => {
window.location = `${window.location.pathname}?${contentParam}=${encoder(txt.value)}`;
};
// copy button
let tmp = null;
cpy.onclick = () => {
if(tmp!=null) clearTimeout(tmp);
navigator.clipboard.writeText(window.location.href)
cpy.style.backgroundColor = "green";
cpy.textContent = "Copied!";
tmp = setTimeout(() => {
cpy.textContent = "Copy Shareable URL";
cpy.style.backgroundColor = "";
}, revertCpyButtonColorTime*1000);
};
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment