use first line as document title
This commit is contained in:
parent
a67b6032c5
commit
160fc55f12
3 changed files with 19 additions and 4 deletions
9
.editorconfig
Normal file
9
.editorconfig
Normal file
|
@ -0,0 +1,9 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
2
.replit
2
.replit
|
@ -1,2 +0,0 @@
|
|||
language = "html"
|
||||
run = ""
|
12
index.html
12
index.html
|
@ -1317,6 +1317,14 @@ return je}()
|
|||
;"object"==typeof exports&&"undefined"!=typeof module&&(module.exports=hljs);
|
||||
</script>
|
||||
<script>
|
||||
function updateCountAndTitle() {
|
||||
urlLengthDisplay.innerHTML = (''+window.location).length;
|
||||
if (main.firstChild && main.firstChild.innerText) {
|
||||
document.title = main.firstChild.innerText.split('\n')[0];
|
||||
} else {
|
||||
document.title = "MarkLink document-in-a-URL";
|
||||
}
|
||||
}
|
||||
var md = new window.markdownit({
|
||||
linkify:true,
|
||||
typographer: true,
|
||||
|
@ -1337,12 +1345,12 @@ return je}()
|
|||
var text = LZString.decompressFromEncodedURIComponent(window.location.hash.substr(1));
|
||||
raw.value = text;
|
||||
main.innerHTML = md.render(text);
|
||||
urlLengthDisplay.innerHTML = (''+window.location).length;
|
||||
updateCountAndTitle();
|
||||
}
|
||||
raw.oninput = function() {
|
||||
history.replaceState(null, null, "#"+LZString.compressToEncodedURIComponent(raw.value));
|
||||
main.innerHTML = md.render(raw.value);
|
||||
urlLengthDisplay.innerHTML = (''+window.location).length;
|
||||
updateCountAndTitle();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue