mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 07:25:46 +01:00
closed #1586
This commit is contained in:
@@ -146,24 +146,18 @@ 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 = url.split('/');
|
||||||
tpl_url = 'home';
|
|
||||||
} else if (url === 'admin' || url === 'admin/') {
|
|
||||||
tpl_url = 'admin/index';
|
|
||||||
} else {
|
|
||||||
tpl_url = url.split('/');
|
|
||||||
|
|
||||||
while(tpl_url.length) {
|
while(tpl_url.length) {
|
||||||
if (ajaxify.isTemplateAvailable(tpl_url.join('/'))) {
|
if (ajaxify.isTemplateAvailable(tpl_url.join('/'))) {
|
||||||
tpl_url = tpl_url.join('/');
|
tpl_url = tpl_url.join('/');
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
tpl_url.pop();
|
|
||||||
}
|
}
|
||||||
|
tpl_url.pop();
|
||||||
|
}
|
||||||
|
|
||||||
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({
|
||||||
|
|||||||
Reference in New Issue
Block a user