diff options
author | Alex Xu <alex_y_xu@yahoo.ca> | 2014-01-05 19:39:38 -0500 |
---|---|---|
committer | Alex Xu <alex_y_xu@yahoo.ca> | 2014-01-05 19:39:38 -0500 |
commit | 68e4235070b0b7fd983bfc4e2ffd57fef87db576 (patch) | |
tree | a850a91f9f9f5d83f4637c61b68dc956ac37a8a3 | |
parent | 78b5b9f3ce3911755e041f30fbe48698f8f9f809 (diff) | |
download | html5ks-68e4235070b0b7fd983bfc4e2ffd57fef87db576.tar.xz html5ks-68e4235070b0b7fd983bfc4e2ffd57fef87db576.zip |
Fix ReferenceError on start.
-rw-r--r-- | www/js/html5ks.js | 13 |
1 files 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); }; |