mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-15 06:55:48 +00:00
feat: remove duplicates from the toast
This commit is contained in:
@ -1,8 +1,12 @@
|
||||
<script>
|
||||
const alertPlaceholder = $("#alert-placeholder");
|
||||
|
||||
function createAlert(title, message, clz, action) {
|
||||
function createAlert(title, message, clz, action, id) {
|
||||
if (!id) id = $.md5(title + message); // MD5 id from the content
|
||||
if (alertPlaceholder.find(`#${id}`).length > 0) return; // check if there are duplicates
|
||||
|
||||
const wrapper = document.createElement("div");
|
||||
wrapper.id = id;
|
||||
wrapper.classList.add("toast", clz);
|
||||
wrapper.role = "alert";
|
||||
wrapper.ariaLive = "assertive";
|
||||
|
Reference in New Issue
Block a user