summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
Diffstat (limited to 'www')
-rw-r--r--www/js/html5ks.js24
-rw-r--r--www/js/i18n.js2
-rw-r--r--www/js/menu.js2
3 files changed, 9 insertions, 19 deletions
diff --git a/www/js/html5ks.js b/www/js/html5ks.js
index f97a1f0..aea03b1 100644
--- a/www/js/html5ks.js
+++ b/www/js/html5ks.js
@@ -219,42 +219,30 @@ window.html5ks = {
}
},
start: function () {
- this.fetch("script").then(function () {
+ this.fetch("json", "script").then(function () {
html5ks.api.movie_cutscene("4ls", true).then(function () {
html5ks.menu.mainMenu();
});
});
},
- fetch: function (type) {
+ fetch: function (type, name) {
var deferred = when.defer();
var xhr = new XMLHttpRequest();
switch (type) {
- case "script":
- if (html5ks.data._scriptFetched) {
+ case "json":
+ if (html5ks.data[name]) {
deferred.resolve();
} else {
- xhr.open("GET", "scripts/script.json");
+ xhr.open("GET", "json/" + name + ".json");
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
- html5ks.data._scriptFetched = true;
- var script = JSON.parse(xhr.responseText);
- html5ks.data.script = script;
+ html5ks.data[name] = JSON.parse(xhr.responseText);
deferred.resolve();
}
};
xhr.send();
}
break;
- case "imachine":
- xhr.open("GET", "scripts/imachine.json");
- xhr.onreadystatechange = function () {
- if (xhr.readyState === 4) {
- html5ks.data.imachine = JSON.parse(xhr.responseText);
- deferred.resolve();
- }
- };
- xhr.send();
- break;
default:
throw new Error("fetchtype " + type + " not implemented");
}
diff --git a/www/js/i18n.js b/www/js/i18n.js
new file mode 100644
index 0000000..764a0dd
--- /dev/null
+++ b/www/js/i18n.js
@@ -0,0 +1,2 @@
+html5ks.i18n = {
+
diff --git a/www/js/menu.js b/www/js/menu.js
index 1e0e5a3..e4a8b2c 100644
--- a/www/js/menu.js
+++ b/www/js/menu.js
@@ -188,7 +188,7 @@
html5ks.imachine.start().then(this.mainMenu.bind(this));
}
}.bind(this), false);
- html5ks.fetch("imachine").then(function () {
+ html5ks.fetch("json", "imachine").then(function () {
var start = this.elements.main.start;
start.className = start.className.replace("disabled", "");
this._imachine_loaded = true;