summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README2
-rw-r--r--unrpyc/Makefile3
-rw-r--r--www/js/api.js77
3 files changed, 44 insertions, 38 deletions
diff --git a/README b/README
index 9db2cdb..d2d08f3 100644
--- a/README
+++ b/README
@@ -16,6 +16,8 @@ How to use:
Check Bugzilla for things that need to be done. [3]
+If you were looking for real documentation... good luck.
+
[0] http://www.katawa-shoujo.com/
[1] https://github.com/cujojs/when/
[2] If you're on Windoze, sucks for you. Use a better OS.
diff --git a/unrpyc/Makefile b/unrpyc/Makefile
index 829d2b9..431e10b 100644
--- a/unrpyc/Makefile
+++ b/unrpyc/Makefile
@@ -25,12 +25,13 @@ script-%.json: script-%.json.o
sed -i -e 's/^{//;s/}$$/,/' $@
clean:
- rm -f *.json.o *.json *.gz
+ rm -f *.json*
test: all
jshint --show-non-errors *.json
install: all
+ [ -d ../www/json ] || mkdir ../www/json
install -t ../www/json script.json script.json.gz imachine.json imachine.json.gz imachine_replay.json imachine_replay.json.gz ui-strings.json ui-strings.json.gz
uninstall:
diff --git a/www/js/api.js b/www/js/api.js
index a7b06d8..783876d 100644
--- a/www/js/api.js
+++ b/www/js/api.js
@@ -18,13 +18,13 @@ window.html5ks.api = {
if (!delay) {
audio.volume = target;
} else {
- var f = setInterval(function () {
+ this._fading[channel] = setInterval(function () {
// clamp new volume 0-1
audio.volume = Math.min(Math.max(audio.volume + step, 0), 1);
if (audio.volume === 0 || audio.volume === 1) {
- clearInterval(f);
+ clearInterval(this._fading);
}
- }, 50);
+ }.bind(this), 50);
}
deferred.resolve();
return deferred.promise;
@@ -64,6 +64,9 @@ window.html5ks.api = {
}
var deferred = when.defer(),
audio = html5ks.elements.audio[channel];
+ if (this._fading[channel]) {
+ clearInterval(this._fading[channel]);
+ }
if (fade) {
this.set_volume(0, fade, channel);
} else {
@@ -342,45 +345,45 @@ window.html5ks.api = {
deferred.resolve();
html5ks.next = function () {};
};
- return deferred.promise;
- }
- var who = html5ks.elements.who;
- if (!extend) {
- who.innerHTML = char.name;
- if (char.color) {
- who.style.color = char.color;
- } else {
- who.style.color = "#ffffff";
+ } else {
+ var who = html5ks.elements.who;
+ if (!extend) {
+ who.innerHTML = char.name;
+ if (char.color) {
+ who.style.color = char.color;
+ } else {
+ who.style.color = "#ffffff";
+ }
}
- }
- if (extend) {
- html5ks.elements.say.innerHTML += text;
- } else {
- html5ks.elements.say.innerHTML = text;
- }
+ if (extend) {
+ html5ks.elements.say.innerHTML += text;
+ } else {
+ html5ks.elements.say.innerHTML = text;
+ }
- if (w) {
- html5ks.next = function () {
- html5ks.next = function () {};
- html5ks.api.extend(w[2]).then(function () {
- deferred.resolve();
- });
- };
- if (w[1]) {
- setTimeout(function () {
- html5ks.next();
- }, parseFloat(w[1], 10) * 1000);
- return deferred.promise;
+ if (w) {
+ html5ks.next = function () {
+ html5ks.next = function () {};
+ html5ks.api.extend(w[2]).then(function () {
+ deferred.resolve();
+ });
+ };
+ if (w[1]) {
+ setTimeout(function () {
+ html5ks.next();
+ }, parseFloat(w[1], 10) * 1000);
+ return deferred.promise;
+ }
+ } else {
+ html5ks.next = function () {
+ html5ks.elements.ctc.style.display = "none";
+ deferred.resolve(text);
+ html5ks.next = function () {};
+ };
}
- } else {
- html5ks.next = function () {
- html5ks.elements.ctc.style.display = "none";
- deferred.resolve(text);
- html5ks.next = function () {};
- };
+ html5ks.elements.ctc.style.display = "block";
}
- html5ks.elements.ctc.style.display = "block";
if (html5ks.state.skip || str.indexOf("{nw}") > -1) {
html5ks.next();
} else if (html5ks.state.auto) {