From: Michael D. Lowis Date: Fri, 20 Jul 2018 16:41:09 +0000 (-0400) Subject: minor code cleanup X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=84c7da78902006af86b16a2ce4c11dff8e43961d;p=proto%2Fjournal.git minor code cleanup --- diff --git a/editor.js b/editor.js index 8fc031b..1b236e0 100644 --- a/editor.js +++ b/editor.js @@ -22,9 +22,8 @@ if (!!force) document.title = "", ls.clear(); if (doc.title === "") { - content.innerHTML = !!ls['content'] ? ls['content'] : "

 

"; - header.innerHTML = !!ls['header'] ? ls['header'] - : '

' + ymd_string() + '


' ; + content.innerHTML = ls['content'] || '

 

'; + header.innerHTML = ls['header'] || '

' + ymd_string() + '


' ; doc.title = header.innerText; } @@ -40,7 +39,7 @@ const ctrlHeld = (ev) => (ev.ctrlKey || ev.metaKey); const inTag = (tag) => (getSelNode().nodeName === tag); - const keyCmd = (ev, cmd, arg) => (ctrlHeld(ev) ? !doc.exec(cmd, false, arg) : true); + const keyCmd = (ev, cmd, arg) => !(ctrlHeld(ev) && doc.exec(cmd, false, arg)); const reinit = (ev) => { if (ctrlHeld(ev)) { initialize(true); diff --git a/index.html b/index.html index 93219d1..e7761f6 100644 --- a/index.html +++ b/index.html @@ -104,9 +104,8 @@ th:first-child, td:first-child { if (!!force) document.title = "", ls.clear(); if (doc.title === "") { - content.innerHTML = !!ls['content'] ? ls['content'] : "

 

"; - header.innerHTML = !!ls['header'] ? ls['header'] - : '

' + ymd_string() + '


' ; + content.innerHTML = ls['content'] || '

 

'; + header.innerHTML = ls['header'] || '

' + ymd_string() + '


' ; doc.title = header.innerText; } @@ -122,7 +121,7 @@ th:first-child, td:first-child { const ctrlHeld = (ev) => (ev.ctrlKey || ev.metaKey); const inTag = (tag) => (getSelNode().nodeName === tag); - const keyCmd = (ev, cmd, arg) => (ctrlHeld(ev) ? !doc.exec(cmd, false, arg) : true); + const keyCmd = (ev, cmd, arg) => !(ctrlHeld(ev) && doc.exec(cmd, false, arg)); //!ctrlHeld(ev) || !doc.exec(cmd, false, arg); const reinit = (ev) => { if (ctrlHeld(ev)) { initialize(true);