mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-29 13:01:08 +00:00
Merge pull request #769 from mouse-reeve/fixes-js
Fixes loading javascript listeners
This commit is contained in:
commit
cafadbf2c6
4 changed files with 18 additions and 24 deletions
|
@ -1,11 +1,4 @@
|
||||||
// Toggle all checkboxes.
|
// 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.
|
* Toggle all descendant checkboxes of a target.
|
||||||
|
|
|
@ -1,14 +1,4 @@
|
||||||
// set javascript listeners
|
// 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) {
|
function updateDisplay(e) {
|
||||||
// used in set reading goal
|
// used in set reading goal
|
||||||
var key = e.target.getAttribute('data-id');
|
var key = e.target.getAttribute('data-id');
|
||||||
|
|
|
@ -23,6 +23,24 @@ window.onload = function() {
|
||||||
// browser back behavior
|
// browser back behavior
|
||||||
document.querySelectorAll('[data-back]')
|
document.querySelectorAll('[data-back]')
|
||||||
.forEach(t => t.onclick = 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) {
|
function back(e) {
|
||||||
|
|
|
@ -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
|
* The content below is licensed according to the W3C Software License at
|
||||||
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
|
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
|
||||||
|
|
Loading…
Reference in a new issue