mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 16:35:47 +01:00
if same id is used it replaces the current alerts contents
This commit is contained in:
@@ -55,7 +55,7 @@ var socket,
|
||||
title: 'Disconnect',
|
||||
message: 'You have disconnected from NodeBB, we will try to reconnect!',
|
||||
type: 'error',
|
||||
timeout: 1000
|
||||
timeout: 5000
|
||||
});
|
||||
});
|
||||
|
||||
@@ -113,16 +113,27 @@ var socket,
|
||||
// timeout default = permanent
|
||||
// location : notification_window (default) or content
|
||||
app.alert = function(params) {
|
||||
|
||||
|
||||
var alert_id = 'alert_button_' + ((params.alert_id) ? params.alert_id : new Date().getTime());
|
||||
|
||||
var alert = $('#'+alert_id);
|
||||
|
||||
if(alert.length > 0) {
|
||||
alert.find('strong').html(params.title);
|
||||
alert.find('p').html(params.message);
|
||||
alert.attr('class', "alert toaster-alert " + ((params.type=='warning') ? '' : "alert-" + params.type));
|
||||
}
|
||||
else {
|
||||
|
||||
var div = document.createElement('div'),
|
||||
button = document.createElement('button'),
|
||||
strong = document.createElement('strong'),
|
||||
p = document.createElement('p');
|
||||
|
||||
var alert_id = 'alert_button_' + ((params.alert_id) ? params.alert_id : new Date().getTime());
|
||||
|
||||
jQuery('#'+alert_id).fadeOut(500, function() {
|
||||
/*jQuery('#'+alert_id).fadeOut(500, function() {
|
||||
this.remove();
|
||||
});
|
||||
});*/
|
||||
|
||||
p.innerHTML = params.message;
|
||||
strong.innerHTML = params.title;
|
||||
@@ -140,7 +151,8 @@ var socket,
|
||||
div.parentNode.removeChild(div);
|
||||
}
|
||||
|
||||
if (params.location == null) params.location = 'notification_window';
|
||||
if (params.location == null)
|
||||
params.location = 'notification_window';
|
||||
|
||||
jQuery('#'+params.location).prepend(jQuery(div).fadeIn('100'));
|
||||
|
||||
@@ -161,6 +173,7 @@ var socket,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var post_window = null,
|
||||
submit_post_btn = null,
|
||||
|
||||
Reference in New Issue
Block a user