mirror of
				https://github.com/arcan1s/ahriman.git
				synced 2025-10-31 05:43:41 +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"; | ||||
|  | ||||
| @ -1,4 +1,5 @@ | ||||
| <script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js" crossorigin="anonymous" type="application/javascript"></script> | ||||
| <script src="https://cdn.jsdelivr.net/npm/jquery.md5@1.0.2/index.min.js" crossorigin="anonymous" type="application/javascript"></script> | ||||
|  | ||||
| <script src="https://cdn.jsdelivr.net/npm/moment@2.29.4/moment.min.js" crossorigin="anonymous" type="application/javascript"></script> | ||||
| <script src="https://cdn.jsdelivr.net/npm/daterangepicker@3.1.0/daterangepicker.min.js" crossorigin="anonymous" type="application/javascript"></script> | ||||
|  | ||||
		Reference in New Issue
	
	Block a user