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

Restore logic to avoid live poll on pages that don't have the button

This commit is contained in:
Mike Perham 2021-10-27 16:38:53 -07:00
parent 767217133e
commit 5e295b0a88

View file

@ -41,24 +41,27 @@ ready(() => {
updateFuzzyTimes();
document.querySelectorAll(".live-poll").forEach(node => {
node.addEventListener("click", event => {
if (localStorage.sidekiqLivePoll == "enabled") {
localStorage.sidekiqLivePoll = "disabled";
clearTimeout(livePollTimer);
livePollTimer = null;
} else {
localStorage.sidekiqLivePoll = "enabled";
livePollCallback();
}
var buttons = document.querySelectorAll(".live-poll");
if (buttons.length > 0) {
buttons.forEach(node => {
node.addEventListener("click", event => {
if (localStorage.sidekiqLivePoll == "enabled") {
localStorage.sidekiqLivePoll = "disabled";
clearTimeout(livePollTimer);
livePollTimer = null;
} else {
localStorage.sidekiqLivePoll = "enabled";
livePollCallback();
}
updateLivePollButton();
})
});
updateLivePollButton();
})
});
updateLivePollButton();
if (localStorage.sidekiqLivePoll == "enabled") {
scheduleLivePoll();
updateLivePollButton();
if (localStorage.sidekiqLivePoll == "enabled") {
scheduleLivePoll();
}
}
})