From a925dd38ad8a51dbf443506b0772150a5cef0799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 15 Jul 2020 00:47:27 +0200 Subject: Repair jump to date. --- module/output/html.scm | 2 +- static/script.js | 6 +++--- static/style.css | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/module/output/html.scm b/module/output/html.scm index acc93c0e..2d113b35 100644 --- a/module/output/html.scm +++ b/module/output/html.scm @@ -737,7 +737,7 @@ [else ""])) "idag")) - (div (@ (class "jump-to")) + (div (@ (id "jump-to")) ;; Firefox's accessability complain about each date ;; component, meaning that it's broken. This label ;; is for the whole input, which can be enabled diff --git a/static/script.js b/static/script.js index 6870819b..822b60c2 100644 --- a/static/script.js +++ b/static/script.js @@ -493,8 +493,7 @@ window.onload = function () { form updates. */ - let jumpto = document.getElementsByClassName("jump-to")[0]; - let gotodatebtn = jumpto.getElementsByTagName("button")[0]; + let gotodatebtn = document.querySelector("#jump-to .btn"); let target_href = (new Date).format("%Y-%m-%d") + ".html"; let golink = makeElement('a', { className: 'btn', @@ -504,8 +503,9 @@ window.onload = function () { document.getElementById("today-button").href = target_href; gotodatebtn.replaceWith(golink); - jumpto.getElementsByTagName("input")[0].onchange = function () { + document.querySelector("#jump-to input[name='date']").onchange = function () { let date = this.valueAsDate.format("%Y-%m-%d"); + console.log(date); golink.href = date + ".html"; } diff --git a/static/style.css b/static/style.css index abb4f8c7..a413ce83 100644 --- a/static/style.css +++ b/static/style.css @@ -108,16 +108,16 @@ html, body { padding-bottom: 1ex; } -.jump-to > form { +#jump-to > form { display: flex; } -.jump-to input { +#jump-to input { flex-grow: 2; margin-right: 1em; } -.jump-to button, .jump-to a { +#jump-to button, #jump-to a { /* Same as height, figure out way to force this */ width: 2.5em; } -- cgit v1.2.3