Merge branch 'upstream' into tab-keyboard-accessibility

This commit is contained in:
Ned Zimmerman
2021-02-27 11:53:27 -04:00
218 changed files with 7197 additions and 3530 deletions

View File

@ -31,15 +31,25 @@ window.onload = function() {
// polling
document.querySelectorAll('[data-poll]')
.forEach(el => polling(el));
// browser back behavior
document.querySelectorAll('[data-back]')
.forEach(t => t.onclick = back);
};
function polling(el) {
let delay = 10000 + (Math.random() * 1000);
function back(e) {
e.preventDefault();
history.back();
}
function polling(el, delay) {
delay = delay || 10000;
delay += (Math.random() * 1000);
setTimeout(function() {
fetch('/api/updates/' + el.getAttribute('data-poll'))
.then(response => response.json())
.then(data => updateCountElement(el, data));
polling(el);
polling(el, delay * 1.25);
}, delay, el);
}