diff --git a/examples/gui/data/css/style.css b/examples/gui/data/css/style.css index fb47e3e..18e86fb 100644 --- a/examples/gui/data/css/style.css +++ b/examples/gui/data/css/style.css @@ -320,7 +320,6 @@ button { display: inline-block; - padding: 10px; border-radius: 3px; color: #fff; diff --git a/examples/gui/data/js/controls.js b/examples/gui/data/js/controls.js index d9422bd..99a9799 100644 --- a/examples/gui/data/js/controls.js +++ b/examples/gui/data/js/controls.js @@ -23,190 +23,250 @@ const C_CARROT = 5; const C_ALIZARIN = 6; const C_NONE = 7; -function colorClass(colorId){ - colorId = Number(colorId); - switch(colorId){ - case C_TURQUOISE: - return "turquoise"; - break; +function colorClass(colorId) { + colorId = Number(colorId); + switch (colorId) { + case C_TURQUOISE: + return "turquoise"; + break; - case C_EMERALD: - return "emerald"; - break; + case C_EMERALD: + return "emerald"; + break; - case C_PETERRIVER: - return "peterriver"; - break; + case C_PETERRIVER: + return "peterriver"; + break; - case C_WETASPHALT: - return "wetasphalt"; - break; + case C_WETASPHALT: + return "wetasphalt"; + break; - case C_SUNFLOWER: - return "sunflower"; - break; + case C_SUNFLOWER: + return "sunflower"; + break; - case C_CARROT: - return "carrot" - break; + case C_CARROT: + return "carrot" + break; - case C_ALIZARIN: - return "alizarin" - break; + case C_ALIZARIN: + return "alizarin" + break; - case C_NONE: - return "" - break; + case C_NONE: + return "" + break; - default: - return ""; - } + default: + return ""; + } } var websock; function start() { - websock = new WebSocket('ws://' + window.location.hostname + '/ws'); - websock.onopen = function(evt) { - console.log('websock open'); - $("#conStatus").addClass("color-green"); - $("#conStatus").text("Connected"); - }; - websock.onclose = function(evt) { - console.log('websock close'); - $("#conStatus").removeClass("color-green"); - $("#conStatus").addClass("color-red"); - $("#conStatus").text("Error / No Connection"); - }; - websock.onerror = function(evt) { - console.log(evt); - $("#conStatus").removeClass("color-green"); - $("#conStatus").addClass("color-red"); - $("#conStatus").text("Error / No Connection"); - }; - websock.onmessage = function(evt) { - console.log(evt); - var data = JSON.parse(evt.data); - var e = document.body; - var center = ""; - switch(data.type){ - case UI_TITEL: - document.title = data.label; - $('#mainHeader').html(data.label); - break; - case UI_LABEL: - $('#row').append("
"+data.label+"

"+data.value+"
"); - break; - case UI_BUTTON: - $('#row').append("
"+data.label+"

"); - $('#'+data.id).on({ 'touchstart' : function(e){e.preventDefault(); buttonclick(data.id, true) } }); - $('#'+data.id).on({ 'touchend' : function(e){e.preventDefault(); buttonclick(data.id, false) } }); - break; - case UI_SWITCHER: - var label = "