mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-09-04 16:23:21 +00:00
feat(html): New Notify System
-Replaces old notification system but is also backwards compatible so no changes necessary - Now allows for the use of sending a table with text and caption - Can add as many types of notifications as wanted/needed - Configure position and icons in app,js (google icons or fontawesome)
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
window.addEventListener('message', function (event) {
|
||||
switch(event.data.action) {
|
||||
case 'show':
|
||||
ShowNotif(event.data);
|
||||
break;
|
||||
default:
|
||||
ShowNotif(event.data);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
function ShowNotif(data) {
|
||||
var $notification = $('.notification.template').clone();
|
||||
$notification.removeClass('template');
|
||||
$notification.addClass(data.type);
|
||||
$notification.html(data.text);
|
||||
$notification.fadeIn();
|
||||
$('.notif-container').prepend($notification);
|
||||
setTimeout(function() {
|
||||
$.when($notification.fadeOut(1500)).done(function() {
|
||||
$notification.remove()
|
||||
});
|
||||
}, data.length != null ? data.length : 2500);
|
||||
}
|
||||
Reference in New Issue
Block a user