From 2bef9425fb249b015f6046b71f1d26cceda279d1 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 30 Oct 2020 13:10:26 -0400 Subject: Simplify & fix bugs with select all functionality --- themes/alps/assets/helpers.js | 32 +++++++++----------------------- themes/alps/mailbox.html | 19 ------------------- themes/alps/messages-header.html | 2 +- 3 files changed, 10 insertions(+), 43 deletions(-) (limited to 'themes/alps') diff --git a/themes/alps/assets/helpers.js b/themes/alps/assets/helpers.js index 344dd17..902fd00 100644 --- a/themes/alps/assets/helpers.js +++ b/themes/alps/assets/helpers.js @@ -1,24 +1,10 @@ -(function() { - var sheet = document.styleSheets[0]; - var addCSSRule = function(selector, rules, index) { - if ("insertRule" in sheet) { - sheet.insertRule(selector + "{" + rules + "}", index); - return; +const check_all = document.getElementById("action-checkbox-all"); +if (check_all) { + check_all.style.display = "inherit"; + check_all.addEventListener("click", ev => { + const inputs = document.querySelectorAll(".message-list-checkbox input"); + for (let i = 0; i < inputs.length; i++) { + inputs[i].checked = ev.target.checked; } - if ("addRule" in sheet) { - sheet.addRule(selector, rules, index); - } - }; - - var checkboxAll = document.getElementById("action-checkbox-all"); - if (checkboxAll) { - addCSSRule(".message-list-checkbox", "display: table-cell !important;"); - checkboxAll.addEventListener("click", function(ev) { - var allChecked = this.checked; - var inputs = document.querySelectorAll("tr .message-list-checkbox input"); - Array.prototype.slice.apply().forEach(function(cb) { - cb.checked = allChecked; - }); - }); - } -})(); + }); +} diff --git a/themes/alps/mailbox.html b/themes/alps/mailbox.html index db029eb..60cc978 100644 --- a/themes/alps/mailbox.html +++ b/themes/alps/mailbox.html @@ -2,25 +2,6 @@ {{template "nav.html" .}} {{template "util.html" .}} -{{ define "mbox-link" }} -{{ if not (.HasAttr "\\Noselect") }} - - {{- if eq .Name "INBOX" -}} - Inbox - {{- else -}} - {{ .Name }} - {{- end -}} - {{- if .HasAttr "\\HasChildren" }}/{{ end }} - - {{ if and (ne .Unseen -1) (ne .Unseen 0) }}({{ .Unseen }}){{ end }} - -{{ else }} - - {{.Name}}{{- if .HasAttr "\\HasChildren" }}/{{ end }} - -{{ end }} -{{ end }} -
{{ template "aside" . }}
diff --git a/themes/alps/messages-header.html b/themes/alps/messages-header.html index dadf8e1..13e4872 100644 --- a/themes/alps/messages-header.html +++ b/themes/alps/messages-header.html @@ -1,5 +1,5 @@
- +
-- cgit v1.2.3