summaryrefslogtreecommitdiff
path: root/js/api.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/api.js')
-rw-r--r--js/api.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/js/api.js b/js/api.js
new file mode 100644
index 0000000..311f162
--- /dev/null
+++ b/js/api.js
@@ -0,0 +1,32 @@
+"use strict";
+var save = {
+ seen_scenes: {},
+ attraction: {
+ kenji: 0,
+ sc: 0,
+ hanako: 0
+ },
+ hdisabled: false
+};
+var video = document.getElementById("video");
+function seen_scene(scene) {
+ return !!save.seen_scenes[scene];
+}
+function scene_register(scene) {
+ save.seen_scenes.scene = true;
+}
+function play_video(vid_src) {
+ var deferred = when.defer();
+ video.src = "/video/" + vid_src + ".webm";
+ video.load();
+ video.addEventListener("ended", function () {
+ deferred.resolve(video);
+ }, false);
+ video.addEventListener("error", function () {
+ deferred.reject(video.error);
+ }, false);
+}
+function act_op(this_video) {
+ // strip off extension
+ return play_video(this_video.slice(0,-4));
+}