1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Add event listeners after reload (#5230)

* Add event listeners after reload. Fixes #5184

* Remove redundant fuzzy times update
This commit is contained in:
Chris Oliver 2022-03-04 11:35:02 -06:00 committed by GitHub
parent 5776c7ae87
commit fde3cde007
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,7 +9,9 @@ var ready = (callback) => {
else document.addEventListener("DOMContentLoaded", callback); else document.addEventListener("DOMContentLoaded", callback);
} }
ready(() => { ready(addListeners)
function addListeners() {
document.querySelectorAll(".check_all").forEach(node => { document.querySelectorAll(".check_all").forEach(node => {
node.addEventListener("click", event => { node.addEventListener("click", event => {
node.closest('table').querySelectorAll('input[type=checkbox]').forEach(inp => { inp.checked = !!node.checked; }); node.closest('table').querySelectorAll('input[type=checkbox]').forEach(inp => { inp.checked = !!node.checked; });
@ -61,7 +63,7 @@ ready(() => {
scheduleLivePoll(); scheduleLivePoll();
} }
} }
}) }
function updateFuzzyTimes() { function updateFuzzyTimes() {
var locale = document.body.getAttribute("data-locale"); var locale = document.body.getAttribute("data-locale");
@ -107,5 +109,5 @@ function replacePage(text) {
var header_status = doc.querySelector('.status') var header_status = doc.querySelector('.status')
document.querySelector('.status').replaceWith(header_status) document.querySelector('.status').replaceWith(header_status)
updateFuzzyTimes(); addListeners();
} }