mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 15:35:47 +01:00
bugfix + deprecated templates.getTemplateNameFromUrl
This commit is contained in:
@@ -48,7 +48,6 @@ var ajaxify = {};
|
||||
if (url.indexOf(RELATIVE_PATH.slice(1)) !== -1) {
|
||||
url = url.slice(RELATIVE_PATH.length);
|
||||
}
|
||||
|
||||
var tpl_url = ajaxify.getTemplateMapping(url);
|
||||
|
||||
var hash = '';
|
||||
@@ -139,14 +138,15 @@ var ajaxify = {};
|
||||
tpl_url = url.split('/');
|
||||
|
||||
while(tpl_url.length) {
|
||||
if (templates.is_available(tpl_url)) {
|
||||
if (templates.is_available(tpl_url.join('/'))) {
|
||||
tpl_url = tpl_url.join('/');
|
||||
break;
|
||||
}
|
||||
tpl_url.pop();
|
||||
}
|
||||
|
||||
if (!tpl_url) {
|
||||
tpl_url = tpl_url[0].split('?')[0];
|
||||
if (!tpl_url.length) {
|
||||
tpl_url = url.split('/')[0].split('?')[0];
|
||||
}
|
||||
}
|
||||
} else if (templates[url]) {
|
||||
|
||||
@@ -66,18 +66,6 @@
|
||||
}
|
||||
};
|
||||
|
||||
templates.getTemplateNameFromUrl = function(url) {
|
||||
var parts = url.split('?')[0].split('/');
|
||||
|
||||
for (var i = 0; i < parts.length; ++i) {
|
||||
if (templates.is_available(parts[i])) {
|
||||
return parts[i];
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
};
|
||||
|
||||
templates.preload_template = function(tpl_name, callback) {
|
||||
if(templates[tpl_name]) {
|
||||
return callback();
|
||||
@@ -110,7 +98,7 @@
|
||||
tpl_url = templates.get_custom_map(api_url.split('?')[0]);
|
||||
|
||||
if (!tpl_url) {
|
||||
tpl_url = templates.getTemplateNameFromUrl(api_url);
|
||||
tpl_url = ajaxify.getTemplateMapping(api_url);
|
||||
}
|
||||
|
||||
var template_data = null;
|
||||
|
||||
Reference in New Issue
Block a user