@@ -19,7 +19,6 @@ $(document).ready(function () {
1919 $ ( '.ssthead' ) . html ( createTableRow ( [ $ . i18n ( 'remote_input_origin' ) , $ . i18n ( 'remote_input_owner' ) , $ . i18n ( 'remote_input_priority' ) , $ . i18n ( 'remote_input_status' ) ] , true , true ) ) ;
2020 createTable ( 'crthead' , 'crtbody' , 'adjust_content' , true ) ;
2121
22-
2322 //create introduction
2423 if ( window . showOptHelp ) {
2524 createHint ( "intro" , $ . i18n ( 'remote_color_intro' , $ . i18n ( 'remote_losthint' ) ) , "color_intro" ) ;
@@ -30,56 +29,6 @@ $(document).ready(function () {
3029 createHint ( "intro" , $ . i18n ( 'remote_videoMode_intro' , $ . i18n ( 'remote_losthint' ) ) , "videomode_intro" ) ;
3130 }
3231
33- //color adjustment
34- var sColor = sortProperties ( window . serverSchema . properties . color . properties . channelAdjustment . items . properties ) ;
35- var values = window . serverInfo . adjustment [ 0 ] ;
36-
37- for ( var key in sColor ) {
38- if ( sColor [ key ] . key != "id" && sColor [ key ] . key != "leds" ) {
39- var title = '<label for="cr_' + sColor [ key ] . key + '">' + $ . i18n ( sColor [ key ] . title ) + '</label>' ;
40- var property ;
41- var value = values [ sColor [ key ] . key ] ;
42-
43- if ( sColor [ key ] . type == "array" ) {
44- property = '<div id="cr_' + sColor [ key ] . key + '" class="input-group colorpicker-component" ><input type="text" class="form-control" /><span class="input-group-addon"><i></i></span></div>' ;
45- $ ( '.crtbody' ) . append ( createTableRow ( [ title , property ] , false , true ) ) ;
46- createCP ( 'cr_' + sColor [ key ] . key , value , function ( rgb , hex , e ) {
47- requestAdjustment ( e . target . id . substr ( e . target . id . indexOf ( "_" ) + 1 ) , '[' + rgb . r + ',' + rgb . g + ',' + rgb . b + ']' ) ;
48- } ) ;
49- }
50- else if ( sColor [ key ] . type == "boolean" ) {
51- property = '<div class="checkbox"><input id="cr_' + sColor [ key ] . key + '" type="checkbox" value="' + value + '"/><label></label></div>' ;
52- $ ( '.crtbody' ) . append ( createTableRow ( [ title , property ] , false , true ) ) ;
53-
54- $ ( '#cr_' + sColor [ key ] . key ) . off ( ) . on ( 'change' , function ( e ) {
55- requestAdjustment ( e . target . id . substr ( e . target . id . indexOf ( "_" ) + 1 ) , e . currentTarget . checked ) ;
56- } ) ;
57- }
58- else {
59- if ( sColor [ key ] . key == "brightness" ||
60- sColor [ key ] . key == "brightnessCompensation" ||
61- sColor [ key ] . key == "backlightThreshold" ||
62- sColor [ key ] . key == "saturationGain" ||
63- sColor [ key ] . key == "brightnessGain" ) {
64-
65- property = '<input id="cr_' + sColor [ key ] . key + '" type="number" class="form-control" min="' + sColor [ key ] . minimum + '" max="' + sColor [ key ] . maximum + '" step="' + sColor [ key ] . step + '" value="' + value + '"/>' ;
66- if ( sColor [ key ] . append === "edt_append_percent" ) {
67- property = '<div class="input-group">' + property + '<span class="input-group-addon">' + $ . i18n ( "edt_append_percent" ) + '</span></div>' ;
68- }
69- }
70- else {
71- property = '<input id="cr_' + sColor [ key ] . key + '" type="number" class="form-control" min="0.1" max="4.0" step="0.1" value="' + value + '"/>' ;
72- }
73-
74- $ ( '.crtbody' ) . append ( createTableRow ( [ title , property ] , false , true ) ) ;
75- $ ( '#cr_' + sColor [ key ] . key ) . off ( ) . on ( 'change' , function ( e ) {
76- valValue ( this . id , this . value , this . min , this . max ) ;
77- requestAdjustment ( e . target . id . substr ( e . target . id . indexOf ( "_" ) + 1 ) , e . currentTarget . value ) ;
78- } ) ;
79- }
80- }
81- }
82-
8332 function sendEffect ( ) {
8433 var efx = $ ( "#effect_select" ) . val ( ) ;
8534 if ( efx != "__none__" ) {
@@ -94,6 +43,59 @@ $(document).ready(function () {
9443 requestSetColor ( rgb . r , rgb . g , rgb . b , duration ) ;
9544 }
9645
46+ function updateChannelAdjustments ( ) {
47+
48+ $ ( '.crtbody' ) . html ( "" ) ;
49+ var sColor = sortProperties ( window . serverSchema . properties . color . properties . channelAdjustment . items . properties ) ;
50+ var values = window . serverInfo . adjustment [ 0 ] ;
51+
52+ for ( var key in sColor ) {
53+ if ( sColor [ key ] . key != "id" && sColor [ key ] . key != "leds" ) {
54+ var title = '<label for="cr_' + sColor [ key ] . key + '">' + $ . i18n ( sColor [ key ] . title ) + '</label>' ;
55+ var property ;
56+ var value = values [ sColor [ key ] . key ] ;
57+
58+ if ( sColor [ key ] . type == "array" ) {
59+ property = '<div id="cr_' + sColor [ key ] . key + '" class="input-group colorpicker-component" ><input type="text" class="form-control" /><span class="input-group-addon"><i></i></span></div>' ;
60+ $ ( '.crtbody' ) . append ( createTableRow ( [ title , property ] , false , true ) ) ;
61+ createCP ( 'cr_' + sColor [ key ] . key , value , function ( rgb , hex , e ) {
62+ requestAdjustment ( e . target . id . substr ( e . target . id . indexOf ( "_" ) + 1 ) , '[' + rgb . r + ',' + rgb . g + ',' + rgb . b + ']' ) ;
63+ } ) ;
64+ }
65+ else if ( sColor [ key ] . type == "boolean" ) {
66+ property = '<div class="checkbox"><input id="cr_' + sColor [ key ] . key + '" type="checkbox" ' + ( value ? "checked" : "" ) + '/><label></label></div>' ;
67+ $ ( '.crtbody' ) . append ( createTableRow ( [ title , property ] , false , true ) ) ;
68+
69+ $ ( '#cr_' + sColor [ key ] . key ) . off ( ) . on ( 'change' , function ( e ) {
70+ requestAdjustment ( e . target . id . substr ( e . target . id . indexOf ( "_" ) + 1 ) , e . currentTarget . checked ) ;
71+ } ) ;
72+ }
73+ else {
74+ if ( sColor [ key ] . key == "brightness" ||
75+ sColor [ key ] . key == "brightnessCompensation" ||
76+ sColor [ key ] . key == "backlightThreshold" ||
77+ sColor [ key ] . key == "saturationGain" ||
78+ sColor [ key ] . key == "brightnessGain" ) {
79+
80+ property = '<input id="cr_' + sColor [ key ] . key + '" type="number" class="form-control" min="' + sColor [ key ] . minimum + '" max="' + sColor [ key ] . maximum + '" step="' + sColor [ key ] . step + '" value="' + value + '"/>' ;
81+ if ( sColor [ key ] . append === "edt_append_percent" ) {
82+ property = '<div class="input-group">' + property + '<span class="input-group-addon">' + $ . i18n ( "edt_append_percent" ) + '</span></div>' ;
83+ }
84+ }
85+ else {
86+ property = '<input id="cr_' + sColor [ key ] . key + '" type="number" class="form-control" min="0.1" max="4.0" step="0.1" value="' + value + '"/>' ;
87+ }
88+
89+ $ ( '.crtbody' ) . append ( createTableRow ( [ title , property ] , false , true ) ) ;
90+ $ ( '#cr_' + sColor [ key ] . key ) . off ( ) . on ( 'change' , function ( e ) {
91+ valValue ( this . id , this . value , this . min , this . max ) ;
92+ requestAdjustment ( e . target . id . substr ( e . target . id . indexOf ( "_" ) + 1 ) , e . currentTarget . value ) ;
93+ } ) ;
94+ }
95+ }
96+ }
97+ }
98+
9799 function updateInputSelect ( ) {
98100 $ ( '.sstbody' ) . html ( "" ) ;
99101 var prios = window . serverInfo . priorities ;
@@ -389,6 +391,7 @@ $(document).ready(function () {
389391 updateInputSelect ( ) ;
390392 updateLedMapping ( ) ;
391393 updateVideoMode ( ) ;
394+ updateChannelAdjustments ( ) ;
392395 if ( EFFECTENGINE_ENABLED ) {
393396 updateEffectlist ( ) ;
394397 } else {
@@ -421,6 +424,16 @@ $(document).ready(function () {
421424 updateEffectlist ( ) ;
422425 } ) ;
423426
427+ $ ( window . hyperion ) . on ( "cmd-settings-update" , function ( event ) {
428+ if ( event . response . data . color ) {
429+ window . serverInfo . imageToLedMappingType = event . response . data . color . imageToLedMappingType ;
430+ updateLedMapping ( ) ;
431+
432+ window . serverInfo . adjustment = event . response . data . color . channelAdjustment ;
433+ updateChannelAdjustments ( ) ;
434+ }
435+ } ) ;
436+
424437 removeOverlay ( ) ;
425438} ) ;
426439
0 commit comments