06/04 Optimize app
This commit is contained in:
@@ -345,9 +345,22 @@ document.getElementById('site-list').addEventListener('click', function(e) {
|
||||
|
||||
/* Undo */
|
||||
if (btn.classList.contains('js-undo')) {
|
||||
if (confirm('Remove check for ' + btn.dataset.name + '?')) {
|
||||
btn.closest('form').submit();
|
||||
}
|
||||
if (!confirm('Remove check for ' + btn.dataset.name + '?')) return;
|
||||
var siteName = btn.dataset.name;
|
||||
var formAction = btn.closest('form').action;
|
||||
btn.disabled = true;
|
||||
fetch(formAction, {
|
||||
method: 'POST', credentials: 'same-origin',
|
||||
headers: {'Content-Type': 'application/x-www-form-urlencoded', 'X-CSRFToken': getCsrfToken()},
|
||||
body: ''
|
||||
}).then(function() {
|
||||
var toast = document.createElement('div');
|
||||
toast.className = 'alert alert-info';
|
||||
toast.style.cssText = 'position:fixed;top:1rem;right:1rem;z-index:9999;min-width:220px;box-shadow:var(--shadow)';
|
||||
toast.textContent = '↩ Check removed for ' + siteName;
|
||||
document.body.appendChild(toast);
|
||||
setTimeout(function() { location.reload(); }, 700);
|
||||
});
|
||||
return;
|
||||
}
|
||||
});
|
||||
@@ -371,13 +384,6 @@ document.getElementById('modal-creds').addEventListener('click', function(e) {
|
||||
}
|
||||
});
|
||||
|
||||
/* ── HTML escape ───────────────────────────────────────────── */
|
||||
function esc(str) {
|
||||
return String(str || '').replace(/[&<>"']/g, function(c) {
|
||||
return {'&':'&','<':'<','>':'>','"':'"',"'":'''}[c];
|
||||
});
|
||||
}
|
||||
|
||||
/* ── Health dots — batched with max 4 concurrent requests ─── */
|
||||
(function() {
|
||||
var cards = Array.from(document.querySelectorAll('.site-card'));
|
||||
|
||||
Reference in New Issue
Block a user