From 38779737f641904829b8d07428ea7865309dc907 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Tue, 3 Dec 2013 14:22:05 -0500 Subject: More refactoring. --- www/js/api.js | 21 +++++++++------------ www/js/html5ks.js | 5 ++++- www/js/menu.js | 6 ++---- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/www/js/api.js b/www/js/api.js index bce46cf..ca8ee85 100644 --- a/www/js/api.js +++ b/www/js/api.js @@ -368,10 +368,9 @@ window.html5ks.api = { if (chr.kind === "nvl") { html5ks.elements.nvlsay.innerHTML += "" + text + ""; html5ks.elements.nvlctc.style.display = "block"; - html5ks.next = function () { + html5ks._next = function () { html5ks.elements.nvlctc.style.display = "none"; deferred.resolve(); - html5ks.next = function () {}; }; } else { var who = html5ks.elements.who; @@ -384,15 +383,14 @@ window.html5ks.api = { } } - if (extend) { - html5ks.elements.say.innerHTML += text; - } else { - html5ks.elements.say.innerHTML = text; - } + var newText = extend ? + html5ks.elements.say.innerHTML + text : + text; + + html5ks.elements.say.innerHTML = newText; if (w) { - html5ks.next = function () { - html5ks.next = function () {}; + html5ks._next = function () { html5ks.api.extend(w[2]).then(function () { deferred.resolve(); }); @@ -404,10 +402,9 @@ window.html5ks.api = { return deferred.promise; } } else { - html5ks.next = function () { + html5ks._next = function () { html5ks.elements.ctc.style.display = "none"; deferred.resolve(text); - html5ks.next = function () {}; }; } html5ks.elements.ctc.style.display = "block"; @@ -458,7 +455,7 @@ window.html5ks.api = { var deferred = when.defer(), centered = document.getElementById("centered"); centered.innerHTML = this.tag(text); - html5ks.next = function () { + html5ks._next = function () { centered.innerHTML = ""; deferred.resolve(); }; diff --git a/www/js/html5ks.js b/www/js/html5ks.js index 7a1f91c..73157bf 100644 --- a/www/js/html5ks.js +++ b/www/js/html5ks.js @@ -59,7 +59,10 @@ window.html5ks = { } }, state: {}, - next: function () {}, + next: function () { + html5ks._next(); + html5ks._next = function () {}; + }, initElements: function () { this.elements = { all: document.getElementById("all"), diff --git a/www/js/menu.js b/www/js/menu.js index 2715e26..eb878a5 100644 --- a/www/js/menu.js +++ b/www/js/menu.js @@ -2,10 +2,9 @@ "use strict"; html5ks.menu = { mainMenu: function () { + html5ks._next = function () {}; this.context(false); - html5ks.api.stop("music"); - html5ks.api.stop("sound"); - html5ks.api.stop("ambient"); + html5ks.api.stop("all"); html5ks.api.window("hide"); html5ks.api.play("music", "music_menus"); html5ks.api.show("url", "ui/main/bg-main.png"); @@ -152,7 +151,6 @@ }, false); document.getElementById("goto-main-menu").addEventListener("click", function () { - html5ks.next = function () {}; html5ks.menu.mainMenu(); }, false); }, -- cgit v1.2.3-70-g09d2