summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
Diffstat (limited to 'www')
-rw-r--r--www/index.html3
-rw-r--r--www/js/api.js2
-rw-r--r--www/js/html5ks.js6
-rw-r--r--www/js/menu.js23
4 files changed, 26 insertions, 8 deletions
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 @@
<label class="button"><input type="checkbox" class="option" id="skipUnread"> <span>Skip unread text</span></label>
<label class="button"><input type="checkbox" class="option" id="skipAfterChoices"> <span>Keep skipping after choices</span></label>
<label class="button"><input type="checkbox" class="option" id="useWebP"> <span>Use WebP images (less bandwidth, more CPU)</span></label>
- <label class="button"><input type="checkbox" class="option" id="fullscreen"> <span>Scale content</span></label>
+ <label class="button"><input type="checkbox" class="option" id="fullscreen"> <span>Fullscreen</span></label>
+ <label class="button"><input type="checkbox" class="option" id="scaleAll"> <span>Scale content</span></label>
<label class="button"><input type="checkbox" class="option" id="scaleVideo"> <span>Scale video</span></label>
<label><input type="range" min="0.0" max="1.0" step="0.001" class="option" id="textSpeed"> <span class="tr">Text speed</span></label>
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);