diff options
author | Alex Xu <alex_y_xu@yahoo.ca> | 2013-09-02 09:09:01 -0400 |
---|---|---|
committer | Alex Xu <alex_y_xu@yahoo.ca> | 2013-09-02 09:09:01 -0400 |
commit | 782d1dc690b11dab6dcce8bc9f45c355379c9045 (patch) | |
tree | 312d3893ae58c3e61c65d871577e8e573141df46 /www/js | |
parent | 2e1bfd32991ce1de81dd6f0f2fb5a4dbbc3bf569 (diff) | |
download | html5ks-782d1dc690b11dab6dcce8bc9f45c355379c9045.tar.xz html5ks-782d1dc690b11dab6dcce8bc9f45c355379c9045.zip |
Load script/imachine asynchronously during 4ls
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/html5ks.js | 7 | ||||
-rw-r--r-- | www/js/menu.js | 12 |
2 files changed, 8 insertions, 11 deletions
diff --git a/www/js/html5ks.js b/www/js/html5ks.js index 74ab43b..502ca75 100644 --- a/www/js/html5ks.js +++ b/www/js/html5ks.js @@ -218,10 +218,9 @@ window.html5ks = { } }, start: function () { - this.fetch("json", "script").then(function () { - html5ks.api.movie_cutscene("4ls", true).then(function () { - html5ks.menu.mainMenu(); - }); + this.fetch("json", "script"); + html5ks.api.movie_cutscene("4ls", true).then(function () { + html5ks.menu.mainMenu(); }); }, fetch: function (type, name) { diff --git a/www/js/menu.js b/www/js/menu.js index 1b826b3..77ae7ee 100644 --- a/www/js/menu.js +++ b/www/js/menu.js @@ -184,16 +184,14 @@ this.initEvents(); this.initOptions(); - this.elements.main.start.addEventListener("click", function () { - if (this._imachine_loaded) { + when.all([html5ks.fetch("json", "imachine"), + html5ks.fetch("json", "script")]).then(function () { + var start = this.elements.main.start; + start.addEventListener("click", function () { this.elements.mainMenu.style.display = "none"; html5ks.imachine.start().then(this.mainMenu.bind(this)); - } - }.bind(this), false); - html5ks.fetch("json", "imachine").then(function () { - var start = this.elements.main.start; + }.bind(this), false); start.className = start.className.replace("disabled", ""); - this._imachine_loaded = true; }.bind(this)); }, |