Improved the PMA_ajaxShowMessage() function. Now, multiple messages

won't be seen at the same time
This commit is contained in:
ninadsp
2010-06-15 15:16:32 +05:30
parent 0f081a8437
commit d2c6e1c5e3

View File

@@ -15,6 +15,12 @@ var sql_box_locked = false;
*/ */
var only_once_elements = new Array(); var only_once_elements = new Array();
/**
* @var ajax_notification_visible boolean boolean that stores status of
* notification for PMA_ajaxShowNotification
*/
var ajax_message_init = false;
/** /**
* selects the content of a given object, f.e. a textarea * selects the content of a given object, f.e. a textarea
* *
@@ -1735,6 +1741,7 @@ function PMA_ajaxInsertResponse(divisions_map) {
*/ */
function PMA_ajaxShowMessage(message, timeout) { function PMA_ajaxShowMessage(message, timeout) {
if(!message) { if(!message) {
var msg = 'Loading...'; var msg = 'Loading...';
} }
@@ -1749,16 +1756,28 @@ function PMA_ajaxShowMessage(message, timeout) {
var to = timeout; var to = timeout;
} }
$(function(){ if( !ajax_message_init) {
$('<span id="loading" class="ajax_notification"></span>') $(function(){
.insertBefore("#serverinfo") $('<span id="loading" class="ajax_notification"></span>')
.text(msg) .insertBefore("#serverinfo")
.html(msg)
.slideDown('medium')
.delay(to)
.slideUp('medium', function(){
$(this).html(""); //Clear the message
});
}, 'top.frame_content');
ajax_message_init = true;
}
else {
$("#loading")
.html(msg)
.slideDown('medium') .slideDown('medium')
.delay(to) .delay(to)
.slideUp('medium', function(){ .slideUp('medium', function() {
$(this).remove(); $(this).html("");
}); })
}, 'top.frame_content') }
} }
/** /**