aboutsummaryrefslogtreecommitdiff
path: root/themes/alps/assets
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2020-10-30 13:10:26 -0400
committerDrew DeVault <sir@cmpwn.com>2020-10-30 13:10:26 -0400
commit2bef9425fb249b015f6046b71f1d26cceda279d1 (patch)
tree69e7ae0f9ec2ef9468db604043e3ff1cbce395f7 /themes/alps/assets
parent6a6ea3e63b89274bc70493835f6ba68918cad580 (diff)
downloadalps-2bef9425fb249b015f6046b71f1d26cceda279d1.tar.gz
alps-2bef9425fb249b015f6046b71f1d26cceda279d1.zip
Simplify & fix bugs with select all functionality
Diffstat (limited to 'themes/alps/assets')
-rw-r--r--themes/alps/assets/helpers.js32
1 files changed, 9 insertions, 23 deletions
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;
- });
- });
- }
-})();
+ });
+}