diff options
author | Guillermo Ramos | 2015-02-06 12:25:01 +0100 |
---|---|---|
committer | Guillermo Ramos | 2015-02-06 12:25:01 +0100 |
commit | 6ecf2269d23c48980e1217c0d5b55f50daa3b592 (patch) | |
tree | 754ebbdbbee209bd44b0f0565934e22f3abc4f91 /templates/home.julius | |
parent | 1d549d66ac3cb7c7f64c5e05e3280a24e5a2269b (diff) | |
download | turing-web-6ecf2269d23c48980e1217c0d5b55f50daa3b592.tar.gz |
Highlight next transitions
Diffstat (limited to 'templates/home.julius')
-rw-r--r-- | templates/home.julius | 16 |
1 files changed, 15 insertions, 1 deletions
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] = "<div style=\"display: inline; color: #ffffff; " + + "background-color: #000000\">" + trans[idx] + "</div>"; + trans[idx+1] = trans[idx+1] + ui.prTrans.html(trans.join("\n")); + } else { + ui.prTrans.html(transBak); + } } }; sock.onerror = function (e) { |