From 19f8928869a265091ea38c452e1f2d8cbcdcf3d3 Mon Sep 17 00:00:00 2001 From: brindosch Date: Thu, 2 Mar 2017 11:52:27 +0100 Subject: [PATCH] update/fix remote --- assets/webconfig/content/remote.html | 2 +- assets/webconfig/i18n/de.json | 1 - assets/webconfig/i18n/en.json | 1 - assets/webconfig/js/content_remote.js | 30 +++++++++++++++++---------- assets/webconfig/js/hyperion.js | 29 +++++++------------------- assets/webconfig/js/ui_utils.js | 8 +++++++ 6 files changed, 35 insertions(+), 36 deletions(-) diff --git a/assets/webconfig/content/remote.html b/assets/webconfig/content/remote.html index 399e0fe9..1b0182d5 100644 --- a/assets/webconfig/content/remote.html +++ b/assets/webconfig/content/remote.html @@ -63,7 +63,7 @@ - + diff --git a/assets/webconfig/i18n/de.json b/assets/webconfig/i18n/de.json index 092c2713..533d080f 100644 --- a/assets/webconfig/i18n/de.json +++ b/assets/webconfig/i18n/de.json @@ -253,7 +253,6 @@ "infoDialog_general_error_title" : "Fehler", "infoDialog_general_warning_title" : "Warnung", "infoDialog_checklist_title" : "Checkliste!", - "InfoDialog_leds_validfail_title" : "JSON Überprüfung fehlgeschlagen!", "infoDialog_effconf_deleted_text" : "Der Effekt \"$1\" wurde erfolgreich entfernt!", "infoDialog_effconf_created_text" : "Der Effekt \"$1\" wurde erfolgreich erstellt!", "InfoDialog_lang_title" : "Spracheinstellung", diff --git a/assets/webconfig/i18n/en.json b/assets/webconfig/i18n/en.json index e3bad5fd..d1062bc4 100644 --- a/assets/webconfig/i18n/en.json +++ b/assets/webconfig/i18n/en.json @@ -253,7 +253,6 @@ "infoDialog_general_error_title" : "Error", "infoDialog_general_warning_title" : "Warning", "infoDialog_checklist_title" : "Checklist!", - "InfoDialog_leds_validfail_title" : "JSON Validation failed!", "infoDialog_effconf_deleted_text" : "The effect \"$1\" has been deleted successfully!", "infoDialog_effconf_created_text" : "The effect \"$1\" has been created successfully!", "InfoDialog_lang_title" : "Language setting", diff --git a/assets/webconfig/js/content_remote.js b/assets/webconfig/js/content_remote.js index c4c6c3cd..40b70f1a 100644 --- a/assets/webconfig/js/content_remote.js +++ b/assets/webconfig/js/content_remote.js @@ -92,7 +92,15 @@ $(document).ready(function() { for(i = 0; i < prios.length; i++) { var origin = prios[i].origin; - var ip = "xxx.xxx.xxx.xxx"; + if(typeof origin !== "undefined" && origin != "") + { + origin = origin.split("@"); + var ip = origin[1]; + origin = origin[0]; + } + else + origin = "System"; + var owner = prios[i].owner; var active = prios[i].active; var visible = prios[i].visible; @@ -102,7 +110,7 @@ $(document).ready(function() { var btn_type = "default"; var btn_text = $.i18n('remote_input_setsource_btn'); var btn_state = "enabled"; - if (active) btn_type = "warning"; + if (active) btn_type = "primary"; if (visible) { btn_state = "disabled"; @@ -111,26 +119,26 @@ $(document).ready(function() { } if(ip) origin += '
'+$.i18n('remote_input_ip')+' '+ip+''; - if(compId == "10") + if(compId == 10) owner = $.i18n('remote_effects_label_effects')+' '+owner; - if(compId == "9") + if(compId == 9) owner = $.i18n('remote_color_label_color')+' '+'
'; - if(compId == "7") + if(compId == 7) owner = $.i18n('general_comp_GRABBER')+': ('+owner+')'; - if(compId == "8") + if(compId == 8) owner = $.i18n('general_comp_V4L')+': ('+owner+')'; - if(compId == "6") + if(compId == 6) owner = $.i18n('general_comp_BOBLIGHTSERVER'); - if(compId == "5") + if(compId == 5) owner = $.i18n('general_comp_UDPLISTENER'); if(owner == "Off") owner = $.i18n('general_btn_off'); - if(duration) + if(duration && compId != 7 && compId != 11) owner += '
'+$.i18n('remote_input_duration')+' '+duration.toFixed(0)+$.i18n('edt_append_s')+''; var btn = ''; - if((compId == "10" || compId == "9") && priority != 254) + if((compId == 10 || compId == 9) && priority != 254) btn += ''; if(btn_type != 'default') @@ -159,7 +167,7 @@ $(document).ready(function() { if(mapping == mappingList[ix]) btn_style = 'btn-success'; else - btn_style = 'btn-warning'; + btn_style = 'btn-primary'; $('#mappingsbutton').append('
'); } diff --git a/assets/webconfig/js/hyperion.js b/assets/webconfig/js/hyperion.js index 8b4e0d44..b08b00ff 100644 --- a/assets/webconfig/js/hyperion.js +++ b/assets/webconfig/js/hyperion.js @@ -219,33 +219,18 @@ function requestPriorityClear(prio) } function requestPlayEffect(effectName, duration) -{ - if(typeof duration === "undefined" || duration < 0) - duration = 0; - else - duration *= 1000; - - sendToHyperion("effect", "", '"effect":{"name":"'+effectName+'"},"priority":'+webPrio+',"duration":'+duration+',"origin":"'+webOrigin+'"'); +{ + sendToHyperion("effect", "", '"effect":{"name":"'+effectName+'"},"priority":'+webPrio+',"duration":'+validateDuration(duration)+',"origin":"'+webOrigin+'"'); } function requestSetColor(r,g,b,duration) -{ - if(typeof duration === "undefined" || duration < 0) - duration = 0; - else - duration *= 1000; - - sendToHyperion("color", "", '"color":['+r+','+g+','+b+'], "priority":'+webPrio+',"duration":'+duration+',"origin":"'+webOrigin+'"'); +{ + sendToHyperion("color", "", '"color":['+r+','+g+','+b+'], "priority":'+webPrio+',"duration":'+validateDuration(duration)+',"origin":"'+webOrigin+'"'); } function requestSetImage(data,width,height,duration) -{ - if(typeof duration === "undefined" || duration < 0) - duration = 0; - else - duration *= 1000; - - sendToHyperion("image", "", '"imagedata":"'+data+'", "imagewidth":'+width+',"imageheight":'+height+', "priority":'+webPrio+',"duration":'+duration+''); +{ + sendToHyperion("image", "", '"imagedata":"'+data+'", "imagewidth":'+width+',"imageheight":'+height+', "priority":'+webPrio+',"duration":'+validateDuration(duration)+''); } function requestSetComponentState(comp, state) @@ -292,7 +277,7 @@ function requestWriteEffect(effectName,effectPy,effectArgs) function requestTestEffect(effectName,effectPy,effectArgs) { - sendToHyperion("effect", "", '"effect":{"name":"'+effectName+'", "args":'+effectArgs+'},"priority":'+webPrio+', "pythonScript":"'+effectPy+'"}'); + sendToHyperion("effect", "", '"effect":{"name":"'+effectName+'", "args":'+effectArgs+'}, "priority":'+webPrio+', "origin":"'+webOrigin+'", "pythonScript":"'+effectPy+'"}'); } function requestDeleteEffect(effectName) diff --git a/assets/webconfig/js/ui_utils.js b/assets/webconfig/js/ui_utils.js index f7a6c529..4e698a23 100644 --- a/assets/webconfig/js/ui_utils.js +++ b/assets/webconfig/js/ui_utils.js @@ -48,6 +48,14 @@ function debugMessage(msg) } } +function validateDuration(d) +{ + if(typeof d === "undefined" || d < 0) + return d = 0; + else + return d *= 1000; +} + function getHashtag() { if(getStorage('lasthashtag', true) != null)