fixes issue #14

v1.18.x
psychobunny 12 years ago
parent 4436dbafe9
commit dbf7887cc6

@ -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() {
loadCategories(displayCategories); displayCategories();
mobileMenu.onNavigate(); mobileMenu.onNavigate();
});
} }
return { return {

Loading…
Cancel
Save