Hello. JP here, from the thetechtribe.
For the continuity of the investigation, can some IPBoard dev help me out to understand what is the purpose of the following snippet.
It is the ajax response in the uploads/javascript_global/root_library.js?v=37062bb1bf1709922374
$(document).ajaxSend(function(event, request, settings) {
if (!_.isUndefined(settings) && settings.showLoading === true) {
if (!$('#elAjaxLoading').length) {
getContainer().append(templates.render('core.general.ajax'));
}
count++;
ips.utils.anim.go('fadeIn fast', $('#elAjaxLoading'));
}
}).ajaxComplete(function(event, request, settings) {
if (!_.isUndefined(settings) && settings.showLoading === true) {
count--;
if (count === 0) {
ips.utils.anim.go('fadeOut fast', $('#elAjaxLoading'));
}
}
if (!_.isUndefined(settings) && !settings.bypassRedirect) {
var responseJson = null;
if (!_.isUndefined(request.responseJSON) && !_.isUndefined(request.responseJSON.redirect)) {
responseJson = request.responseJSON;
} else if (!_.isUndefined(request.responseText)) {
try {
var jsonResponse = $.parseJSON(request.responseText);
if (jsonResponse && !_.isUndefined(jsonResponse.redirect)) {
responseJson = jsonResponse;
}
} catch (err) {}
}
if (responseJson) {
if (!_.isUndefined(responseJson.message) && responseJson.message != '') {
ips.utils.cookie.set('flmsg', responseJson.message);
}
if (responseJson.redirect.match(/#/)) {
window.location.href = responseJson.redirect;
window.location.reload();
} else {
window.location = responseJson.redirect;
}
}
}
ips.utils.cookie.init();
});
The last part in the if(responseJson) block, the condition will always end in a reload/redirect.
I've being trying to catch it but is not easy by the randomness of the request and the issue.
Thanks!