Save bytes
This commit is contained in:
parent
7eb85a75f8
commit
8d4b241156
|
@ -139,31 +139,26 @@ var ajaxTimeout;
|
||||||
* @return XMLHttpRequest or false in case of an error
|
* @return XMLHttpRequest or false in case of an error
|
||||||
*/
|
*/
|
||||||
function ajax(url) {
|
function ajax(url) {
|
||||||
var xmlhttp;
|
var xmlhttp = (window.XMLHttpRequest ? new XMLHttpRequest() : (window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : false));
|
||||||
if (window.XMLHttpRequest) {
|
if (xmlhttp) {
|
||||||
xmlhttp = new XMLHttpRequest();
|
var currentState = ++ajaxState;
|
||||||
} else if (window.ActiveXObject) {
|
clearTimeout(ajaxTimeout);
|
||||||
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
|
ajaxTimeout = setTimeout(function () {
|
||||||
} else {
|
setHtml('main', '<img src="../adminer/static/loader.gif" alt="">');
|
||||||
return false;
|
}, 1000); // defer displaying loader
|
||||||
}
|
xmlhttp.open('GET', url);
|
||||||
var currentState = ++ajaxState;
|
xmlhttp.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||||
clearTimeout(ajaxTimeout);
|
xmlhttp.onreadystatechange = function () {
|
||||||
ajaxTimeout = setTimeout(function () {
|
if (xmlhttp.readyState == 4 && currentState == ajaxState) {
|
||||||
setHtml('main', '<img src="../adminer/static/loader.gif" alt="">');
|
clearTimeout(ajaxTimeout);
|
||||||
}, 1000); // defer displaying loader
|
setHtml('main', xmlhttp.responseText);
|
||||||
xmlhttp.open('GET', url);
|
if (window.jush) {
|
||||||
xmlhttp.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
jush.highlight_tag('code');
|
||||||
xmlhttp.onreadystatechange = function () {
|
}
|
||||||
if (xmlhttp.readyState == 4 && currentState == ajaxState) {
|
|
||||||
clearTimeout(ajaxTimeout);
|
|
||||||
setHtml('main', xmlhttp.responseText);
|
|
||||||
if (window.jush) {
|
|
||||||
jush.highlight_tag('code');
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
xmlhttp.send('');
|
||||||
xmlhttp.send('');
|
}
|
||||||
return xmlhttp;
|
return xmlhttp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue