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:
parent
767217133e
commit
5e295b0a88
1 changed files with 19 additions and 16 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue