summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorAlex Xu <alex_y_xu@yahoo.ca>2013-07-01 10:26:53 -0400
committerAlex Xu <alex_y_xu@yahoo.ca>2013-07-01 10:26:53 -0400
commit828588ccb0e7f203c53b1abad1d70f77d3185a81 (patch)
tree3a94267cad0df730147677b40b683a8a7d422365 /www
parent35abacfe70019cc323ae8379729a934e265e4544 (diff)
downloadhtml5ks-828588ccb0e7f203c53b1abad1d70f77d3185a81.tar.xz
html5ks-828588ccb0e7f203c53b1abad1d70f77d3185a81.zip
add nvl
Diffstat (limited to 'www')
-rw-r--r--www/css/index.css16
-rw-r--r--www/index.html4
-rw-r--r--www/js/api.js106
-rw-r--r--www/js/html5ks.js5
4 files changed, 97 insertions, 34 deletions
diff --git a/www/css/index.css b/www/css/index.css
index e5a5c19..85125be 100644
--- a/www/css/index.css
+++ b/www/css/index.css
@@ -35,6 +35,8 @@ body {
#container {
width: 800px;
height: 600px;
+ left: 50%;
+ top: 50%;
margin-top: -300px;
margin-left: -400px;
}
@@ -141,7 +143,7 @@ input[type="checkbox"] + span:before {
input[type="checkbox"]:checked + span:before {
background: url("../dump/ui/bt-cf-checked.png") no-repeat left bottom;
}
-#ctc {
+#ctc, #nvlctc {
position: absolute;
bottom: 20px;
right: 10px;
@@ -149,3 +151,15 @@ input[type="checkbox"]:checked + span:before {
-moz-animation: blink 2s infinite;
animation: blink 2s infinite;
}
+#nvl {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ background: url("../dump/ui/bg-nvl.png") no-repeat top left;
+}
+#nvlsay {
+ padding: 25px 35px;
+ color: white;
+}
diff --git a/www/index.html b/www/index.html
index b01fea4..ff38ee2 100644
--- a/www/index.html
+++ b/www/index.html
@@ -51,6 +51,10 @@
<div id="say"></div>
<img id="ctc" src="dump/ui/ctc.png" style="display: none">
</div>
+ <div id="nvl" style="display: none;">
+ <div id="nvlsay"></div>
+ <img id="nvlctc" src="dump/ui/ctc_rotated.png">
+ </div>
<div id="main-menu" style="display: none;">
<div id="main-menu-buttons" style="top: 377px; position: absolute; left: 81px;">
<div id="start" class="button button-enabled">Start</div>
diff --git a/www/js/api.js b/www/js/api.js
index 1aec74d..34a34d9 100644
--- a/www/js/api.js
+++ b/www/js/api.js
@@ -225,7 +225,8 @@ window.html5ks.api = {
/{\/color}/g, "</span>",
/{w(=\d*\.\d*)?}.*/, "",
/{nw}/, "",
- /{fast}/, ""
+ /{fast}/, "",
+ /\n/g, "<br>"
];
for (var i = 0; i < tags.length - 1; i += 2) {
str = str.replace(tags[i], tags[i+1]);
@@ -233,6 +234,19 @@ window.html5ks.api = {
return str;
},
+ nvlsay: function (text) {
+ var deferred = when.defer();
+ html5ks.elements.nvlsay.innerHTML += text + "<br>";
+ html5ks.elements.nvlctc.style.display = "block";
+ html5ks.next = function () {
+ html5ks.elements.nvlctc.style.display = "none";
+ deferred.resolve();
+ html5ks.next = function () {};
+ };
+ return deferred.promise;
+ },
+
+
character: function (name, str, extend) {
var deferred = when.defer(),
text = this.tag(str),
@@ -248,46 +262,52 @@ window.html5ks.api = {
if ((!w || !w[1] || extend) && char.what_suffix) {
text = text + char.what_suffix;
}
- var who = html5ks.elements.who;
- if (!extend) {
- who.innerHTML = char.name;
- if (char.color) {
- who.style.color = char.color;
- } else {
- who.style.color = "#ffffff";
- }
- }
- if (extend) {
- html5ks.elements.say.innerHTML += text;
+ if (char.kind === "nvl") {
+ this.nvlsay(text).then(function () {
+ deferred.resolve();
+ });
} else {
- html5ks.elements.say.innerHTML = text;
- }
+ var who = html5ks.elements.who;
+ if (!extend) {
+ who.innerHTML = char.name;
+ if (char.color) {
+ who.style.color = char.color;
+ } else {
+ who.style.color = "#ffffff";
+ }
+ }
- if (w) {
- html5ks.next = function () {
- html5ks.next = function () {};
- html5ks.api.extend(str.substring(w.index + w[0].length)).then(function () {
- deferred.resolve();
- });
- };
- if (w[1]) {
- setTimeout(html5ks.next, parseFloat(w[1].substring(1), 10) * 1000);
- return deferred.promise;
+ if (extend) {
+ html5ks.elements.say.innerHTML += text;
+ } else {
+ html5ks.elements.say.innerHTML = text;
}
- } else {
- html5ks.next = function () {
- html5ks.elements.ctc.style.display = "none";
- deferred.resolve(text);
- html5ks.next = function () {};
- };
+
+ if (w) {
+ html5ks.next = function () {
+ html5ks.next = function () {};
+ html5ks.api.extend(str.substring(w.index + w[0].length)).then(function () {
+ deferred.resolve();
+ });
+ };
+ if (w[1]) {
+ setTimeout(html5ks.next, parseFloat(w[1].substring(1), 10) * 1000);
+ return deferred.promise;
+ }
+ } else {
+ html5ks.next = function () {
+ html5ks.elements.ctc.style.display = "none";
+ deferred.resolve(text);
+ html5ks.next = function () {};
+ };
+ }
+ html5ks.elements.ctc.style.display = "block";
}
if (html5ks.state.skip || str.indexOf("{nw}") > -1) {
html5ks.next();
} else if (html5ks.state.auto) {
setTimeout(html5ks.next, 1000 + html5ks.persistent.settings.autospeed * text.length);
- } else {
- html5ks.elements.ctc.style.display = "block";
}
return deferred.promise;
},
@@ -302,5 +322,27 @@ window.html5ks.api = {
deferred.resolve();
}, duration * 1000);
return deferred.promise;
+ },
+
+ nvl: function (action, transition) {
+ var deferred = when.defer(),
+ nvl = html5ks.elements.nvl;
+ switch (action) {
+ case "show":
+ nvl.style.display = "block";
+ deferred.resolve();
+ break;
+ case "hide":
+ nvl.style.display = "none";
+ deferred.resolve();
+ break;
+ case "clear":
+ html5ks.elements.nvlsay.innerHTML = "";
+ deferred.resolve();
+ break;
+ default:
+ console.error("no such nvl action " + action);
+ }
+ return deferred.promise;
}
};
diff --git a/www/js/html5ks.js b/www/js/html5ks.js
index 653b407..86278f0 100644
--- a/www/js/html5ks.js
+++ b/www/js/html5ks.js
@@ -40,7 +40,10 @@ window.html5ks = {
say: document.getElementById("say"),
bg: document.getElementById("bg"),
window: document.getElementById("window"),
- ctc: document.getElementById("ctc")
+ ctc: document.getElementById("ctc"),
+ nvl: document.getElementById("nvl"),
+ nvlsay: document.getElementById("nvlsay"),
+ nvlctc: document.getElementById("nvlctc")
};
this.elements.audio.music.loop = true;
this.elements.audio.ambient.loop = true;