From d38dac9c4d208f28a1b0b09821eac33db45882ca Mon Sep 17 00:00:00 2001 From: Dave Kliczbor Date: Tue, 20 Nov 2018 20:00:39 +0100 Subject: [PATCH] Bugfix: Inserting htmlentities via jquery requires .html(), not .text() --- examples/gui/data/js/controls.js | 2 +- examples/gui/data/js/controls.min.js | 2 +- src/dataControlsJS.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/gui/data/js/controls.js b/examples/gui/data/js/controls.js index 359d2c7..7eeb196 100644 --- a/examples/gui/data/js/controls.js +++ b/examples/gui/data/js/controls.js @@ -96,7 +96,7 @@ function conStatusError() { websockConnected = false; $("#conStatus").removeClass("color-green"); $("#conStatus").addClass("color-red"); - $("#conStatus").text("Error / No Connection ↻"); + $("#conStatus").html("Error / No Connection ↻"); $("#conStatus").off(); $("#conStatus").on({ 'click': restart diff --git a/examples/gui/data/js/controls.min.js b/examples/gui/data/js/controls.min.js index 123ac5b..950ceaa 100644 --- a/examples/gui/data/js/controls.min.js +++ b/examples/gui/data/js/controls.min.js @@ -3,7 +3,7 @@ break;case C_ALIZARIN:return"alizarin" break;case C_NONE:return"" break;default:return"";}} var websock;var websockConnected=false;function restart(){$(document).add('*').off();$("#row").html("");websock.close();start();} -function conStatusError(){websockConnected=false;$("#conStatus").removeClass("color-green");$("#conStatus").addClass("color-red");$("#conStatus").text("Error / No Connection ↻");$("#conStatus").off();$("#conStatus").on({'click':restart});} +function conStatusError(){websockConnected=false;$("#conStatus").removeClass("color-green");$("#conStatus").addClass("color-red");$("#conStatus").html("Error / No Connection ↻");$("#conStatus").off();$("#conStatus").on({'click':restart});} function handleVisibilityChange(){if(!websockConnected&&!document.hidden){restart();}} function start(){document.addEventListener("visibilitychange",handleVisibilityChange,false);websock=new WebSocket('ws://'+window.location.hostname+'/ws');websock.onopen=function(evt){console.log('websock open');$("#conStatus").addClass("color-green");$("#conStatus").text("Connected");websockConnected=true;};websock.onclose=function(evt){console.log('websock close');conStatusError();};websock.onerror=function(evt){console.log(evt);conStatusError();};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="