diff options
author | Gibheer <gibheer+git@zero-knowledge.org> | 2019-01-24 11:26:26 +0100 |
---|---|---|
committer | Gibheer <gibheer+git@zero-knowledge.org> | 2019-01-24 11:26:26 +0100 |
commit | 18e4ba6ae4ddd59088f0603b67c2a84190f23a64 (patch) | |
tree | b74199ef5e525097422708f9fbb3b381d911beed /cmd/monfront | |
parent | e8e67f091a7588a68f858a1e7284fbd876377cf0 (diff) |
monfront - add line select
As in #7 requested, it is now possible to select a row by clicking on
the row itself. This should make it much easier to select a larger
number of rows.
Diffstat (limited to 'cmd/monfront')
-rw-r--r-- | cmd/monfront/main.go | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/cmd/monfront/main.go b/cmd/monfront/main.go index 3445942..8518bd4 100644 --- a/cmd/monfront/main.go +++ b/cmd/monfront/main.go @@ -568,8 +568,6 @@ var ( #mainmenu a:hover, #mainmenu a:active { color: #eeeeee; } #mainmenu ul ul a { margin-left: 0.5em; } #mainmenu form * { display: block; margin: 0.25em 0.5em; } - #mainmenu form input { } - #mainmenu form button { } form section { display: flex; flex-direction: row; @@ -638,7 +636,26 @@ var ( </ul> </nav> {{ if .Error }}<div class="error">{{ .Error }}</div>{{ end }}`, - "footer": `</body></html>`, + "footer": `<script> + function select_row(event) { + if (event.target.nodeName == 'INPUT') { + return; + } + for (i = 0; i < event.path.length; i++) { + if (event.path[i].nodeName != 'TR') { + continue; + } + e = event.path[i].children[0].children[0]; + e.checked = !e.checked; + e.focus(); + break; + } + } + + els = document.getElementsByTagName('tr'); + for (i = 0; i < els.length; i++) { + els[i].addEventListener('click', {handleEvent: select_row}); + }</script></body></html>`, "checklist": `{{ template "header" . }} <form method="post" action="/action"> <section> |