Merge branch 'master' of github.com:psychobunny/node-forum

v1.18.x
Julian Lam 12 years ago
commit c34f4e451a

@ -5,18 +5,23 @@ define(function() {
var categories = null,
overlay = null,
menuBtn = null,
postBtn = null;
postBtn = null,
initialized = false;
function loadCategories(callback) {
if (categories) {
displayCategories();
callback(true);
return;
}
jQuery.getJSON('/api/home', function(data) {
categories = data.categories;
displayCategories();
initialized = true;
if (callback) {
callback(true);
}
});
}
@ -65,6 +70,8 @@ define(function() {
mobileMenu.onNavigate = function() {
if (initialized == false) return false;
var cid = templates.get('category_id'),
tid = templates.get('topic_id');
@ -100,9 +107,11 @@ define(function() {
animateIcons();
}
loadCategories(displayCategories);
mobileMenu.onNavigate();
loadCategories(function() {
displayCategories();
mobileMenu.onNavigate();
});
}
return {

@ -250,19 +250,22 @@
if (data[d] === null) {
template = replace(namespace + d, '', template);
} else if (data[d].constructor == Array) {
namespace += d;
namespace += d + '.';
regex = makeRegex(d),
block = getBlock(regex, namespace, template)
if (block == null) continue;
if (block == null) {
namespace = namespace.replace(d + '.', '');
continue;
}
var numblocks = data[d].length - 1, i = 0, result = "";
do {
result += parse(data[d][i], namespace + '.', block);
result += parse(data[d][i], namespace, block);
} while (i++ < numblocks);
namespace = namespace.replace(d, '');
namespace = namespace.replace(d + '.', '');
template = setBlock(regex, result, template);
} else if (data[d] instanceof Object) {
namespace += d + '.';

Loading…
Cancel
Save