From 23518a31d24e62caeecbfafe7708f4c7ffcd24f5 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Wed, 24 Jul 2013 18:40:52 -0400 Subject: fix misc. bugs, add reencode.sh --- www/index.html | 3 ++- www/js/api.js | 2 +- www/js/html5ks.js | 6 ++++++ www/js/menu.js | 23 +++++++++++++++++------ 4 files changed, 26 insertions(+), 8 deletions(-) (limited to 'www') diff --git a/www/index.html b/www/index.html index 78d9342..9550a64 100644 --- a/www/index.html +++ b/www/index.html @@ -75,7 +75,8 @@ - + + 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); -- cgit v1.2.3-70-g09d2