Scripts/resources/[ps]/ps-ui/html/js/notify.js

21 lines
636 B
JavaScript
Raw Permalink Normal View History

2024-12-29 20:28:24 +00:00
window.addEventListener('message', function (event) {
switch(event.data.action) {
default:
Notify(event.data);
break;
}
});
function Notify(data) {
var $notification = $('.notification.template').clone();
$notification.removeClass('template');
$notification.addClass(data.type);
$notification.html(data.text);
$notification.fadeIn();
$('.notif-container').append($notification);
setTimeout(function() {
$.when($notification.fadeOut()).done(function() {
$notification.remove()
});
}, data.length === undefined ? data.length : 2500);
}