v1.18.x
Barış Soner Uşaklı 10 years ago
parent cb9a300811
commit 7abbbbfccf

@ -31,7 +31,7 @@ $(document).ready(function() {
ajaxify.currentPage = null; ajaxify.currentPage = null;
ajaxify.go = function (url, callback, quiet) { ajaxify.go = function (url, callback, quiet) {
if (ajaxify.handleACPRedirect(url) || ajaxify.handleNonAPIRoutes(url)) { if (ajaxify.handleRedirects(url)) {
return true; return true;
} }
@ -65,24 +65,17 @@ $(document).ready(function() {
return true; return true;
}; };
ajaxify.handleACPRedirect = function(url) { ajaxify.handleRedirects = function(url) {
// If ajaxifying into an admin route from regular site, do a cold load. url = ajaxify.removeRelativePath(url.replace(/\/$/, '')).toLowerCase();
url = ajaxify.removeRelativePath(url.replace(/\/$/, '')); var isAdminRoute = url.startsWith('admin') && window.location.pathname.indexOf(RELATIVE_PATH + '/admin') !== 0;
if (url.startsWith('admin') && window.location.pathname.indexOf(RELATIVE_PATH + '/admin') !== 0) { var uploadsOrApi = url.startsWith('uploads') || url.startsWith('api');
if (isAdminRoute || uploadsOrApi) {
window.open(RELATIVE_PATH + '/' + url, '_blank'); window.open(RELATIVE_PATH + '/' + url, '_blank');
return true; return true;
} }
return false; return false;
}; };
ajaxify.handleNonAPIRoutes = function(url) {
url = ajaxify.removeRelativePath(url.replace(/\/$/, ''));
if (url.startsWith('uploads')) {
window.open(RELATIVE_PATH + '/' + url, '_blank');
return true;
}
return false;
};
ajaxify.start = function(url, quiet, search) { ajaxify.start = function(url, quiet, search) {
url = ajaxify.removeRelativePath(url.replace(/\/$/, '')); url = ajaxify.removeRelativePath(url.replace(/\/$/, ''));

Loading…
Cancel
Save