V. 2.1.0 - Yohns Fork

This commit is contained in:
Yohn 2024-11-27 00:38:59 -05:00
parent b611b528bc
commit 42b62b10a6
10 changed files with 66 additions and 38 deletions

20
docs/js/Notifications.js Normal file
View file

@ -0,0 +1,20 @@
function showNotification(options = {}) {
const dialog = document.querySelector("dialog[role='alert']");
if (options.text || typeof options === "string") {
dialog.innerText = options.text || options;
} else if (options.html) {
dialog.innerHTML = options.html;
}
dialog.showModal();
setTimeout(() => {
dialog.close();
}, options.delay || 3000);
}
function closeNotification() {
const dialog = document.querySelector("dialog[role='alert']");
dialog.close();
}