From 6a50d79523cf215001cdd55c74c040bd410775df Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Sun, 6 Apr 2014 19:32:58 -0400 Subject: stuff --- .gitignore | 11 +++--- Makefile | 10 ++++- www/index.html | 109 ---------------------------------------------------- www/index.html.dist | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++ www/js/api.js | 6 +-- www/js/html5ks.js | 14 +++---- www/js/imachine.js | 3 +- 7 files changed, 135 insertions(+), 127 deletions(-) delete mode 100644 www/index.html create mode 100644 www/index.html.dist diff --git a/.gitignore b/.gitignore index a7e93a4..0447cf1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,16 @@ # ignore 'copyrighted' contents similar to emulators -/www/favicon.ico -/www/json -/www/dump -/rpy /ast2json/*.json* /ast2json/*.rpyc +/rpy +/www/dump +/www/favicon.ico +/www/json # generated files /Makefile.inc -/www/js/all.min.js* /node_modules +/www/index.html +/www/js/all.min.js* # generated nginx conf - see nginx.sh /nginx.gen.conf diff --git a/Makefile b/Makefile index 3d20bb2..c606599 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ null := SPACE := $(null) $(null) -all: js json video audio images +all: html js json video audio images Makefile: Makefile.inc @@ -12,6 +12,14 @@ include Makefile.inc UGLIFYJS := node_modules/.bin/uglifyjs $(UGLIFYJSFLAGS) +# === HTML === + +html: www/index.html + +www/index.html: www/index.html.dist + $(if $(DEBUG), sed -e 's:$(subst www/,,$(JSOUT)):$(subst $(SPACE),"> - -
-
-
-

We use a lot of new features in this; your browser seems to have some issues...

- -
I know it's broken, let me play!
-
-
-
- -
-
- - -
-
- - -
- - - -
- -
- diff --git a/www/index.html.dist b/www/index.html.dist new file mode 100644 index 0000000..f5b0270 --- /dev/null +++ b/www/index.html.dist @@ -0,0 +1,109 @@ + + + + + + + Katawa Shoujo + + + + + +
+
+
+

We use a lot of new features in this; your browser seems to have some issues...

+ +
I know it's broken, let me play!
+
+
+
+ +
+
+ + +
+
+ + +
+ + + +
+ +
+ diff --git a/www/js/api.js b/www/js/api.js index 6b5f177..0043724 100644 --- a/www/js/api.js +++ b/www/js/api.js @@ -191,9 +191,9 @@ window.html5ks.api = { iscene: function (target, is_h, is_end) { html5ks.store.status = "scene"; var deferred = when.defer(), - real_target = html5ks.persistent.language + "_" + target, + real_target = html5ks.persistent.language + "_" + target.replace(/"/g, ''), i = 0; - html5ks.fetch('script', html5ks.data.s2s[real_target]).then(function (l) { + html5ks.fetch('script', real_target).then(function run(l) { if (l[i]) { html5ks.api.runInst(l[i++]).then(run, console.error); } else { @@ -214,8 +214,6 @@ window.html5ks.api = { return this[cmd].apply(this, args); } else if (inst.length === 1) { return this.say("name_only", cmd); - } else if (/^[A-Z]/.test(cmd)) { - return this.say(cmd, args[0]); } else { console.error("no such cmd " + cmd); return when.resolve(); diff --git a/www/js/html5ks.js b/www/js/html5ks.js index 7fe493a..13bd198 100644 --- a/www/js/html5ks.js +++ b/www/js/html5ks.js @@ -205,7 +205,7 @@ window.html5ks = { var deferred = when.defer(); var xhr = new XMLHttpRequest(); if (obj[prop]) { - deferred.resolve(); + deferred.resolve(obj[prop]); } else { xhr.open("GET", path); xhr.onload = function () { @@ -217,8 +217,8 @@ window.html5ks = { xhr.onerror(); } }; - xhr.onerror = function () { - deferred.reject(); + xhr.onerror = function (e) { + deferred.reject(new Error(xhr.status)); }; xhr.send(); } @@ -229,14 +229,14 @@ window.html5ks = { switch (type) { case "json": return this._fetch(html5ks.data, name, "json/" + name + ".json"); - break; case "script": - this._fetch(html5ks.data.script, name, "json/script-" + name + ".json").then(function (d) { + var filename = html5ks.data.s2s[name]; + this._fetch(html5ks.data.script, filename, "json/script-" + filename + ".json").then(function (d) { for (var i in d) { html5ks.data.script[i] = d[i]; } - deferred.resolve(); - }); + deferred.resolve(d[name]); + }, deferred.reject); break; default: throw new Error("fetchtype " + type + " not implemented"); diff --git a/www/js/imachine.js b/www/js/imachine.js index 694aea5..37ce701 100644 --- a/www/js/imachine.js +++ b/www/js/imachine.js @@ -21,8 +21,9 @@ html5ks.imachine = { case "act_op": case "iscene": html5ks.api[inst.label].call(html5ks.api, inst['arguments'][0][0][1]).then(runInst, deferred.reject); + break; default: - throw new Error('unknown Call label'); + throw new Error('unknown Call label: ' + inst.label); } break; case 'UserStatement': -- cgit v1.2.3-54-g00ecf