mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-17 03:01:08 +01:00
Merge branch 'master' of github.com:psychobunny/node-forum
This commit is contained in:
@@ -5,18 +5,23 @@ define(function() {
|
|||||||
var categories = null,
|
var categories = null,
|
||||||
overlay = null,
|
overlay = null,
|
||||||
menuBtn = null,
|
menuBtn = null,
|
||||||
postBtn = null;
|
postBtn = null,
|
||||||
|
initialized = false;
|
||||||
|
|
||||||
|
|
||||||
function loadCategories(callback) {
|
function loadCategories(callback) {
|
||||||
if (categories) {
|
if (categories) {
|
||||||
displayCategories();
|
callback(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
jQuery.getJSON('/api/home', function(data) {
|
jQuery.getJSON('/api/home', function(data) {
|
||||||
categories = data.categories;
|
categories = data.categories;
|
||||||
displayCategories();
|
initialized = true;
|
||||||
|
|
||||||
|
if (callback) {
|
||||||
|
callback(true);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,6 +70,8 @@ define(function() {
|
|||||||
|
|
||||||
|
|
||||||
mobileMenu.onNavigate = function() {
|
mobileMenu.onNavigate = function() {
|
||||||
|
if (initialized == false) return false;
|
||||||
|
|
||||||
var cid = templates.get('category_id'),
|
var cid = templates.get('category_id'),
|
||||||
tid = templates.get('topic_id');
|
tid = templates.get('topic_id');
|
||||||
|
|
||||||
@@ -100,9 +107,11 @@ define(function() {
|
|||||||
animateIcons();
|
animateIcons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadCategories(function() {
|
||||||
|
displayCategories();
|
||||||
|
mobileMenu.onNavigate();
|
||||||
|
});
|
||||||
|
|
||||||
loadCategories(displayCategories);
|
|
||||||
mobileMenu.onNavigate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -250,19 +250,22 @@
|
|||||||
if (data[d] === null) {
|
if (data[d] === null) {
|
||||||
template = replace(namespace + d, '', template);
|
template = replace(namespace + d, '', template);
|
||||||
} else if (data[d].constructor == Array) {
|
} else if (data[d].constructor == Array) {
|
||||||
namespace += d;
|
namespace += d + '.';
|
||||||
|
|
||||||
regex = makeRegex(d),
|
regex = makeRegex(d),
|
||||||
block = getBlock(regex, namespace, template)
|
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 = "";
|
var numblocks = data[d].length - 1, i = 0, result = "";
|
||||||
|
|
||||||
do {
|
do {
|
||||||
result += parse(data[d][i], namespace + '.', block);
|
result += parse(data[d][i], namespace, block);
|
||||||
} while (i++ < numblocks);
|
} while (i++ < numblocks);
|
||||||
|
|
||||||
namespace = namespace.replace(d, '');
|
namespace = namespace.replace(d + '.', '');
|
||||||
template = setBlock(regex, result, template);
|
template = setBlock(regex, result, template);
|
||||||
} else if (data[d] instanceof Object) {
|
} else if (data[d] instanceof Object) {
|
||||||
namespace += d + '.';
|
namespace += d + '.';
|
||||||
|
|||||||
Reference in New Issue
Block a user