From 92c6f13bbe48a47f932ac94677cd61f4c97ab090 Mon Sep 17 00:00:00 2001 From: Guillermo Ramos Date: Thu, 5 Feb 2015 16:50:43 +0100 Subject: JSON-formatted commands --- templates/home.hamlet | 4 ++-- templates/home.julius | 15 +++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'templates') diff --git a/templates/home.hamlet b/templates/home.hamlet index 4155dbb..9b429b5 100644 --- a/templates/home.hamlet +++ b/templates/home.hamlet @@ -4,7 +4,7 @@
+ @@ -17,4 +17,4 @@ - + diff --git a/templates/home.julius b/templates/home.julius index 0c33c09..e679e40 100644 --- a/templates/home.julius +++ b/templates/home.julius @@ -4,8 +4,8 @@ $(function() { bBackward : $("##{rawJS butBackward}"), bTogglePlay : $("##{rawJS butTogglePlay}"), bForward : $("##{rawJS butForward}"), - results : $("##{rawJS results}"), - state : $("##{rawJS state}") + prTape : $("##{rawJS prTape}"), + prTrans : $("##{rawJS prTrans}") }; var pollInterval = 10000; var playing = false; @@ -65,12 +65,11 @@ $(function() { alert("SOCKET CLOSED! D: (" + e.code + ")"); }; sock.onmessage = function (e) { - // var data = JSON.parse(e.data); - var data = e.data; - if (data[1] === "+") { - ui.state.html(data); - } else { - ui.results.html(data); + var data = JSON.parse(e.data); + if (data["type"] === "tape") { + ui.prTape.html(data["value"]); + } else if (data["type"] === "trans") { + ui.prTrans.html(data["value"]); } }; sock.onerror = function (e) { -- cgit v1.2.3
@@ -17,4 +17,4 @@ - + diff --git a/templates/home.julius b/templates/home.julius index 0c33c09..e679e40 100644 --- a/templates/home.julius +++ b/templates/home.julius @@ -4,8 +4,8 @@ $(function() { bBackward : $("##{rawJS butBackward}"), bTogglePlay : $("##{rawJS butTogglePlay}"), bForward : $("##{rawJS butForward}"), - results : $("##{rawJS results}"), - state : $("##{rawJS state}") + prTape : $("##{rawJS prTape}"), + prTrans : $("##{rawJS prTrans}") }; var pollInterval = 10000; var playing = false; @@ -65,12 +65,11 @@ $(function() { alert("SOCKET CLOSED! D: (" + e.code + ")"); }; sock.onmessage = function (e) { - // var data = JSON.parse(e.data); - var data = e.data; - if (data[1] === "+") { - ui.state.html(data); - } else { - ui.results.html(data); + var data = JSON.parse(e.data); + if (data["type"] === "tape") { + ui.prTape.html(data["value"]); + } else if (data["type"] === "trans") { + ui.prTrans.html(data["value"]); } }; sock.onerror = function (e) { -- cgit v1.2.3
+ diff --git a/templates/home.julius b/templates/home.julius index 0c33c09..e679e40 100644 --- a/templates/home.julius +++ b/templates/home.julius @@ -4,8 +4,8 @@ $(function() { bBackward : $("##{rawJS butBackward}"), bTogglePlay : $("##{rawJS butTogglePlay}"), bForward : $("##{rawJS butForward}"), - results : $("##{rawJS results}"), - state : $("##{rawJS state}") + prTape : $("##{rawJS prTape}"), + prTrans : $("##{rawJS prTrans}") }; var pollInterval = 10000; var playing = false; @@ -65,12 +65,11 @@ $(function() { alert("SOCKET CLOSED! D: (" + e.code + ")"); }; sock.onmessage = function (e) { - // var data = JSON.parse(e.data); - var data = e.data; - if (data[1] === "+") { - ui.state.html(data); - } else { - ui.results.html(data); + var data = JSON.parse(e.data); + if (data["type"] === "tape") { + ui.prTape.html(data["value"]); + } else if (data["type"] === "trans") { + ui.prTrans.html(data["value"]); } }; sock.onerror = function (e) { -- cgit v1.2.3
diff --git a/templates/home.julius b/templates/home.julius index 0c33c09..e679e40 100644 --- a/templates/home.julius +++ b/templates/home.julius @@ -4,8 +4,8 @@ $(function() { bBackward : $("##{rawJS butBackward}"), bTogglePlay : $("##{rawJS butTogglePlay}"), bForward : $("##{rawJS butForward}"), - results : $("##{rawJS results}"), - state : $("##{rawJS state}") + prTape : $("##{rawJS prTape}"), + prTrans : $("##{rawJS prTrans}") }; var pollInterval = 10000; var playing = false; @@ -65,12 +65,11 @@ $(function() { alert("SOCKET CLOSED! D: (" + e.code + ")"); }; sock.onmessage = function (e) { - // var data = JSON.parse(e.data); - var data = e.data; - if (data[1] === "+") { - ui.state.html(data); - } else { - ui.results.html(data); + var data = JSON.parse(e.data); + if (data["type"] === "tape") { + ui.prTape.html(data["value"]); + } else if (data["type"] === "trans") { + ui.prTrans.html(data["value"]); } }; sock.onerror = function (e) { -- cgit v1.2.3