Update conversations.php
This commit is contained in:
+9
-2
@@ -712,7 +712,11 @@
|
|||||||
const icon = type === 'success' ? '✅' : (type === 'danger' ? '⚠️' : (type === 'warning' ? '⚠' : 'ℹ️'));
|
const icon = type === 'success' ? '✅' : (type === 'danger' ? '⚠️' : (type === 'warning' ? '⚠' : 'ℹ️'));
|
||||||
toast.innerHTML = `<span class="nt-icon">${icon}</span><div style="flex:1; font-size:13px">${message}</div>`;
|
toast.innerHTML = `<span class="nt-icon">${icon}</span><div style="flex:1; font-size:13px">${message}</div>`;
|
||||||
container.appendChild(toast);
|
container.appendChild(toast);
|
||||||
setTimeout(() => { if (toast.parentNode) toast.remove(); }, type === 'success' ? 4000 : 8000);
|
// Ensure a sensible minimum duration (3s) so very short toasts don't disappear instantly
|
||||||
|
const _minToastDuration = 3000;
|
||||||
|
let _dur = (type === 'success') ? 4000 : 8000;
|
||||||
|
_dur = Math.max(_dur, _minToastDuration);
|
||||||
|
setTimeout(() => { if (toast.parentNode) toast.remove(); }, _dur);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// fallback to alert if DOM fails
|
// fallback to alert if DOM fails
|
||||||
try { alert(message); } catch (e2) { /* ignore */ }
|
try { alert(message); } catch (e2) { /* ignore */ }
|
||||||
@@ -839,7 +843,10 @@
|
|||||||
container.appendChild(toast);
|
container.appendChild(toast);
|
||||||
|
|
||||||
// Auto remove (shorter for compact notifications)
|
// Auto remove (shorter for compact notifications)
|
||||||
const timeout = notification.cool ? 15000 : 8000;
|
const _minToastDuration = 3000;
|
||||||
|
let timeout = notification.duration ? Number(notification.duration) : (notification.cool ? 15000 : 8000);
|
||||||
|
if (!isFinite(timeout) || timeout <= 0) timeout = (notification.cool ? 15000 : 8000);
|
||||||
|
timeout = Math.max(timeout, _minToastDuration);
|
||||||
setTimeout(() => { if (toast.parentNode) toast.remove(); }, timeout);
|
setTimeout(() => { if (toast.parentNode) toast.remove(); }, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user