Rename variable
This commit is contained in:
parent
7f2e97f0d2
commit
d35f83fb8d
|
@ -195,9 +195,9 @@ function selectAddRow(field) {
|
||||||
function bodyKeydown(event, button) {
|
function bodyKeydown(event, button) {
|
||||||
var target = event.target || event.srcElement;
|
var target = event.target || event.srcElement;
|
||||||
if (event.keyCode == 27 && !event.shiftKey && !event.ctrlKey && !event.altKey && !event.metaKey) { // 27 - Esc
|
if (event.keyCode == 27 && !event.shiftKey && !event.ctrlKey && !event.altKey && !event.metaKey) { // 27 - Esc
|
||||||
ajaxXmlhttp.aborted = true;
|
ajaxRequest.aborted = true;
|
||||||
if (ajaxXmlhttp.abort) {
|
if (ajaxRequest.abort) {
|
||||||
ajaxXmlhttp.abort();
|
ajaxRequest.abort();
|
||||||
}
|
}
|
||||||
document.body.className = document.body.className.replace(/ loading/g, '');
|
document.body.className = document.body.className.replace(/ loading/g, '');
|
||||||
onblur = function () { };
|
onblur = function () { };
|
||||||
|
@ -266,21 +266,21 @@ function functionChange(select) {
|
||||||
* @return XMLHttpRequest or false in case of an error
|
* @return XMLHttpRequest or false in case of an error
|
||||||
*/
|
*/
|
||||||
function ajax(url, callback, data) {
|
function ajax(url, callback, data) {
|
||||||
var xmlhttp = (window.XMLHttpRequest ? new XMLHttpRequest() : (window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : false));
|
var request = (window.XMLHttpRequest ? new XMLHttpRequest() : (window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : false));
|
||||||
if (xmlhttp) {
|
if (request) {
|
||||||
xmlhttp.open((data ? 'POST' : 'GET'), url);
|
request.open((data ? 'POST' : 'GET'), url);
|
||||||
if (data) {
|
if (data) {
|
||||||
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||||
}
|
}
|
||||||
xmlhttp.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
request.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||||
xmlhttp.onreadystatechange = function () {
|
request.onreadystatechange = function () {
|
||||||
if (xmlhttp.readyState == 4) {
|
if (request.readyState == 4) {
|
||||||
callback(xmlhttp);
|
callback(request);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xmlhttp.send(data);
|
request.send(data);
|
||||||
}
|
}
|
||||||
return xmlhttp;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Use setHtml(key, value) for JSON response
|
/** Use setHtml(key, value) for JSON response
|
||||||
|
@ -288,9 +288,9 @@ function ajax(url, callback, data) {
|
||||||
* @return XMLHttpRequest or false in case of an error
|
* @return XMLHttpRequest or false in case of an error
|
||||||
*/
|
*/
|
||||||
function ajaxSetHtml(url) {
|
function ajaxSetHtml(url) {
|
||||||
return ajax(url, function (xmlhttp) {
|
return ajax(url, function (request) {
|
||||||
if (xmlhttp.status) {
|
if (request.status) {
|
||||||
var data = eval('(' + xmlhttp.responseText + ')');
|
var data = eval('(' + request.responseText + ')');
|
||||||
for (var key in data) {
|
for (var key in data) {
|
||||||
setHtml(key, data[key]);
|
setHtml(key, data[key]);
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ function replaceFavicon(href) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var ajaxState = 0;
|
var ajaxState = 0;
|
||||||
var ajaxXmlhttp = {};
|
var ajaxRequest = {};
|
||||||
|
|
||||||
/** Safely load content to #content
|
/** Safely load content to #content
|
||||||
* @param string
|
* @param string
|
||||||
|
@ -325,9 +325,9 @@ function ajaxSend(url, data, popState, noscroll) {
|
||||||
if (!history.pushState) {
|
if (!history.pushState) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ajaxXmlhttp.aborted = true;
|
ajaxRequest.aborted = true;
|
||||||
if (ajaxXmlhttp.abort) {
|
if (ajaxRequest.abort) {
|
||||||
ajaxXmlhttp.abort();
|
ajaxRequest.abort();
|
||||||
}
|
}
|
||||||
var currentState = ++ajaxState;
|
var currentState = ++ajaxState;
|
||||||
onblur = function () {
|
onblur = function () {
|
||||||
|
@ -337,13 +337,13 @@ function ajaxSend(url, data, popState, noscroll) {
|
||||||
replaceFavicon(document.getElementById('loader').firstChild.src);
|
replaceFavicon(document.getElementById('loader').firstChild.src);
|
||||||
};
|
};
|
||||||
document.body.className += ' loading';
|
document.body.className += ' loading';
|
||||||
ajaxXmlhttp = ajax(url, function (xmlhttp) {
|
ajaxRequest = ajax(url, function (request) {
|
||||||
if (!xmlhttp.aborted && currentState == ajaxState) {
|
if (!request.aborted && currentState == ajaxState) {
|
||||||
var title = xmlhttp.getResponseHeader('X-AJAX-Title');
|
var title = request.getResponseHeader('X-AJAX-Title');
|
||||||
if (title) {
|
if (title) {
|
||||||
document.title = decodeURIComponent(title);
|
document.title = decodeURIComponent(title);
|
||||||
}
|
}
|
||||||
var redirect = xmlhttp.getResponseHeader('X-AJAX-Redirect');
|
var redirect = request.getResponseHeader('X-AJAX-Redirect');
|
||||||
if (redirect) {
|
if (redirect) {
|
||||||
return ajaxSend(redirect, '', popState);
|
return ajaxSend(redirect, '', popState);
|
||||||
}
|
}
|
||||||
|
@ -359,7 +359,7 @@ function ajaxSend(url, data, popState, noscroll) {
|
||||||
if (!noscroll && !/&order/.test(url)) {
|
if (!noscroll && !/&order/.test(url)) {
|
||||||
scrollTo(0, 0);
|
scrollTo(0, 0);
|
||||||
}
|
}
|
||||||
setHtml('content', (xmlhttp.status ? xmlhttp.responseText : '<p class="error">' + noResponse));
|
setHtml('content', (request.status ? request.responseText : '<p class="error">' + noResponse));
|
||||||
document.body.className = document.body.className.replace(/ loading/g, '');
|
document.body.className = document.body.className.replace(/ loading/g, '');
|
||||||
var content = document.getElementById('content');
|
var content = document.getElementById('content');
|
||||||
var scripts = content.getElementsByTagName('script');
|
var scripts = content.getElementsByTagName('script');
|
||||||
|
@ -387,7 +387,7 @@ function ajaxSend(url, data, popState, noscroll) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, data);
|
}, data);
|
||||||
return ajaxXmlhttp;
|
return ajaxRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Revive page from history
|
/** Revive page from history
|
||||||
|
@ -475,9 +475,9 @@ function selectDblClick(td, event, text) {
|
||||||
td.appendChild(input);
|
td.appendChild(input);
|
||||||
input.focus();
|
input.focus();
|
||||||
if (text == 2) { // long text
|
if (text == 2) { // long text
|
||||||
return ajax(location.href + '&' + encodeURIComponent(td.id) + '=', function (xmlhttp) {
|
return ajax(location.href + '&' + encodeURIComponent(td.id) + '=', function (request) {
|
||||||
if (xmlhttp.status) {
|
if (request.status) {
|
||||||
input.value = xmlhttp.responseText;
|
input.value = request.responseText;
|
||||||
input.name = td.id;
|
input.name = td.id;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue