summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
authorAlex Xu <alex_y_xu@yahoo.ca>2013-07-24 18:40:52 -0400
committerAlex Xu <alex_y_xu@yahoo.ca>2013-07-24 18:40:52 -0400
commit23518a31d24e62caeecbfafe7708f4c7ffcd24f5 (patch)
tree0088578bd87f4467f5b48e0fd22df70d3fedb245 /www/js
parentffd3a73254b16a00d67b188dc43bd605bf757cbf (diff)
downloadhtml5ks-23518a31d24e62caeecbfafe7708f4c7ffcd24f5.tar.xz
html5ks-23518a31d24e62caeecbfafe7708f4c7ffcd24f5.zip
fix misc. bugs, add reencode.sh
Diffstat (limited to 'www/js')
-rw-r--r--www/js/api.js2
-rw-r--r--www/js/html5ks.js6
-rw-r--r--www/js/menu.js23
3 files changed, 24 insertions, 7 deletions
diff --git a/www/js/api.js b/www/js/api.js
index edc37b6..21494a2 100644
--- a/www/js/api.js
+++ b/www/js/api.js
@@ -36,7 +36,7 @@ window.html5ks.api = {
html5ks.elements.audio[channel] = audio;
audio.src = "dump/" + (channel === "music" ? "bgm/" + html5ks.data.music[name] + ".ogg" : html5ks.data.sfx[name]);
audio.load();
- audio.volume = fade ? 0 : 1;
+ audio.volume = fade ? 0 : html5ks.persistent.settings.musicVolume;
audio.play();
audio.onplaying = function () {
deferred.resolve();
diff --git a/www/js/html5ks.js b/www/js/html5ks.js
index fc3f99a..059cbbe 100644
--- a/www/js/html5ks.js
+++ b/www/js/html5ks.js
@@ -114,6 +114,12 @@ window.html5ks = {
window.addEventListener("dragstart", function (e) {
e.preventDefault();
}, false);
+ if (html5ks.persistent.settings.fullscreen) {
+ window.addEventListener("click", function click() {
+ window.removeEventListener("click", click, false);
+ html5ks.fullscreen();
+ }, false);
+ }
},
warnUnsupported: function () {
if (!html5ks.persistent.settings.gotit) {
diff --git a/www/js/menu.js b/www/js/menu.js
index 43d98c4..cb29675 100644
--- a/www/js/menu.js
+++ b/www/js/menu.js
@@ -39,20 +39,31 @@
var options = document.getElementsByClassName("option"),
values = html5ks.persistent.settings;
+ options[0].parentNode.parentNode.addEventListener("change", function (e) {
+ var target = e.target;
+ values[target.id] = typeof target.checked !== "undefined" ? target.checked : target.value;
+ switch (target.id) {
+ case "fullscreen":
+ html5ks.fullscreen();
+ break;
+ case "scaleAll":
+ case "scaleVideo":
+ html5ks.scale();
+ break;
+ case "musicVolume":
+ case "sfxVolume":
+ html5ks.elements.audio[target.id.replace("Volume", "")].volume = target.value;
+ break;
+ }
+ }, false);
for (var i = options.length - 1; i >= 0; i--) {
var option = options[i];
switch (option.type) {
case "checkbox":
option.checked = values[option.id];
- option.addEventListener("change", function () {
- values[this.id] = this.checked;
- }, false);
break;
case "range":
option.value = values[option.id];
- option.addEventListener("change", function () {
- values[this.id] = this.value;
- }, false);
break;
default:
console.error("unknown option type %s", option.type);