From 68e4235070b0b7fd983bfc4e2ffd57fef87db576 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Sun, 5 Jan 2014 19:39:38 -0500 Subject: Fix ReferenceError on start. --- www/js/html5ks.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/www/js/html5ks.js b/www/js/html5ks.js index b637eb1..d6c227b 100644 --- a/www/js/html5ks.js +++ b/www/js/html5ks.js @@ -172,7 +172,13 @@ window.html5ks = { this.i18n.init(); }, start: function () { - this.fetch("json", "script"); + this.fetch("json", "script").then(function (d) { + for (var k in d) { + if (k.slice(0, 3) === (html5ks.persistent.language === "en" ? "fr_" : "en_")) { + delete d[k]; + } + } + }); html5ks.api.movie_cutscene("4ls", true).then(function () { html5ks.menu.mainMenu(); }); @@ -188,11 +194,6 @@ window.html5ks = { xhr.open("GET", "json/" + name + ".json"); xhr.onload = function () { d = JSON.parse(xhr.responseText); - for (var k in d) { - if (k.slice(0, 3) === (html5ks.persistent.language === "en" ? "fr_" : "en_")) { - delete d[k]; - } - } html5ks.data[name] = d; deferred.resolve(d); }; -- cgit v1.2.3-70-g09d2