From c191f104460a5b3f149863b2cdf9db3051f978c9 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Sat, 6 Jul 2013 16:15:26 -0400 Subject: fix menu... sorta --- www/js/api.js | 2 +- www/js/imachine.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'www') diff --git a/www/js/api.js b/www/js/api.js index db09207..c8c495a 100644 --- a/www/js/api.js +++ b/www/js/api.js @@ -373,7 +373,7 @@ window.html5ks.api = { choice.innerHTML = i; choice.addEventListener("click", function () { html5ks.elements.choices.innerHTML = ""; - deferred.resolve(choices[i]); + deferred.resolve(choices[this.innerHTML]); }, false); frag.appendChild(choice); choice = choice.cloneNode(false); diff --git a/www/js/imachine.js b/www/js/imachine.js index adad442..1d539dd 100644 --- a/www/js/imachine.js +++ b/www/js/imachine.js @@ -12,7 +12,7 @@ html5ks.imachine = (function () { }, run: function (label) { var deferred = when.defer(), - ilabel = typeof label === "string" ? html5ks.data.imachine[label] : label, + ilabel = typeof label === "string" ? html5ks.data.imachine[label] || label : label, i = 0, runInst = function () { var inst = ilabel[i++]; @@ -40,7 +40,8 @@ html5ks.imachine = (function () { break; case "imenu": html5ks.api.menu(args[0]).then(function (choice) { - html5ks.imachine.run(args[1][choice] || args[1].else); + var next = args[1][choice] || args[1].else; + html5ks.imachine.run(typeof next[0] === "string" ? [next] : next); }); break; case "seen_scene": -- cgit v1.2.3-54-g00ecf