summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorAlex Xu <alex_y_xu@yahoo.ca>2013-08-24 17:13:16 -0400
committerAlex Xu <alex_y_xu@yahoo.ca>2013-08-24 17:13:16 -0400
commit2e1bfd32991ce1de81dd6f0f2fb5a4dbbc3bf569 (patch)
tree20a61e92baa3722c7784b0480368a5d38f7692f9 /www
parent32a2ef87ded92abdfae94548f42a6442deef3b2b (diff)
downloadhtml5ks-2e1bfd32991ce1de81dd6f0f2fb5a4dbbc3bf569.tar.xz
html5ks-2e1bfd32991ce1de81dd6f0f2fb5a4dbbc3bf569.zip
fix various minor bugs
Diffstat (limited to 'www')
-rw-r--r--www/index.html2
-rw-r--r--www/js/api.js13
-rw-r--r--www/js/menu.js7
3 files changed, 15 insertions, 7 deletions
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 @@
<div id="save" class="button game_menu_save"></div>
<div class="load button game_menu_load"></div>
<div id="goto-main-menu" class="button game_menu_main"></div>
- <div class="quit button game_menu_quit"></div>
+ <div class="quit button disabled game_menu_quit"></div>
</div>
<div id="context-info">
<div><span class="play_time_label"></span>: <span id="play-time"></span></div>
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";