mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 15:05:46 +01:00
optimizing ajaxify (still needs work though)
This commit is contained in:
@@ -127,10 +127,6 @@ var ajaxify = {};
|
|||||||
$('#footer, #content').removeClass('hide').addClass('ajaxifying');
|
$('#footer, #content').removeClass('hide').addClass('ajaxifying');
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* this is complete hax and needs to be looked at. (fixing this is out of scope for what I'm currently refactoring)
|
|
||||||
* -- psychobunny
|
|
||||||
*/
|
|
||||||
ajaxify.getTemplateMapping = function(url) {
|
ajaxify.getTemplateMapping = function(url) {
|
||||||
var tpl_url = templates.get_custom_map(url.split('?')[0]);
|
var tpl_url = templates.get_custom_map(url.split('?')[0]);
|
||||||
|
|
||||||
@@ -142,13 +138,17 @@ var ajaxify = {};
|
|||||||
} else {
|
} else {
|
||||||
tpl_url = url.split('/');
|
tpl_url = url.split('/');
|
||||||
|
|
||||||
if (tpl_url[0] === 'admin') {
|
while(tpl_url.length) {
|
||||||
tpl_url = tpl_url[0] + '/' + tpl_url[1];
|
if (templates.is_available(tpl_url)) {
|
||||||
} else {
|
break;
|
||||||
|
}
|
||||||
|
tpl_url.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!tpl_url) {
|
||||||
tpl_url = tpl_url[0].split('?')[0];
|
tpl_url = tpl_url[0].split('?')[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (templates[url]) {
|
} else if (templates[url]) {
|
||||||
tpl_url = url;
|
tpl_url = url;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,17 +69,12 @@
|
|||||||
templates.getTemplateNameFromUrl = function(url) {
|
templates.getTemplateNameFromUrl = function(url) {
|
||||||
var parts = url.split('?')[0].split('/');
|
var parts = url.split('?')[0].split('/');
|
||||||
|
|
||||||
if (parts[0] === 'admin') {
|
for (var i = 0; i < parts.length; ++i) {
|
||||||
return parts = parts[0] + '/' + parts[1];
|
if (templates.is_available(parts[i])) {
|
||||||
} else {
|
return parts[i];
|
||||||
for (var i = 0; i < parts.length; ++i) {
|
|
||||||
if (templates.is_available(parts[i])) {
|
|
||||||
return parts[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user