summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Xu <alex_y_xu@yahoo.ca>2014-01-19 11:34:37 -0500
committerAlex Xu <alex_y_xu@yahoo.ca>2014-01-19 11:34:37 -0500
commitafa4dcf0a43848df652c7c0dfcd1da6d5e5bd839 (patch)
tree89fe1ea3298947a719346349cebf17f7dcc99da6
parent8ccc464b0de39e7fc73b3c3e50f80f6c2452c8fe (diff)
downloadhtml5ks-afa4dcf0a43848df652c7c0dfcd1da6d5e5bd839.tar.xz
html5ks-afa4dcf0a43848df652c7c0dfcd1da6d5e5bd839.zip
Stuff.
-rw-r--r--Makefile8
-rw-r--r--README2
-rw-r--r--unrpyc/Makefile2
-rw-r--r--www/js/api.js26
-rw-r--r--www/js/imachine.js2
5 files changed, 26 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 5725e9d..50b25ee 100644
--- a/Makefile
+++ b/Makefile
@@ -42,6 +42,7 @@ video: $(CVIDEO)
AUDIO := $(shell find $(DUMP)/bgm $(DUMP)/sfx -name '*.ogg')
OPUS := $(patsubst %.ogg,%.opus,$(AUDIO))
M4A := $(patsubst %.ogg,%.m4a,$(AUDIO))
+WAV := $(patsubst %.ogg,%.wav,$(AUDIO))
CAUDIO := $(OPUS) $(M4A)
audio: $(CAUDIO)
@@ -104,7 +105,7 @@ JS := www/js/html5ks.js www/js/menu.js www/js/api.js www/js/play.js www/js/image
js: www/js/all.min.js
www/js/all.min.js: $(JS)
- $(UGLIFYJS) $^ -o $@ -p 2 -m -c
+ $(UGLIFYJS) $^ -o $@ -p 2 -m -c drop_debugger=false
# === MISC ===
@@ -114,10 +115,13 @@ clean:
jshint: $(JS)
jshint $^
+space:
+ find $(DUMP) \( -name '*.wav' -o -name '*.mkv' -o -path "$(DUMP)/font*" \) -delete
+
watch:
while inotifywait -r -e modify,delete,move --exclude="^\./\.git" --exclude="\.swp$$" .; do \
${MAKE}; \
done
-.PHONY: video audio images js jshint clean watch
+.PHONY: video audio images js jshint clean space watch
.SUFFIXES:
diff --git a/README b/README
index 7d54461..179656c 100644
--- a/README
+++ b/README
@@ -31,7 +31,7 @@ To reduce the setup time (many hours), try the following:
Turn off zopflipng recompression by passing ZOPFLIPNG=: as an environment variable to setup.sh. It saves only a few MB but takes several hours to complete, depending on CPU. Useful if you're serving many, MANY copies, but not useful if you're serving one locally.
== Reducing file size ==
-[TODO]
+Run `make space`. Warning: This will remove source files from dump.
== Contributing ==
diff --git a/unrpyc/Makefile b/unrpyc/Makefile
index 56d207b..5a86ca6 100644
--- a/unrpyc/Makefile
+++ b/unrpyc/Makefile
@@ -38,7 +38,7 @@ test: all
install: all
[ -d ../www/json ] || mkdir ../www/json
- install $(TARGETS) ../www/json
+ cp -f $(TARGETS) ../www/json
uninstall:
$(RM) ../www/json/*
diff --git a/www/js/api.js b/www/js/api.js
index 833b120..84cc881 100644
--- a/www/js/api.js
+++ b/www/js/api.js
@@ -61,13 +61,20 @@ window.html5ks.api = new (function () {
for (; i < types.length; i++) {
if (Modernizr.audio[types[i]]) {
audio.src = src + "." + types[i];
+ audio.load();
+ audio.volume = fade ? 0 : volume;
return i;
}
}
+ return null;
};
- var i = setNextType(0);
+ var i;
+ audio.addEventListener("canplaythrough", function canplaythrough() {
+ audio.removeEventListener("canplaythrough", canplaythrough, false);
+ audio.play();
+ });
audio.addEventListener("playing", function playing() {
audio.removeEventListener("playing", playing, false);
if (fade) {
@@ -77,19 +84,20 @@ window.html5ks.api = new (function () {
}, false);
audio.onerror = function (e) {
if (e.code === e.MEDIA_ERR_SRC_NOT_SUPPORTED) {
- i = setNextType(i);
- if (i) {
+ i = setNextType(++i);
+ if (!i) {
+ console.error("No media formats appear to be supported.");
+ console.error(e);
deferred.resolve();
- } else {
- throw new Error(e);
}
} else {
- throw new Error(e);
+ console.error(e);
+ deferred.resolve();
}
};
- audio.load();
- audio.volume = fade ? 0 : volume;
- audio.play();
+
+ i = setNextType(0);
+
return deferred.promise;
},
diff --git a/www/js/imachine.js b/www/js/imachine.js
index 7a1f7de..968df84 100644
--- a/www/js/imachine.js
+++ b/www/js/imachine.js
@@ -56,7 +56,7 @@ html5ks.imachine = new (function () {
var cpy = inst.slice(0),
type = '',
next = null;
- el: while (type = cpy.shift()) {
+ el: while ((type = cpy.shift())) {
switch (type) {
case "if":
case "elif":