From 6ecf2269d23c48980e1217c0d5b55f50daa3b592 Mon Sep 17 00:00:00 2001 From: Guillermo Ramos Date: Fri, 6 Feb 2015 12:25:01 +0100 Subject: Highlight next transitions --- templates/home.julius | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'templates/home.julius') diff --git a/templates/home.julius b/templates/home.julius index b8c4231..ce1f513 100644 --- a/templates/home.julius +++ b/templates/home.julius @@ -12,6 +12,7 @@ $(function() { var pollInterval = 10000; var playing = false; var timeout = 150; + var transBak = ""; function poll() { sock.send("Poll"); setTimeout(poll, pollInterval); @@ -78,9 +79,22 @@ $(function() { if (data["type"] === "tape") { ui.prTape.html(data["value"]); } else if (data["type"] === "trans") { - ui.prTrans.html(data["value"]); + transBak = data["value"]; + ui.prTrans.html(transBak); } else if (data["type"] === "stop") { togglePlay(); + } else if (data["type"] === "bold") { + var idx = parseInt(data["value"]); + if (idx >= 0) { + var trans = transBak.split("\n"); + idx = idx+3; + trans[idx] = "
" + trans[idx] + "
"; + trans[idx+1] = trans[idx+1] + ui.prTrans.html(trans.join("\n")); + } else { + ui.prTrans.html(transBak); + } } }; sock.onerror = function (e) { -- cgit v1.2.3