v1.18.x
Julian Lam 11 years ago
parent 48aba5fc64
commit 667a78902e

@ -146,11 +146,6 @@ var ajaxify = ajaxify || {};
var tpl_url = ajaxify.getCustomTemplateMapping(url.split('?')[0]); var tpl_url = ajaxify.getCustomTemplateMapping(url.split('?')[0]);
if (tpl_url === false && !templates[url]) { if (tpl_url === false && !templates[url]) {
if (url === '' || url === '/') {
tpl_url = 'home';
} else if (url === 'admin' || url === 'admin/') {
tpl_url = 'admin/index';
} else {
tpl_url = url.split('/'); tpl_url = url.split('/');
while(tpl_url.length) { while(tpl_url.length) {
@ -164,7 +159,6 @@ var ajaxify = ajaxify || {};
if (!tpl_url.length) { if (!tpl_url.length) {
tpl_url = url.split('/')[0].split('?')[0]; tpl_url = url.split('/')[0].split('?')[0];
} }
}
} else if (templates[url]) { } else if (templates[url]) {
tpl_url = url; tpl_url = url;
} }
@ -173,7 +167,7 @@ var ajaxify = ajaxify || {};
}; };
ajaxify.getCustomTemplateMapping = function(tpl) { ajaxify.getCustomTemplateMapping = function(tpl) {
if (templatesConfig.custom_mapping && tpl) { if (templatesConfig.custom_mapping && tpl !== undefined) {
for (var pattern in templatesConfig.custom_mapping) { for (var pattern in templatesConfig.custom_mapping) {
if (tpl.match(pattern)) { if (tpl.match(pattern)) {
return (templatesConfig.custom_mapping[pattern]); return (templatesConfig.custom_mapping[pattern]);
@ -193,10 +187,10 @@ var ajaxify = ajaxify || {};
var location = document.location || window.location, var location = document.location || window.location,
api_url = (url === '' || url === '/') ? 'home' : url, api_url = (url === '' || url === '/') ? 'home' : url,
tpl_url = ajaxify.getCustomTemplateMapping(api_url.split('?')[0]); tpl_url = ajaxify.getCustomTemplateMapping(url.split('?')[0]);
if (!tpl_url) { if (!tpl_url) {
tpl_url = ajaxify.getTemplateMapping(api_url); tpl_url = ajaxify.getTemplateMapping(url);
} }
apiXHR = $.ajax({ apiXHR = $.ajax({

Loading…
Cancel
Save