diff options
author | Alex Xu <alex_y_xu@yahoo.ca> | 2013-12-03 14:22:05 -0500 |
---|---|---|
committer | Alex Xu <alex_y_xu@yahoo.ca> | 2013-12-03 14:22:05 -0500 |
commit | 38779737f641904829b8d07428ea7865309dc907 (patch) | |
tree | a18c72705524314228934c8db0a057601bac2f0a /www | |
parent | c2532af145df03f47aa83ccdad301feed163d584 (diff) | |
download | html5ks-38779737f641904829b8d07428ea7865309dc907.tar.xz html5ks-38779737f641904829b8d07428ea7865309dc907.zip |
More refactoring.
Diffstat (limited to 'www')
-rw-r--r-- | www/js/api.js | 21 | ||||
-rw-r--r-- | www/js/html5ks.js | 5 | ||||
-rw-r--r-- | 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 += "<span class='nvl-block'>" + text + "</span>"; 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); }, |