Clear AJAX loader in correct state only
This commit is contained in:
parent
15ab4d28a7
commit
a8df780fe0
|
@ -249,11 +249,7 @@ function ajax(url, callback, data) {
|
||||||
if (title) {
|
if (title) {
|
||||||
document.title = decodeURIComponent(title);
|
document.title = decodeURIComponent(title);
|
||||||
}
|
}
|
||||||
if (xmlhttp.status) {
|
callback(xmlhttp.status ? xmlhttp.responseText : undefined);
|
||||||
callback(xmlhttp.responseText);
|
|
||||||
} else {
|
|
||||||
setHtml('loader', '');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xmlhttp.send(data);
|
xmlhttp.send(data);
|
||||||
|
@ -287,38 +283,42 @@ function ajaxSend(url, data, popState) {
|
||||||
setHtml('loader', '<img src="../adminer/static/loader.gif" alt="">');
|
setHtml('loader', '<img src="../adminer/static/loader.gif" alt="">');
|
||||||
return ajax(url, function (text) {
|
return ajax(url, function (text) {
|
||||||
if (currentState == ajaxState) {
|
if (currentState == ajaxState) {
|
||||||
if (!popState) {
|
if (text === undefined) {
|
||||||
history.pushState(data, '', url);
|
setHtml('loader', '');
|
||||||
}
|
} else {
|
||||||
scrollTo(0, 0);
|
if (!popState) {
|
||||||
setHtml('content', text);
|
history.pushState(data, '', url);
|
||||||
var content = document.getElementById('content');
|
scrollTo(0, 0);
|
||||||
var scripts = content.getElementsByTagName('script');
|
}
|
||||||
var length = scripts.length; // required to avoid infinite loop
|
setHtml('content', text);
|
||||||
for (var i=0; i < length; i++) {
|
var content = document.getElementById('content');
|
||||||
var script = document.createElement('script');
|
var scripts = content.getElementsByTagName('script');
|
||||||
script.text = scripts[i].text;
|
var length = scripts.length; // required to avoid infinite loop
|
||||||
content.appendChild(script);
|
for (var i=0; i < length; i++) {
|
||||||
}
|
var script = document.createElement('script');
|
||||||
|
script.text = scripts[i].text;
|
||||||
var as = document.getElementById('menu').getElementsByTagName('a');
|
content.appendChild(script);
|
||||||
var href = location.href.replace(/(&(sql=|dump=|(select|table)=[^&]*)).*/, '$1');
|
}
|
||||||
for (var i=0; i < as.length; i++) {
|
|
||||||
if (href == as[i].href) {
|
var as = document.getElementById('menu').getElementsByTagName('a');
|
||||||
as[i].className = 'active';
|
var href = location.href.replace(/(&(sql=|dump=|(select|table)=[^&]*)).*/, '$1');
|
||||||
} else if (as[i].className == 'active') {
|
for (var i=0; i < as.length; i++) {
|
||||||
as[i].className = '';
|
if (href == as[i].href) {
|
||||||
|
as[i].className = 'active';
|
||||||
|
} else if (as[i].className == 'active') {
|
||||||
|
as[i].className = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var dump = document.getElementById('dump');
|
||||||
|
if (dump) {
|
||||||
|
var match = /&(select|table)=([^&]+)/.exec(href);
|
||||||
|
dump.href = dump.href.replace(/[^=]+$/, '') + (match ? match[2] : '');
|
||||||
|
}
|
||||||
|
//! modify Change database hidden fields
|
||||||
|
|
||||||
|
if (window.jush) {
|
||||||
|
jush.highlight_tag('code', 0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
var dump = document.getElementById('dump');
|
|
||||||
if (dump) {
|
|
||||||
var match = /&(select|table)=([^&]+)/.exec(href);
|
|
||||||
dump.href = dump.href.replace(/[^=]+$/, '') + (match ? match[2] : '');
|
|
||||||
}
|
|
||||||
//! modify Change database hidden fields
|
|
||||||
|
|
||||||
if (window.jush) {
|
|
||||||
jush.highlight_tag('code', 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, data);
|
}, data);
|
||||||
|
|
Loading…
Reference in a new issue