summaryrefslogtreecommitdiff
path: root/www/js/menu.js
diff options
context:
space:
mode:
authorAlex Xu <alex_y_xu@yahoo.ca>2013-07-14 14:07:53 -0400
committerAlex Xu <alex_y_xu@yahoo.ca>2013-07-14 14:07:53 -0400
commit1e340e15fd069a9983f8bf9f3ddc1d013265ee67 (patch)
treec071e9b30052bdc078437e0fd1061645cd07606b /www/js/menu.js
parent522121bef7211c28e848218f31a5019a9724b1d4 (diff)
downloadhtml5ks-1e340e15fd069a9983f8bf9f3ddc1d013265ee67.tar.xz
html5ks-1e340e15fd069a9983f8bf9f3ddc1d013265ee67.zip
fix various bugs
Diffstat (limited to 'www/js/menu.js')
-rw-r--r--www/js/menu.js31
1 files changed, 24 insertions, 7 deletions
diff --git a/www/js/menu.js b/www/js/menu.js
index ca0637f..4259ce1 100644
--- a/www/js/menu.js
+++ b/www/js/menu.js
@@ -30,6 +30,7 @@
main: {
start: document.getElementById("start"),
optionsButton: document.getElementById("options-button"),
+ quit: document.getElementById("quit")
}
};
},
@@ -57,29 +58,45 @@
console.error("unknown option type %s", option.type);
}
}
+
+ this.elements.main.optionsButton.addEventListener("click", function () {
+ html5ks.menu.dialog("options");
+ }, false);
},
init: function () {
this.initElements();
this.initOptions();
+
this.elements.main.start.addEventListener("click", function () {
if (this._imachine_loaded) {
this.elements.mainMenu.style.display = "none";
html5ks.imachine.start().then(this.mainMenu.bind(this));
}
}.bind(this), false);
- this.elements.main.optionsButton.addEventListener("click", function () {
- html5ks.menu.dialog("options");
- }, false);
- this.elements.dialog.return.addEventListener("click", function (e) {
- html5ks.menu.activeDialog.style.display = "none";
- html5ks.menu.elements.dialogs.style.display = "none";
- }, false);
html5ks.fetch("imachine").then(function () {
var start = this.elements.main.start;
start.className = start.className.replace("button-disabled", "");
this._imachine_loaded = true;
}.bind(this));
+
+ this.elements.dialog.return.addEventListener("click", function (e) {
+ html5ks.menu.activeDialog.style.display = "none";
+ html5ks.menu.elements.dialogs.style.display = "none";
+ }, false);
+
+ ["AppleWebKit", "MSIE", "Trident"].forEach(function (ua) {
+ if (navigator.userAgent.indexOf(ua) > -1) {
+ var quit = this.elements.main.quit;
+ quit.className = quit.className.replace("button-disabled", "");
+ this.elements.main.quit.addEventListener("click", function () {
+ window.close();
+ top.open('','_self','');
+ top.close();
+ }, false);
+ return false;
+ }
+ }, this);
}
};
}());