From: Michael D. Lowis Date: Thu, 30 Nov 2017 13:49:56 +0000 (-0500) Subject: added logic to set title to today's date X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=a98ef8e0780228e9f92329b36360d34935d9a33d;p=proto%2Fjournal.git added logic to set title to today's date --- diff --git a/editor.js b/editor.js index c89d1ad..5be7118 100644 --- a/editor.js +++ b/editor.js @@ -57,8 +57,27 @@ }, }; + const ymd_string = () => { + const date = new Date(); + const month = date.getMonth() + 1; + const day = date.getDate(); + return "" + + date.getFullYear() + "." + + (month > 9 ? '' : '0') + month + "." + + (day > 9 ? '' : '0') + day + }; + + header.onkeyup = (evnt) => { + document.title = header.innerText; + } + content.onkeydown = (evnt) => { const keyfn = keys[evnt.key]; return (keyfn ? keyfn(evnt) : true); } + + /* set the title to todays date */ + header.innerHTML = '

' + + ymd_string() + '


'; + document.title = header.innerText; })(); diff --git a/index.html b/index.html index 8e3c9b5..0e6f56b 100644 --- a/index.html +++ b/index.html @@ -4,14 +4,13 @@ Journal - +
-
-

- 2017.12.01 - - New Entry + @@ -33,20 +32,20 @@
  1. foo
-

table:

+

table:

- - - - - - - - - - - - + + + + + + + + + + + +
Header 1Header 2
Cell 1Cell 2
Header 1Header 2
Cell 1Cell 2

code block: