Clear AJAX loader in correct state only

This commit is contained in:
Jakub Vrana 2011-03-11 22:09:54 +01:00
parent 15ab4d28a7
commit a8df780fe0

View file

@ -249,11 +249,7 @@ function ajax(url, callback, data) {
if (title) {
document.title = decodeURIComponent(title);
}
if (xmlhttp.status) {
callback(xmlhttp.responseText);
} else {
setHtml('loader', '');
}
callback(xmlhttp.status ? xmlhttp.responseText : undefined);
}
};
xmlhttp.send(data);
@ -287,10 +283,13 @@ function ajaxSend(url, data, popState) {
setHtml('loader', '<img src="../adminer/static/loader.gif" alt="">');
return ajax(url, function (text) {
if (currentState == ajaxState) {
if (text === undefined) {
setHtml('loader', '');
} else {
if (!popState) {
history.pushState(data, '', url);
}
scrollTo(0, 0);
}
setHtml('content', text);
var content = document.getElementById('content');
var scripts = content.getElementsByTagName('script');
@ -321,6 +320,7 @@ function ajaxSend(url, data, popState) {
jush.highlight_tag('code', 0);
}
}
}
}, data);
}