Merge pull request #769 from mouse-reeve/fixes-js

Fixes loading javascript listeners
This commit is contained in:
Mouse Reeve 2021-03-19 16:06:07 -07:00 committed by GitHub
commit cafadbf2c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 24 deletions

View file

@ -1,11 +1,4 @@
// Toggle all checkboxes.
window.onload = function() {
document
.querySelectorAll('[data-action="toggle-all"]')
.forEach(input => {
input.addEventListener('change', toggleAllCheckboxes);
});
};
/**
* Toggle all descendant checkboxes of a target.

View file

@ -1,14 +1,4 @@
// set javascript listeners
window.onload = function() {
// display based on localstorage vars
document.querySelectorAll('[data-hide]')
.forEach(t => setDisplay(t));
// update localstorage
Array.from(document.getElementsByClassName('set-display'))
.forEach(t => t.onclick = updateDisplay);
};
function updateDisplay(e) {
// used in set reading goal
var key = e.target.getAttribute('data-id');

View file

@ -23,6 +23,24 @@ window.onload = function() {
// browser back behavior
document.querySelectorAll('[data-back]')
.forEach(t => t.onclick = back);
Array.from(document.getElementsByClassName('tab-group'))
.forEach(t => new TabGroup(t));
// display based on localstorage vars
document.querySelectorAll('[data-hide]')
.forEach(t => setDisplay(t));
// update localstorage
Array.from(document.getElementsByClassName('set-display'))
.forEach(t => t.onclick = updateDisplay);
// Toggle all checkboxes.
document
.querySelectorAll('[data-action="toggle-all"]')
.forEach(input => {
input.addEventListener('change', toggleAllCheckboxes);
});
};
function back(e) {

View file

@ -1,10 +1,3 @@
// tab groups
window.onload = function() {
Array.from(document.getElementsByClassName('tab-group'))
.forEach(t => new TabGroup(t));
};
/*
* The content below is licensed according to the W3C Software License at
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document