bugfix + deprecated templates.getTemplateNameFromUrl

This commit is contained in:
psychobunny
2014-03-09 21:05:01 -04:00
parent 712c382a28
commit 62afe65ccf
2 changed files with 6 additions and 18 deletions

View File

@@ -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]) {

View File

@@ -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;