Add a URL length counter

This commit is contained in:
Joshua Seigler 2020-12-03 15:50:46 +00:00
parent ef757d9a4e
commit 7848097c5c
2 changed files with 4 additions and 0 deletions

2
.replit Normal file
View file

@ -0,0 +1,2 @@
language = "html"
run = ""

View file

@ -37,6 +37,7 @@
<body>
<input type="radio" name="renderstyle" id="renderview" />
<input type="radio" name="renderstyle" id="renderedit" checked />
<span>URL length: <span id="urlLengthDisplay">0</span> characters</span>
<label class="view" for="renderedit">Edit</label>
<label class="edit" for="renderview">View</label>
<main class="view" id="main">
@ -55,6 +56,7 @@
raw.oninput = function() {
window.location.hash = LZString.compressToEncodedURIComponent(raw.value);
main.innerHTML = md.render(raw.value);
urlLengthDisplay.innerHTML = (''+window.location).length;
}
</script>
</body>