From 2e1bfd32991ce1de81dd6f0f2fb5a4dbbc3bf569 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Sat, 24 Aug 2013 17:13:16 -0400 Subject: fix various minor bugs --- www/index.html | 2 +- www/js/api.js | 13 +++++++++---- www/js/menu.js | 7 +++++-- 3 files changed, 15 insertions(+), 7 deletions(-) (limited to 'www') diff --git a/www/index.html b/www/index.html index bc4de59..b6d2321 100644 --- a/www/index.html +++ b/www/index.html @@ -105,7 +105,7 @@
-
+
:
diff --git a/www/js/api.js b/www/js/api.js index e978301..580de6a 100644 --- a/www/js/api.js +++ b/www/js/api.js @@ -171,10 +171,15 @@ window.html5ks.api = { window: function (action, transition) { var windw = html5ks.elements.window, deferred = when.defer(); - if (action === "show") { - windw.style.display = "block"; - } else { - windw.style.display = "none"; + switch (action) { + case "show": + windw.style.display = "block"; + break; + case "hide": + windw.style.display = "none"; + break; + default: + return windw.style.display !== "none"; } deferred.resolve(action); return deferred.promise; diff --git a/www/js/menu.js b/www/js/menu.js index 6f2fbf3..1b826b3 100644 --- a/www/js/menu.js +++ b/www/js/menu.js @@ -2,6 +2,7 @@ "use strict"; html5ks.menu = { mainMenu: function () { + this.context(false); html5ks.api.stop("music"); html5ks.api.stop("sound"); html5ks.api.stop("ambient"); @@ -151,7 +152,6 @@ document.getElementById("goto-main-menu").addEventListener("click", function () { html5ks.next = function () {}; - html5ks.menu.context(false); html5ks.menu.mainMenu(); }, false); }, @@ -197,10 +197,12 @@ }.bind(this)); }, + _hadWindow: null, + context: function (show) { switch (show) { case true: - this._hadWindow = html5ks.elements.window.style.display !== "none"; + this._hadWindow = this._hadWindow !== null ? this._hadWindow : html5ks.api.window(); html5ks.state.status = "context"; html5ks.elements.gray.style.display = "block"; html5ks.elements.window.style.display = "none"; @@ -210,6 +212,7 @@ html5ks.state.status = "scene"; html5ks.elements.gray.style.display = "none"; if (html5ks.state.status === "scene" && this._hadWindow) { + this._hadWindow = null; html5ks.elements.window.style.display = "block"; } this.elements.context.style.display = "none"; -- cgit v1.2.3-70-g09d2