2017-02-08 14:36:28 +01:00
|
|
|
$(document).ready(function() {
|
2020-05-12 19:56:06 +02:00
|
|
|
performTranslation();
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
var oldEffects = [];
|
|
|
|
var cpcolor = '#B500FF';
|
2019-06-05 18:19:08 +02:00
|
|
|
var mappingList = window.serverSchema.properties.color.properties.imageToLedMappingType.enum;
|
2017-02-28 17:53:41 +01:00
|
|
|
var duration = 0;
|
2017-04-07 21:33:40 +02:00
|
|
|
var rgb = {r:255,g:0,b:0};
|
2019-08-21 16:10:35 +02:00
|
|
|
var lastImgData = "";
|
|
|
|
var lastFileName= "";
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
//create html
|
|
|
|
createTable('ssthead', 'sstbody', 'sstcont');
|
|
|
|
$('.ssthead').html(createTableRow([$.i18n('remote_input_origin'), $.i18n('remote_input_owner'), $.i18n('remote_input_priority'), $.i18n('remote_input_status')], true, true));
|
|
|
|
createTable('crthead', 'crtbody', 'adjust_content', true);
|
2017-09-04 23:12:59 +02:00
|
|
|
|
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
//create introduction
|
2019-06-05 18:19:08 +02:00
|
|
|
if(window.showOptHelp)
|
2017-02-08 14:36:28 +01:00
|
|
|
{
|
|
|
|
createHint("intro", $.i18n('remote_color_intro', $.i18n('remote_losthint')), "color_intro");
|
|
|
|
createHint("intro", $.i18n('remote_input_intro', $.i18n('remote_losthint')), "sstcont");
|
|
|
|
createHint("intro", $.i18n('remote_adjustment_intro', $.i18n('remote_losthint')), "adjust_content");
|
|
|
|
createHint("intro", $.i18n('remote_components_intro', $.i18n('remote_losthint')), "comp_intro");
|
|
|
|
createHint("intro", $.i18n('remote_maptype_intro', $.i18n('remote_losthint')), "maptype_intro");
|
2017-09-04 23:12:59 +02:00
|
|
|
createHint("intro", $.i18n('remote_videoMode_intro', $.i18n('remote_losthint')), "videomode_intro");
|
2017-02-08 14:36:28 +01:00
|
|
|
}
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
//color adjustment
|
2019-06-05 18:19:08 +02:00
|
|
|
var sColor = sortProperties(window.serverSchema.properties.color.properties.channelAdjustment.items.properties);
|
|
|
|
var values = window.serverInfo.adjustment[0];
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
for(var key in sColor)
|
2017-02-08 14:36:28 +01:00
|
|
|
{
|
|
|
|
if(sColor[key].key != "id" && sColor[key].key != "leds")
|
|
|
|
{
|
|
|
|
var title = '<label for="cr_'+sColor[key].key+'">'+$.i18n(sColor[key].title)+'</label>';
|
|
|
|
var property;
|
2019-06-05 18:19:08 +02:00
|
|
|
var value = values[sColor[key].key];
|
2017-02-08 14:36:28 +01:00
|
|
|
|
|
|
|
if(sColor[key].type == "array")
|
|
|
|
{
|
|
|
|
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>';
|
|
|
|
$('.crtbody').append(createTableRow([title, property], false, true));
|
|
|
|
createCP('cr_'+sColor[key].key, value, function(rgb,hex,e){
|
|
|
|
requestAdjustment(e.target.id.substr(e.target.id.indexOf("_") + 1), '['+rgb.r+','+rgb.g+','+rgb.b+']');
|
|
|
|
});
|
|
|
|
}
|
2017-02-15 15:53:35 +01:00
|
|
|
else if(sColor[key].type == "boolean")
|
|
|
|
{
|
|
|
|
property = '<div class="checkbox"><input id="cr_'+sColor[key].key+'" type="checkbox" value="'+value+'"/><label></label></div>';
|
|
|
|
$('.crtbody').append(createTableRow([title, property], false, true));
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-02-15 15:53:35 +01:00
|
|
|
$('#cr_'+sColor[key].key).off().on('change', function(e){
|
|
|
|
requestAdjustment(e.target.id.substr(e.target.id.indexOf("_") + 1), e.currentTarget.checked);
|
|
|
|
});
|
|
|
|
}
|
2017-02-08 14:36:28 +01:00
|
|
|
else
|
|
|
|
{
|
2017-09-04 23:12:59 +02:00
|
|
|
if(sColor[key].key == "brightness" || sColor[key].key == "brightnessCompensation" || sColor[key].key == "backlightThreshold")
|
2017-04-07 21:33:40 +02:00
|
|
|
property = '<div class="input-group"><input id="cr_'+sColor[key].key+'" type="number" class="form-control" min="0" max="100" step="10" value="'+value+'"/><span class="input-group-addon">'+$.i18n("edt_append_percent")+'</span></div>';
|
2017-02-08 14:36:28 +01:00
|
|
|
else
|
2017-03-24 10:17:36 +01:00
|
|
|
property = '<input id="cr_'+sColor[key].key+'" type="number" class="form-control" min="0.1" max="4.0" step="0.1" value="'+value+'"/>';
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
$('.crtbody').append(createTableRow([title, property], false, true));
|
|
|
|
$('#cr_'+sColor[key].key).off().on('change', function(e){
|
2017-02-28 17:53:41 +01:00
|
|
|
valValue(this.id,this.value,this.min,this.max);
|
2017-02-08 14:36:28 +01:00
|
|
|
requestAdjustment(e.target.id.substr(e.target.id.indexOf("_") + 1), e.currentTarget.value);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-07 21:33:40 +02:00
|
|
|
function sendEffect()
|
|
|
|
{
|
2019-06-05 18:19:08 +02:00
|
|
|
var efx = $("#effect_select").val();
|
2017-04-07 21:33:40 +02:00
|
|
|
if(efx != "__none__")
|
|
|
|
{
|
|
|
|
requestPriorityClear();
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).one("cmd-clear", function(event) {
|
2017-04-07 21:33:40 +02:00
|
|
|
setTimeout(function() {requestPlayEffect(efx,duration)}, 100);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-04-07 21:33:40 +02:00
|
|
|
function sendColor()
|
|
|
|
{
|
|
|
|
requestSetColor(rgb.r, rgb.g, rgb.b,duration);
|
|
|
|
}
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2016-09-09 18:59:58 +02:00
|
|
|
function updateInputSelect()
|
2017-09-04 23:12:59 +02:00
|
|
|
{
|
2017-02-08 14:36:28 +01:00
|
|
|
$('.sstbody').html("");
|
2019-06-05 18:19:08 +02:00
|
|
|
var prios = window.serverInfo.priorities;
|
2017-03-24 10:17:36 +01:00
|
|
|
var clearAll = false;
|
2017-02-28 17:53:41 +01:00
|
|
|
|
2019-07-29 19:09:26 +02:00
|
|
|
for(var i = 0; i < prios.length; i++)
|
2017-01-17 21:53:35 +01:00
|
|
|
{
|
2017-03-24 10:17:36 +01:00
|
|
|
var origin = prios[i].origin ? prios[i].origin : "System";
|
|
|
|
origin = origin.split("@");
|
|
|
|
var ip = origin[1];
|
|
|
|
origin = origin[0];
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-01-17 21:53:35 +01:00
|
|
|
var owner = prios[i].owner;
|
|
|
|
var active = prios[i].active;
|
|
|
|
var visible = prios[i].visible;
|
|
|
|
var priority = prios[i].priority;
|
|
|
|
var compId = prios[i].componentId;
|
|
|
|
var duration = prios[i].duration_ms/1000;
|
2018-12-27 23:11:32 +01:00
|
|
|
var value = "0,0,0";
|
2016-09-09 18:59:58 +02:00
|
|
|
var btn_type = "default";
|
2017-01-17 21:53:35 +01:00
|
|
|
var btn_text = $.i18n('remote_input_setsource_btn');
|
|
|
|
var btn_state = "enabled";
|
2017-03-30 06:20:20 +02:00
|
|
|
|
|
|
|
if (active)
|
|
|
|
btn_type = "primary";
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-03-30 06:20:20 +02:00
|
|
|
if(priority > 254)
|
|
|
|
continue;
|
2019-08-21 16:10:35 +02:00
|
|
|
if(priority < 254 && (compId == "EFFECT" || compId == "COLOR" || compId == "IMAGE") )
|
2017-03-30 06:20:20 +02:00
|
|
|
clearAll = true;
|
|
|
|
|
2017-01-17 21:53:35 +01:00
|
|
|
if (visible)
|
|
|
|
{
|
|
|
|
btn_state = "disabled";
|
|
|
|
btn_type = "success";
|
|
|
|
btn_text = $.i18n('remote_input_sourceactiv_btn');
|
|
|
|
}
|
2017-03-30 06:20:20 +02:00
|
|
|
|
2017-01-17 21:53:35 +01:00
|
|
|
if(ip)
|
|
|
|
origin += '<br/><span style="font-size:80%; color:grey;">'+$.i18n('remote_input_ip')+' '+ip+'</span>';
|
2017-03-30 06:20:20 +02:00
|
|
|
|
2018-12-27 23:11:32 +01:00
|
|
|
if("value" in prios[i])
|
|
|
|
value = prios[i].value.RGB;
|
|
|
|
|
2017-03-30 06:20:20 +02:00
|
|
|
switch (compId)
|
2017-03-24 10:17:36 +01:00
|
|
|
{
|
2017-03-30 06:20:20 +02:00
|
|
|
case "EFFECT":
|
|
|
|
owner = $.i18n('remote_effects_label_effects')+' '+owner;
|
|
|
|
break;
|
|
|
|
case "COLOR":
|
2018-12-27 23:11:32 +01:00
|
|
|
owner = $.i18n('remote_color_label_color')+' '+'<div style="width:18px; height:18px; border-radius:20px; margin-bottom:-4px; border:1px grey solid; background-color: rgb('+value+'); display:inline-block" title="RGB: ('+value+')"></div>';
|
2017-03-30 06:20:20 +02:00
|
|
|
break;
|
2019-08-21 16:10:35 +02:00
|
|
|
case "IMAGE":
|
|
|
|
owner = $.i18n('remote_effects_label_picture')+' '+owner;
|
|
|
|
break;
|
2017-03-30 06:20:20 +02:00
|
|
|
case "GRABBER":
|
|
|
|
owner = $.i18n('general_comp_GRABBER')+': ('+owner+')';
|
|
|
|
break;
|
|
|
|
case "V4L":
|
|
|
|
owner = $.i18n('general_comp_V4L')+': ('+owner+')';
|
|
|
|
break;
|
|
|
|
case "BOBLIGHTSERVER":
|
|
|
|
owner = $.i18n('general_comp_BOBLIGHTSERVER');
|
|
|
|
break;
|
2018-12-31 00:21:44 +01:00
|
|
|
case "FLATBUFSERVER":
|
|
|
|
owner = $.i18n('general_comp_FLATBUFSERVER');
|
2018-12-27 23:11:32 +01:00
|
|
|
break;
|
2019-02-17 15:26:11 +01:00
|
|
|
case "PROTOSERVER":
|
|
|
|
owner = $.i18n('general_comp_PROTOSERVER');
|
|
|
|
break;
|
2017-03-24 10:17:36 +01:00
|
|
|
}
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2019-02-17 15:26:11 +01:00
|
|
|
if(duration && compId != "GRABBER" && compId != "FLATBUFSERVER" && compId != "PROTOSERVER")
|
2017-01-17 21:53:35 +01:00
|
|
|
owner += '<br/><span style="font-size:80%; color:grey;">'+$.i18n('remote_input_duration')+' '+duration.toFixed(0)+$.i18n('edt_append_s')+'</span>';
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-01-17 21:53:35 +01:00
|
|
|
var btn = '<button id="srcBtn'+i+'" type="button" '+btn_state+' class="btn btn-'+btn_type+' btn_input_selection" onclick="requestSetSource('+priority+');">'+btn_text+'</button>';
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2019-08-21 16:10:35 +02:00
|
|
|
if((compId == "EFFECT" || compId == "COLOR" || compId == "IMAGE") && priority < 254)
|
2017-01-17 21:53:35 +01:00
|
|
|
btn += '<button type="button" class="btn btn-sm btn-danger" style="margin-left:10px;" onclick="requestPriorityClear('+priority+');"><i class="fa fa-close"></button>';
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2016-12-21 18:24:03 +01:00
|
|
|
if(btn_type != 'default')
|
2017-02-08 14:36:28 +01:00
|
|
|
$('.sstbody').append(createTableRow([origin, owner, priority, btn], false, true));
|
2016-09-09 18:59:58 +02:00
|
|
|
}
|
2019-06-05 18:19:08 +02:00
|
|
|
var btn_auto_color = (window.serverInfo.priorities_autoselect? "btn-success" : "btn-danger");
|
|
|
|
var btn_auto_state = (window.serverInfo.priorities_autoselect? "disabled" : "enabled");
|
|
|
|
var btn_auto_text = (window.serverInfo.priorities_autoselect? $.i18n('general_btn_on') : $.i18n('general_btn_off'));
|
2017-03-24 10:17:36 +01:00
|
|
|
var btn_call_state = (clearAll? "enabled" : "disabled");
|
|
|
|
$('#auto_btn').html('<button id="srcBtn'+i+'" type="button" '+btn_auto_state+' class="btn '+btn_auto_color+'" style="margin-right:5px;display:inline-block;" onclick="requestSetSource(\'auto\');">'+$.i18n('remote_input_label_autoselect')+' ('+btn_auto_text+')</button>');
|
|
|
|
$('#auto_btn').append('<button type="button" '+btn_call_state+' class="btn btn-danger" style="display:inline-block;" onclick="requestClearAll();">'+$.i18n('remote_input_clearall')+'</button>');
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-01-17 21:53:35 +01:00
|
|
|
var max_width=100;
|
2016-09-09 18:59:58 +02:00
|
|
|
$('.btn_input_selection').each(function() {
|
|
|
|
if ($(this).innerWidth() > max_width)
|
|
|
|
max_width = $(this).innerWidth();
|
|
|
|
});
|
2017-09-04 23:12:59 +02:00
|
|
|
$('.btn_input_selection').css("min-width",max_width+"px");
|
2016-09-09 18:59:58 +02:00
|
|
|
}
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2016-12-21 18:24:03 +01:00
|
|
|
function updateLedMapping()
|
|
|
|
{
|
2019-06-05 18:19:08 +02:00
|
|
|
var mapping = window.serverInfo.imageToLedMappingType;
|
2016-12-21 18:24:03 +01:00
|
|
|
|
|
|
|
$('#mappingsbutton').html("");
|
|
|
|
for(var ix = 0; ix < mappingList.length; ix++)
|
|
|
|
{
|
|
|
|
if(mapping == mappingList[ix])
|
2019-06-05 18:19:08 +02:00
|
|
|
var btn_style = 'btn-success';
|
2016-12-21 18:24:03 +01:00
|
|
|
else
|
2019-06-05 18:19:08 +02:00
|
|
|
var btn_style = 'btn-primary';
|
2016-12-21 18:24:03 +01:00
|
|
|
|
2017-03-24 10:17:36 +01:00
|
|
|
$('#mappingsbutton').append('<button type="button" id="lmBtn_'+mappingList[ix]+'" class="btn '+btn_style+'" style="margin:3px;min-width:200px" onclick="requestMappingType(\''+mappingList[ix]+'\');">'+$.i18n('remote_maptype_label_'+mappingList[ix])+'</button><br/>');
|
2016-12-21 18:24:03 +01:00
|
|
|
}
|
|
|
|
}
|
2016-09-09 18:59:58 +02:00
|
|
|
|
2020-05-12 19:56:06 +02:00
|
|
|
function initComponents()
|
2017-02-08 14:36:28 +01:00
|
|
|
{
|
2019-06-05 18:19:08 +02:00
|
|
|
var components = window.comps;
|
2019-01-01 19:47:07 +01:00
|
|
|
var hyperionEnabled = true;
|
|
|
|
components.forEach( function(obj) {
|
|
|
|
if (obj.name == "ALL")
|
|
|
|
{
|
|
|
|
hyperionEnabled = obj.enabled
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-05-12 19:56:06 +02:00
|
|
|
for (const comp of components)
|
2016-09-09 18:59:58 +02:00
|
|
|
{
|
2020-05-12 19:56:06 +02:00
|
|
|
if(comp.name === "ALL")
|
2019-06-05 18:19:08 +02:00
|
|
|
continue;
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2020-05-12 19:56:06 +02:00
|
|
|
const enable_style = (comp.enabled? "checked" : "");
|
|
|
|
const comp_btn_id = "comp_btn_"+comp.name;
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2020-05-12 19:56:06 +02:00
|
|
|
if ($("#"+comp_btn_id).length === 0)
|
2016-09-09 18:59:58 +02:00
|
|
|
{
|
2020-05-12 19:56:06 +02:00
|
|
|
var d='<span style="display:block;margin:3px">'
|
|
|
|
+'<input id="'+comp_btn_id+'"'+enable_style+' type="checkbox"'
|
|
|
|
+'data-toggle="toggle" data-onstyle="success" data-on="'+$.i18n('general_btn_on')+'" data-off="'+$.i18n('general_btn_off')+'">'
|
|
|
|
+' <label>'+$.i18n('general_comp_'+comp.name)+'</label>'
|
|
|
|
+'</span>';
|
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
$('#componentsbutton').append(d);
|
2020-05-12 19:56:06 +02:00
|
|
|
$(`#${comp_btn_id}`).bootstrapToggle();
|
|
|
|
$(`#${comp_btn_id}`).bootstrapToggle(hyperionEnabled ? "enable" : "disable")
|
|
|
|
$(`#${comp_btn_id}`).change(e => {
|
|
|
|
requestSetComponentState(e.currentTarget.id.split('_').pop(), e.currentTarget.checked)
|
|
|
|
//console.log(e.currentTarget.checked)
|
|
|
|
});
|
2017-02-08 14:36:28 +01:00
|
|
|
}
|
2020-05-12 19:56:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function updateComponent( component )
|
|
|
|
{
|
|
|
|
if (component.name == "ALL")
|
|
|
|
{
|
|
|
|
var components = window.comps;
|
|
|
|
|
|
|
|
hyperionEnabled = component.enabled
|
|
|
|
for (const comp of components)
|
2017-02-08 14:36:28 +01:00
|
|
|
{
|
2020-05-12 19:56:06 +02:00
|
|
|
|
|
|
|
if(comp.name === "ALL")
|
|
|
|
continue;
|
|
|
|
|
|
|
|
const comp_btn_id = "comp_btn_"+comp.name;
|
|
|
|
|
|
|
|
if ( !hyperionEnabled )
|
|
|
|
{
|
|
|
|
$(`#${comp_btn_id}`).bootstrapToggle('off');
|
|
|
|
$(`#${comp_btn_id}`).bootstrapToggle("disable");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$(`#${comp_btn_id}`).bootstrapToggle("enable");
|
|
|
|
if ( comp.enabled !== $(`#${comp_btn_id}`).prop("checked") )
|
|
|
|
{
|
|
|
|
$(`#${comp_btn_id}`).bootstrapToggle().prop('checked', comp.enabled).change();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const comp_btn_id = "comp_btn_"+component.name;
|
|
|
|
|
|
|
|
//console.log ("updateComponent: ", component.name, "Current Checked: ", $(`#${comp_btn_id}`).prop("checked"), "New Checked: ", component.enabled, );
|
|
|
|
|
|
|
|
// In case Buttons were disabled before, status may be different to component status
|
|
|
|
if ( component.enabled != $(`#${comp_btn_id}`).prop("checked") )
|
|
|
|
{
|
|
|
|
// console.log ("Update status to Checked = ", component.enabled);
|
|
|
|
if ( component.enabled )
|
|
|
|
$(`#${comp_btn_id}`).bootstrapToggle("on");
|
|
|
|
else
|
|
|
|
$(`#${comp_btn_id}`).bootstrapToggle("off");
|
2016-09-09 18:59:58 +02:00
|
|
|
}
|
|
|
|
}
|
2016-11-21 22:16:57 +01:00
|
|
|
}
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
function updateEffectlist()
|
|
|
|
{
|
2019-06-05 18:19:08 +02:00
|
|
|
var newEffects = window.serverInfo.effects;
|
2016-11-21 22:16:57 +01:00
|
|
|
if (newEffects.length != oldEffects.length)
|
|
|
|
{
|
2016-11-30 17:32:12 +01:00
|
|
|
$('#effect_select').html('<option value="__none__"></option>');
|
|
|
|
var usrEffArr = [];
|
|
|
|
var sysEffArr = [];
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
for(var i = 0; i < newEffects.length; i++) {
|
2016-11-30 17:32:12 +01:00
|
|
|
var effectName = newEffects[i].name;
|
|
|
|
if(!/^\:/.test(newEffects[i].file)){
|
|
|
|
usrEffArr.push(effectName);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
sysEffArr.push(effectName);
|
|
|
|
}
|
2016-11-21 22:16:57 +01:00
|
|
|
}
|
2016-12-04 19:32:23 +01:00
|
|
|
$('#effect_select').append(createSel(usrEffArr, $.i18n('remote_optgroup_usreffets')));
|
|
|
|
$('#effect_select').append(createSel(sysEffArr, $.i18n('remote_optgroup_syseffets')));
|
2016-11-21 22:16:57 +01:00
|
|
|
oldEffects = newEffects;
|
|
|
|
}
|
|
|
|
}
|
2017-09-04 23:12:59 +02:00
|
|
|
|
|
|
|
function updateVideoMode()
|
|
|
|
{
|
2019-06-05 18:19:08 +02:00
|
|
|
var videoModes = ["2D","3DSBS","3DTAB"];
|
|
|
|
var currVideoMode = window.serverInfo.videomode;
|
2017-09-04 23:12:59 +02:00
|
|
|
|
|
|
|
$('#videomodebtns').html("");
|
|
|
|
for(var ix = 0; ix < videoModes.length; ix++)
|
|
|
|
{
|
|
|
|
if(currVideoMode == videoModes[ix])
|
2019-06-05 18:19:08 +02:00
|
|
|
var btn_style = 'btn-success';
|
2017-09-04 23:12:59 +02:00
|
|
|
else
|
2019-06-05 18:19:08 +02:00
|
|
|
var btn_style = 'btn-primary';
|
2017-09-04 23:12:59 +02:00
|
|
|
$('#videomodebtns').append('<button type="button" id="vModeBtn_'+videoModes[ix]+'" class="btn '+btn_style+'" style="margin:3px;min-width:200px" onclick="requestVideoMode(\''+videoModes[ix]+'\');">'+$.i18n('remote_videoMode_'+videoModes[ix])+'</button><br/>');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
// colorpicker and effect
|
|
|
|
if (getStorage('rmcpcolor') != null)
|
2017-04-07 21:33:40 +02:00
|
|
|
{
|
2017-02-08 14:36:28 +01:00
|
|
|
cpcolor = getStorage('rmcpcolor');
|
2017-04-07 21:33:40 +02:00
|
|
|
rgb = hexToRgb(cpcolor);
|
|
|
|
}
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-02-28 17:53:41 +01:00
|
|
|
if (getStorage('rmduration') != null)
|
|
|
|
{
|
|
|
|
$("#remote_duration").val(getStorage('rmduration'));
|
|
|
|
duration = getStorage('rmduration');
|
|
|
|
}
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-04-07 21:33:40 +02:00
|
|
|
createCP('cp2', cpcolor, function(rgbT,hex){
|
|
|
|
rgb = rgbT;
|
2019-07-21 15:03:50 +02:00
|
|
|
sendColor();
|
2017-02-08 14:36:28 +01:00
|
|
|
setStorage('rmcpcolor', hex);
|
2019-07-21 19:06:47 +02:00
|
|
|
updateInputSelect();
|
2017-02-08 14:36:28 +01:00
|
|
|
});
|
2016-09-09 18:59:58 +02:00
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
$("#reset_color").off().on("click", function(){
|
|
|
|
requestPriorityClear();
|
2019-08-21 16:10:35 +02:00
|
|
|
lastImgData = "";
|
2017-02-08 14:36:28 +01:00
|
|
|
$("#effect_select").val("__none__");
|
2019-08-21 16:10:35 +02:00
|
|
|
$("#remote_input_img").val("");
|
2017-02-08 14:36:28 +01:00
|
|
|
});
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-02-28 17:53:41 +01:00
|
|
|
$("#remote_duration").off().on("change", function(){
|
|
|
|
duration = valValue(this.id,this.value,this.min,this.max);
|
|
|
|
setStorage('rmduration', duration);
|
|
|
|
});
|
2016-09-09 18:59:58 +02:00
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
$("#effect_select").off().on("change", function(event) {
|
2017-04-07 21:33:40 +02:00
|
|
|
sendEffect();
|
|
|
|
});
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-04-07 21:33:40 +02:00
|
|
|
$("#remote_input_reseff, #remote_input_rescol").off().on("click", function(){
|
|
|
|
if(this.id == "remote_input_rescol")
|
|
|
|
sendColor();
|
|
|
|
else
|
|
|
|
sendEffect();
|
2017-02-08 14:36:28 +01:00
|
|
|
});
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2019-08-21 16:10:35 +02:00
|
|
|
$("#remote_input_repimg").off().on("click", function(){
|
|
|
|
if(lastImgData != "")
|
|
|
|
requestSetImage(lastImgData, duration, lastFileName);
|
|
|
|
});
|
|
|
|
|
2017-02-28 17:53:41 +01:00
|
|
|
$("#remote_input_img").change(function(){
|
2019-08-21 16:10:35 +02:00
|
|
|
readImg(this, function(src,fileName){
|
|
|
|
lastFileName = fileName;
|
|
|
|
if(src.includes(","))
|
|
|
|
lastImgData = src.split(",")[1];
|
|
|
|
else
|
|
|
|
lastImgData = src;
|
|
|
|
|
|
|
|
requestSetImage(lastImgData, duration, lastFileName);
|
2017-02-28 17:53:41 +01:00
|
|
|
});
|
|
|
|
});
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
//force first update
|
2020-05-12 19:56:06 +02:00
|
|
|
initComponents();
|
2018-12-27 23:11:32 +01:00
|
|
|
updateInputSelect();
|
|
|
|
updateLedMapping();
|
|
|
|
updateVideoMode();
|
|
|
|
updateEffectlist();
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
// interval updates
|
2020-05-12 19:56:06 +02:00
|
|
|
|
|
|
|
$(window.hyperion).on('components-updated', function(e, comp){
|
|
|
|
//console.log ("components-updated", e, comp);
|
|
|
|
updateComponent (comp);
|
|
|
|
});
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).on("cmd-priorities-update", function(event){
|
2019-07-29 19:09:26 +02:00
|
|
|
window.serverInfo.priorities = event.response.data.priorities;
|
|
|
|
window.serverInfo.priorities_autoselect = event.response.data.priorities_autoselect;
|
|
|
|
updateInputSelect();
|
2018-12-27 23:11:32 +01:00
|
|
|
});
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).on("cmd-imageToLedMapping-update", function(event){
|
2019-07-29 19:09:26 +02:00
|
|
|
window.serverInfo.imageToLedMappingType = event.response.data.imageToLedMappingType;
|
|
|
|
updateLedMapping();
|
2018-12-27 23:11:32 +01:00
|
|
|
});
|
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).on("cmd-videomode-update", function(event){
|
2019-07-29 19:09:26 +02:00
|
|
|
window.serverInfo.videomode = event.response.data.videomode;
|
|
|
|
updateVideoMode();
|
2018-12-27 23:11:32 +01:00
|
|
|
});
|
|
|
|
|
2019-06-05 18:19:08 +02:00
|
|
|
$(window.hyperion).on("cmd-effects-update", function(event){
|
2019-07-29 19:09:26 +02:00
|
|
|
window.serverInfo.effects = event.response.data.effects;
|
2018-12-27 23:11:32 +01:00
|
|
|
updateEffectlist();
|
|
|
|
});
|
2017-09-04 23:12:59 +02:00
|
|
|
|
|
|
|
removeOverlay();
|
2016-09-09 18:59:58 +02:00
|
|
|
});
|