|
@@ -31,7 +31,7 @@ function UINotification(options){
|
|
h += html_encode(options.content);
|
|
h += html_encode(options.content);
|
|
h += `</div>`;
|
|
h += `</div>`;
|
|
|
|
|
|
- $('body').append(h);
|
|
|
|
|
|
+ $('.notification-container').prepend(h);
|
|
|
|
|
|
|
|
|
|
const el_notification = document.getElementById(`ui-notification__${window.global_element_id}`);
|
|
const el_notification = document.getElementById(`ui-notification__${window.global_element_id}`);
|
|
@@ -44,21 +44,7 @@ function UINotification(options){
|
|
})
|
|
})
|
|
|
|
|
|
// Show Notification
|
|
// Show Notification
|
|
- $(el_notification).delay(100).show(0).
|
|
|
|
- // In the right position (the mouse)
|
|
|
|
- css({
|
|
|
|
- top: window.toolbar_height + 15,
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- // if there are other older notifications, move them down
|
|
|
|
- if(window.active_notifs.length > 1){
|
|
|
|
- let older_notifs = $('.notification').not(el_notification);
|
|
|
|
- for(let i = 0; i < older_notifs.length; i++){
|
|
|
|
- let el = older_notifs[i];
|
|
|
|
- let top = parseInt($(el).css('top'));
|
|
|
|
- $(el).animate({'top': top + 65});
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ $(el_notification).delay(100).show(0);
|
|
return el_notification;
|
|
return el_notification;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -82,24 +68,11 @@ $(document).on('click', '.notification-close', function(e){
|
|
window.close_notification = function(el_notification){
|
|
window.close_notification = function(el_notification){
|
|
$(el_notification).addClass('animate__fadeOutRight');
|
|
$(el_notification).addClass('animate__fadeOutRight');
|
|
|
|
|
|
- // move up older notifications up
|
|
|
|
- if(window.active_notifs.length > 1){
|
|
|
|
- // get older notif ids from the active_notifs array
|
|
|
|
- let older_notifs = window.active_notifs.filter(function(id){
|
|
|
|
- return id < parseInt($(el_notification).data('id'));
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- // move older notifications up
|
|
|
|
- for(let i = 0; i < older_notifs.length; i++){
|
|
|
|
- let el = $(`#ui-notification__${older_notifs[i]}`);
|
|
|
|
- let top = parseInt($(el).css('top'));
|
|
|
|
- $(el).animate({'top': top - 65}, 10);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
// remove notification
|
|
// remove notification
|
|
setTimeout(function(){
|
|
setTimeout(function(){
|
|
$(el_notification).remove();
|
|
$(el_notification).remove();
|
|
- }, 500);
|
|
|
|
|
|
+ }, 300);
|
|
}
|
|
}
|
|
|
|
|
|
export default UINotification;
|
|
export default UINotification;
|