Optimisations and updated readme

This commit is contained in:
2026-07-14 12:50:52 +01:00
parent 9709457b73
commit ff23474a54
33 changed files with 3073 additions and 2426 deletions
-48
View File
@@ -25,54 +25,6 @@
var editorInstances = new Map();
var submitting = false;
function dismissToast(toast) {
if (!toast) {
return;
}
toast.classList.add('toast-hide');
window.setTimeout(function () {
if (toast && toast.parentNode) {
toast.parentNode.removeChild(toast);
}
}, 220);
}
function showToast(message) {
var text = String(message || '').trim();
if (!text) {
return;
}
var existingToast = document.getElementById('app-toast');
var existingBody = existingToast ? existingToast.querySelector('.toast-body') : null;
if (existingToast && existingBody) {
existingBody.textContent = text;
existingToast.classList.remove('toast-hide');
window.clearTimeout(existingToast._dismissTimer);
existingToast._dismissTimer = window.setTimeout(function () {
dismissToast(existingToast);
}, 4000);
return;
}
var toast = document.createElement('div');
toast.className = 'toast';
toast.setAttribute('role', 'status');
toast.setAttribute('aria-live', 'polite');
toast.innerHTML = '<div class="toast-body"></div><button type="button" class="toast-close" aria-label="Dismiss notification">×</button>';
toast.querySelector('.toast-body').textContent = text;
var closeButton = toast.querySelector('.toast-close');
closeButton.addEventListener('click', function () {
dismissToast(toast);
});
document.body.appendChild(toast);
toast._dismissTimer = window.setTimeout(function () {
dismissToast(toast);
}, 4000);
}
function escapeHtml(value) {
return String(value ?? '')
.replace(/&/g, '&amp;')