From 6a50d79523cf215001cdd55c74c040bd410775df Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Sun, 6 Apr 2014 19:32:58 -0400 Subject: stuff --- www/index.html | 109 ---------------------------------------------------- www/index.html.dist | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++ www/js/api.js | 6 +-- www/js/html5ks.js | 14 +++---- www/js/imachine.js | 3 +- 5 files changed, 120 insertions(+), 121 deletions(-) delete mode 100644 www/index.html create mode 100644 www/index.html.dist (limited to 'www') diff --git a/www/index.html b/www/index.html deleted file mode 100644 index f5b0270..0000000 --- a/www/index.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - 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/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-70-g09d2