UI fixes/updates (#468)

* fix logging display

* hue wizard add usrname

* fix restartAction sometimes not executed

* remove configRevision

* remove v4l2 grabMode(2d/3d)

* remove latchTime from configs

not in main led device schema

* config comment: all grabbers can crop

* remove smoothing delay&pause for effects

* finalize disable effects ui

* fix empty effect selects

* remote page add 2D/3D videoMode

* add blackborder texts

* Update EffectEngine.cpp
This commit is contained in:
brindosch
2017-09-04 23:12:59 +02:00
committed by GitHub
parent cb7b5fa588
commit 81f5f51257
26 changed files with 503 additions and 453 deletions

View File

@@ -1,25 +1,24 @@
$(document).ready( function() {
performTranslation();
var oldEffects = [];
var editorReady = false;
var effects_editor = null;
var confFgEff = serverConfig.foregroundEffect.effect;
var confBgEff = serverConfig.backgroundEffect.effect;
var foregroundEffect_editor = null;
var backgroundEffect_editor = null;
if(showOptHelp)
{
{
//foreground effect
$('#conf_cont').append(createRow('conf_cont_fge'))
$('#conf_cont_fge').append(createOptPanel('fa-spinner', $.i18n("edt_conf_fge_heading_title"), 'editor_container_foregroundEffect', 'btn_submit_foregroundEffect'));
$('#conf_cont_fge').append(createHelpTable(schema.foregroundEffect.properties, $.i18n("edt_conf_fge_heading_title")));
//background effect
$('#conf_cont').append(createRow('conf_cont_bge'))
$('#conf_cont_bge').append(createOptPanel('fa-spinner', $.i18n("edt_conf_bge_heading_title"), 'editor_container_backgroundEffect', 'btn_submit_backgroundEffect'));
$('#conf_cont_bge').append(createHelpTable(schema.backgroundEffect.properties, $.i18n("edt_conf_bge_heading_title")));
//effect path
if(storedAccess != 'default')
{
@@ -33,20 +32,20 @@ $(document).ready( function() {
$('#conf_cont').addClass('row');
$('#conf_cont').append(createOptPanel('fa-spinner', $.i18n("edt_conf_fge_heading_title"), 'editor_container_foregroundEffect', 'btn_submit_foregroundEffect'));
$('#conf_cont').append(createOptPanel('fa-spinner', $.i18n("edt_conf_bge_heading_title"), 'editor_container_backgroundEffect', 'btn_submit_backgroundEffect'));
if(storedAccess != 'default')
if(storedAccess != 'default')
$('#conf_cont').append(createOptPanel('fa-spinner', $.i18n("edt_conf_effp_heading_title"), 'editor_container_effects', 'btn_submit_effects'));
}
if(storedAccess != 'default')
{
effects_editor = createJsonEditor('editor_container_effects', {
effects : schema.effects
}, true, true);
effects_editor.on('change',function() {
effects_editor.validate().length ? $('#btn_submit_effects').attr('disabled', true) : $('#btn_submit_effects').attr('disabled', false);
});
$('#btn_submit_effects').off().on('click',function() {
requestWriteConfig(effects_editor.getValue());
});
@@ -55,38 +54,38 @@ $(document).ready( function() {
foregroundEffect_editor = createJsonEditor('editor_container_foregroundEffect', {
foregroundEffect : schema.foregroundEffect
}, true, true);
backgroundEffect_editor = createJsonEditor('editor_container_backgroundEffect', {
backgroundEffect : schema.backgroundEffect
}, true, true);
foregroundEffect_editor.on('ready',function() {
editorReady = true;
updateEffectlist();
});
foregroundEffect_editor.on('change',function() {
foregroundEffect_editor.validate().length ? $('#btn_submit_foregroundEffect').attr('disabled', true) : $('#btn_submit_foregroundEffect').attr('disabled', false);
});
backgroundEffect_editor.on('change',function() {
backgroundEffect_editor.validate().length ? $('#btn_submit_backgroundEffect').attr('disabled', true) : $('#btn_submit_backgroundEffect').attr('disabled', false);
});
$('#btn_submit_foregroundEffect').off().on('click',function() {
var value = foregroundEffect_editor.getValue();
if(typeof value.foregroundEffect.effect == 'undefined')
value.foregroundEffect.effect = serverConfig.foregroundEffect.effect;
requestWriteConfig(value);
requestWriteConfig(value);
});
$('#btn_submit_backgroundEffect').off().on('click',function() {
var value = backgroundEffect_editor.getValue();
if(typeof value.backgroundEffect.effect == 'undefined')
value.backgroundEffect.effect = serverConfig.backgroundEffect.effect;
requestWriteConfig(value);
});
//create introduction
if(showOptHelp)
{
@@ -96,36 +95,33 @@ $(document).ready( function() {
}
function updateEffectlist(){
if(editorReady)
var newEffects = serverInfo.effects;
if (newEffects.length != oldEffects.length)
{
var newEffects = serverInfo.effects;
if (newEffects.length != oldEffects.length)
$('#root_foregroundEffect_effect').html('');
var usrEffArr = [];
var sysEffArr = [];
for(i = 0; i < newEffects.length; i++)
{
$('#root_foregroundEffect_effect').html('');
var usrEffArr = [];
var sysEffArr = [];
for(i = 0; i < newEffects.length; i++)
{
var effectName = newEffects[i].name;
if(!/^\:/.test(newEffects[i].file))
usrEffArr.push(effectName);
else
sysEffArr.push(effectName);
}
$('#root_foregroundEffect_effect').append(createSel(usrEffArr, $.i18n('remote_optgroup_usreffets')));
$('#root_foregroundEffect_effect').append(createSel(sysEffArr, $.i18n('remote_optgroup_syseffets')));
$('#root_backgroundEffect_effect').html($('#root_foregroundEffect_effect').html());
oldEffects = newEffects;
$('#root_foregroundEffect_effect').val(confFgEff);
$('#root_backgroundEffect_effect').val(confBgEff);
var effectName = newEffects[i].name;
if(!/^\:/.test(newEffects[i].file))
usrEffArr.push(effectName);
else
sysEffArr.push(effectName);
}
$('#root_foregroundEffect_effect').append(createSel(usrEffArr, $.i18n('remote_optgroup_usreffets')));
$('#root_foregroundEffect_effect').append(createSel(sysEffArr, $.i18n('remote_optgroup_syseffets')));
$('#root_backgroundEffect_effect').html($('#root_foregroundEffect_effect').html());
oldEffects = newEffects;
$('#root_foregroundEffect_effect').val(confFgEff);
$('#root_backgroundEffect_effect').val(confBgEff);
}
}
//interval update
$(hyperion).on("cmd-serverinfo",updateEffectlist);
removeOverlay();
});

View File

@@ -1,10 +1,10 @@
$(document).ready( function() {
performTranslation();
var importedConf;
var confName;
var conf_editor = null;
$('#conf_cont').append(createOptPanel('fa-wrench', $.i18n("edt_conf_gen_heading_title"), 'editor_container', 'btn_submit'));
if(showOptHelp)
{
@@ -12,25 +12,25 @@ $(document).ready( function() {
}
else
$('#conf_imp').appendTo('#conf_cont');
conf_editor = createJsonEditor('editor_container', {
general: schema.general
}, true, true);
conf_editor.on('change',function() {
conf_editor.validate().length ? $('#btn_submit').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
});
$('#btn_submit').off().on('click',function() {
requestWriteConfig(conf_editor.getValue());
});
//import
function dis_imp_btn(state)
{
state ? $('#btn_import_conf').attr('disabled', true) : $('#btn_import_conf').attr('disabled', false);
}
function readFile(evt)
{
var f = evt.target.files[0];
@@ -60,45 +60,36 @@ $(document).ready( function() {
}
else
{
//check config revision
if(content.general.configVersion !== serverConfig.general.configVersion)
{
showInfoDialog('error', "", $.i18n('infoDialog_import_reverror_text', f.name, content.general.configVersion, serverConfig.general.configVersion));
dis_imp_btn(true);
}
else
{
dis_imp_btn(false);
importedConf = content;
confName = f.name;
}
dis_imp_btn(false);
importedConf = content;
confName = f.name;
}
}
}
r.readAsText(f);
}
}
$('#btn_import_conf').off().on('click', function(){
showInfoDialog('import', $.i18n('infoDialog_import_confirm_title'), $.i18n('infoDialog_import_confirm_text', confName));
$('#id_btn_import').off().on('click', function(){
requestWriteConfig(importedConf, true);
setTimeout(initRestart, 100);
});
});
$('#select_import_conf').off().on('change', function(e){
if (window.File && window.FileReader && window.FileList && window.Blob)
readFile(e);
else
showInfoDialog('error', "", $.i18n('infoDialog_import_comperror_text'));
});
//export
$('#btn_export_conf').off().on('click', function(){
var name = serverConfig.general.name;
var d = new Date();
var month = d.getMonth()+1;
var day = d.getDate();
@@ -106,14 +97,13 @@ $(document).ready( function() {
var timestamp = d.getFullYear() + '.' +
(month<10 ? '0' : '') + month + '.' +
(day<10 ? '0' : '') + day;
download(JSON.stringify(serverConfig, null, "\t"), 'Hyperion-'+currentVersion+'-Backup ('+name+') '+timestamp+'.json', "application/json");
});
//create introduction
if(showOptHelp)
createHint("intro", $.i18n('conf_general_intro'), "editor_container");
removeOverlay();
});

View File

@@ -19,12 +19,6 @@ $(document).ready( function() {
$("#hyperion_disabled_notify").fadeIn("fast");
else
$("#hyperion_disabled_notify").fadeOut("fast");
if ($("#logmessages").length == 0 && loggingStreamActive)
{
requestLoggingStop();
loggingStreamActive = false;
}
if (!serverInfo.hyperion.config_writeable)
{

View File

@@ -144,6 +144,13 @@ $(document).ready(function() {
{
loggingHandlerInstalled = true;
$(hyperion).on("cmd-logging-update",function(event){
if ($("#logmessages").length == 0 && loggingStreamActive)
{
requestLoggingStop();
loggingStreamActive = false;
}
messages = (event.response.result.messages);
if(messages.length != 0 && !createdCont)
{

View File

@@ -1,18 +1,18 @@
$(document).ready(function() {
performTranslation();
var oldEffects = [];
var cpcolor = '#B500FF';
var mappingList = serverSchema.properties.color.properties.imageToLedMappingType.enum;
var duration = 0;
var rgb = {r:255,g:0,b:0};
//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);
//create introduction
if(showOptHelp)
{
@@ -21,12 +21,13 @@ $(document).ready(function() {
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");
createHint("intro", $.i18n('remote_videoMode_intro', $.i18n('remote_losthint')), "videomode_intro");
}
//color adjustment
var sColor = sortProperties(serverSchema.properties.color.properties.channelAdjustment.items.properties)
var values = serverInfo.adjustment[0]
for(key in sColor)
{
if(sColor[key].key != "id" && sColor[key].key != "leds")
@@ -47,18 +48,18 @@ $(document).ready(function() {
{
property = '<div class="checkbox"><input id="cr_'+sColor[key].key+'" type="checkbox" value="'+value+'"/><label></label></div>';
$('.crtbody').append(createTableRow([title, property], false, true));
$('#cr_'+sColor[key].key).off().on('change', function(e){
requestAdjustment(e.target.id.substr(e.target.id.indexOf("_") + 1), e.currentTarget.checked);
});
}
else
{
if(sColor[key].key == "brightness" || sColor[key].key == "brightnessCompensation" || sColor[key].key == "backlightThreshold")
if(sColor[key].key == "brightness" || sColor[key].key == "brightnessCompensation" || sColor[key].key == "backlightThreshold")
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>';
else
property = '<input id="cr_'+sColor[key].key+'" type="number" class="form-control" min="0.1" max="4.0" step="0.1" value="'+value+'"/>';
$('.crtbody').append(createTableRow([title, property], false, true));
$('#cr_'+sColor[key].key).off().on('change', function(e){
valValue(this.id,this.value,this.min,this.max);
@@ -79,12 +80,12 @@ $(document).ready(function() {
});
}
}
function sendColor()
{
requestSetColor(rgb.r, rgb.g, rgb.b,duration);
}
function updateRemote()
{
if ($('#componentsbutton').length == 0)
@@ -95,13 +96,14 @@ $(document).ready(function() {
{
updateInputSelect();
updateLedMapping();
updateVideoMode();
updateComponents();
updateEffectlist();
}
}
function updateInputSelect()
{
{
$('.sstbody').html("");
var data = "";
var prios = serverInfo.priorities
@@ -114,7 +116,7 @@ $(document).ready(function() {
origin = origin.split("@");
var ip = origin[1];
origin = origin[0];
var owner = prios[i].owner;
var active = prios[i].active;
var visible = prios[i].visible;
@@ -127,7 +129,7 @@ $(document).ready(function() {
if (active)
btn_type = "primary";
if(priority > 254)
continue;
if(priority < 254 && (compId == "EFFECT" || compId == "COLOR") )
@@ -164,15 +166,15 @@ $(document).ready(function() {
owner = $.i18n('general_comp_UDPLISTENER');
break;
}
if(duration && compId != "GRABBER" && compId != "PROTOSERVER")
owner += '<br/><span style="font-size:80%; color:grey;">'+$.i18n('remote_input_duration')+' '+duration.toFixed(0)+$.i18n('edt_append_s')+'</span>';
var btn = '<button id="srcBtn'+i+'" type="button" '+btn_state+' class="btn btn-'+btn_type+' btn_input_selection" onclick="requestSetSource('+priority+');">'+btn_text+'</button>';
if((compId == "EFFECT" || compId == "COLOR") && priority < 254)
btn += '<button type="button" class="btn btn-sm btn-danger" style="margin-left:10px;" onclick="requestPriorityClear('+priority+');"><i class="fa fa-close"></button>';
if(btn_type != 'default')
$('.sstbody').append(createTableRow([origin, owner, priority, btn], false, true));
}
@@ -182,15 +184,15 @@ $(document).ready(function() {
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>');
var max_width=100;
$('.btn_input_selection').each(function() {
if ($(this).innerWidth() > max_width)
max_width = $(this).innerWidth();
});
$('.btn_input_selection').css("min-width",max_width+"px");
$('.btn_input_selection').css("min-width",max_width+"px");
}
function updateLedMapping()
{
mapping = serverInfo.ledMAppingType;
@@ -219,7 +221,7 @@ $(document).ready(function() {
comp_name = components[idx].name;
comp_btn_id = "comp_btn_"+comp_name;
comp_goff = serverInfo.hyperion.off? "disabled" : "enabled";
// create btn if not there
if ($("#"+comp_btn_id).length == 0)
{
@@ -236,7 +238,7 @@ $(document).ready(function() {
}
}
}
function updateEffectlist()
{
var newEffects = serverInfo.effects;
@@ -245,7 +247,7 @@ $(document).ready(function() {
$('#effect_select').html('<option value="__none__"></option>');
var usrEffArr = [];
var sysEffArr = [];
for(i = 0; i < newEffects.length; i++) {
var effectName = newEffects[i].name;
if(!/^\:/.test(newEffects[i].file)){
@@ -260,20 +262,36 @@ $(document).ready(function() {
oldEffects = newEffects;
}
}
function updateVideoMode()
{
videoModes = ["2D","3DSBS","3DTAB"];
currVideoMode = serverInfo.grabbers.videomode;
$('#videomodebtns').html("");
for(var ix = 0; ix < videoModes.length; ix++)
{
if(currVideoMode == videoModes[ix])
btn_style = 'btn-success';
else
btn_style = 'btn-primary';
$('#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/>');
}
}
// colorpicker and effect
if (getStorage('rmcpcolor') != null)
{
cpcolor = getStorage('rmcpcolor');
rgb = hexToRgb(cpcolor);
}
if (getStorage('rmduration') != null)
{
$("#remote_duration").val(getStorage('rmduration'));
duration = getStorage('rmduration');
}
createCP('cp2', cpcolor, function(rgbT,hex){
rgb = rgbT;
sendColor()
@@ -284,7 +302,7 @@ $(document).ready(function() {
requestPriorityClear();
$("#effect_select").val("__none__");
});
$("#remote_duration").off().on("change", function(){
duration = valValue(this.id,this.value,this.min,this.max);
setStorage('rmduration', duration);
@@ -293,26 +311,26 @@ $(document).ready(function() {
$("#effect_select").off().on("change", function(event) {
sendEffect();
});
$("#remote_input_reseff, #remote_input_rescol").off().on("click", function(){
if(this.id == "remote_input_rescol")
sendColor();
else
sendEffect();
});
$("#remote_input_img").change(function(){
readImg(this, function(src,width,height){
console.log(src,width,height)
requestSetImage(src,width,height,duration)
});
});
//force first update
updateRemote();
updateRemote();
// interval updates
$(hyperion).on("cmd-serverinfo",updateRemote);
removeOverlay();
removeOverlay();
});

View File

@@ -40,8 +40,9 @@ function connectionLostDetection(type)
window.clearInterval(i);
if(type == 'restart')
{
$("body").html($("#container_restart").html());
restartAction();
$("body").html($("#container_restart").html());
// setTimeout delay for probably slower systems, some browser don't execute THIS action
setTimeout(restartAction,250);
}
else
{
@@ -222,17 +223,17 @@ function requestClearAll()
}
function requestPlayEffect(effectName, duration)
{
{
sendToHyperion("effect", "", '"effect":{"name":"'+effectName+'"},"priority":'+webPrio+',"duration":'+validateDuration(duration)+',"origin":"'+webOrigin+'"');
}
function requestSetColor(r,g,b,duration)
{
{
sendToHyperion("color", "", '"color":['+r+','+g+','+b+'], "priority":'+webPrio+',"duration":'+validateDuration(duration)+',"origin":"'+webOrigin+'"');
}
function requestSetImage(data,width,height,duration)
{
{
sendToHyperion("image", "", '"imagedata":"'+data+'", "imagewidth":'+width+',"imageheight":'+height+', "priority":'+webPrio+',"duration":'+validateDuration(duration)+'');
}
@@ -305,10 +306,15 @@ function requestMappingType(type)
sendToHyperion("processing", "", '"mappingType": "'+type+'"');
}
function requestVideoMode(newMode)
{
sendToHyperion("videomode", "", '"videoMode": "'+newMode+'"');
}
function requestAdjustment(type, value, complete)
{
if(complete === true)
sendToHyperion("adjustment", "", '"adjustment": '+type+'');
else
else
sendToHyperion("adjustment", "", '"adjustment": {"'+type+'": '+value+'}');
}

View File

@@ -1,7 +1,7 @@
//clear priority and other tasks if people reload the page or lost connection while a wizard was active
$(hyperion).one("ready", function(event) {
if(getStorage("wizardactive") === 'true')
$(hyperion).one("ready", function(event) {
if(getStorage("wizardactive") === 'true')
{
requestPriorityClear();
setStorage("wizardactive", false);
@@ -12,7 +12,7 @@
}
}
});
function resetWizard()
{
$("#wizard_modal").modal('hide');
@@ -27,7 +27,7 @@
sendToKodi("stop");
step = 0;
}
//rgb byte order wizard
var wIntveralId;
var new_rgb_order;
@@ -59,14 +59,14 @@
$('#wizp2_body').append('<canvas id="wiz_canv_color" width="100" height="100" style="border-radius:60px;background-color:red; display:block; margin: 10px 0;border:4px solid grey;"></canvas><label>'+$.i18n('wiz_rgb_q')+'</label>');
$('#wizp2_body').append('<table class="table borderless" style="width:200px"><tbody><tr><td class="ltd"><label>'+$.i18n('wiz_rgb_qrend')+'</label></td><td class="itd"><select id="wiz_r_select" class="form-control wselect"></select></td></tr><tr><td class="ltd"><label>'+$.i18n('wiz_rgb_qgend')+'</label></td><td class="itd"><select id="wiz_g_select" class="form-control wselect"></select></td></tr></tbody></table>');
$('#wizp2_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_save"><i class="fa fa-fw fa-save"></i>'+$.i18n('general_btn_saverestart')+'</button><button type="button" class="btn btn-primary" id="btn_wiz_checkok" style="display:none" data-dismiss="modal"><i class="fa fa-fw fa-check"></i>'+$.i18n('general_btn_ok')+'</button><button type="button" class="btn btn-danger" id="btn_wiz_abort"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>')
//open modal
$("#wizard_modal").modal({
backdrop : "static",
keyboard: false,
show: true
});
//listen for continue
$('#btn_wiz_cont').off().on('click',function() {
beginWizardRGB();
@@ -76,7 +76,7 @@
}
function beginWizardRGB()
{
{
$("#wiz_switchtime_select").off().on('change',function() {
clearInterval(wIntveralId);
var time = $("#wiz_switchtime_select").val();
@@ -88,19 +88,19 @@
var redS = $("#wiz_r_select").val();
var greenS = $("#wiz_g_select").val();
var blueS = rgb_order.toString().replace(/,/g,"").replace(redS, "").replace(greenS,"");
for (var i = 0; i<rgb_order.length; i++)
{
if (redS == rgb_order[i])
$('#wiz_g_select option[value='+rgb_order[i]+']').attr('disabled',true);
$('#wiz_g_select option[value='+rgb_order[i]+']').attr('disabled',true);
else
$('#wiz_g_select option[value='+rgb_order[i]+']').attr('disabled',false);
if (greenS == rgb_order[i])
$('#wiz_r_select option[value='+rgb_order[i]+']').attr('disabled',true);
else
$('#wiz_r_select option[value='+rgb_order[i]+']').attr('disabled',false);
$('#wiz_r_select option[value='+rgb_order[i]+']').attr('disabled',false);
}
if(redS != 'null' && greenS != 'null')
{
$('#btn_wiz_save').attr('disabled',false);
@@ -114,9 +114,9 @@
else
rgb_order[i] = blueS;
}
rgb_order = rgb_order.toString().replace(/,/g,"");
if(redS == "r" && greenS == "g")
{
$('#btn_wiz_save').toggle(false);
@@ -132,14 +132,14 @@
else
$('#btn_wiz_save').attr('disabled',true);
});
$("#wiz_switchtime_select").append(createSelOpt('5','5'),createSelOpt('10','10'),createSelOpt('15','15'),createSelOpt('30','30'));
$("#wiz_switchtime_select").trigger('change');
$("#wiz_r_select").append(createSelOpt("null", ""),createSelOpt('r', $.i18n('general_col_red')),createSelOpt('g', $.i18n('general_col_green')),createSelOpt('b', $.i18n('general_col_blue')));
$("#wiz_g_select").html($("#wiz_r_select").html());
$("#wiz_r_select").trigger('change');
requestSetColor('255','0','0');
setTimeout(requestSetSource, 100, 'auto');
setStorage("wizardactive", true);
@@ -158,9 +158,9 @@
setTimeout(initRestart, 100);
});
}
$('#btn_wizard_byteorder').off().on('click',startWizardRGB);
//color calibration wizard
var kodiAddress = document.location.hostname+':8080';
var wiz_editor;
@@ -174,28 +174,28 @@
var vidAddress = "https://sourceforge.net/projects/hyperion-project/files/resources/vid/";
var picnr = 0;
var availVideos = ["Sweet_Cocoon","Caminandes_2_GranDillama","Caminandes_3_Llamigos"];
if(getStorage("kodiAddress") != null)
kodiAddress = getStorage("kodiAddress");
function switchPicture(pictures)
{
{
if(typeof pictures[picnr] === 'undefined')
picnr = 0;
sendToKodi('playP',pictures[picnr]);
picnr++;
}
function sendToKodi(type, content, cb)
{
var command;
if(type == "playP")
content = imgAddress+content+'.png';
if(type == "playV")
content = vidAddress+content;
if(type == "msg")
command = '{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title": "'+$.i18n('wiz_cc_title')+'", "message": "'+content+'", "image":"info", "displaytime":5000 },"id":"1"}';
else if (type == "stop")
@@ -222,13 +222,13 @@
.fail( function( jqXHR, textStatus ) {
if ( jqXHR.status != 200 && type == "msg")
cb("error")
});
});
}
function performAction()
{
var h;
if(step == 1)
{
$('#wiz_cc_desc').html($.i18n('wiz_cc_chooseid'));
@@ -237,7 +237,7 @@
}
else
$('#btn_wiz_back').attr("disabled", false)
if(step == 2)
{
updateWEditor(["white"]);
@@ -273,7 +273,7 @@
h = $.i18n('wiz_cc_adjustit',$.i18n('edt_conf_color_red_title'));
if(withKodi)
{
h += '<br/>'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_red_title'));
h += '<br/>'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_red_title'));
sendToKodi('playP',"red");
}
else
@@ -286,7 +286,7 @@
h = $.i18n('wiz_cc_adjustit',$.i18n('edt_conf_color_green_title'));
if(withKodi)
{
h += '<br/>'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_green_title'));
h += '<br/>'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_green_title'));
sendToKodi('playP',"green");
}
else
@@ -377,17 +377,17 @@
h += '<p>'+$.i18n('wiz_cc_testintrowok')+' <a href="https://sourceforge.net/projects/hyperion-project/files/resources/vid/" target="_blank">'+$.i18n('wiz_cc_link')+'</a></p>';
h += '<p>'+$.i18n('wiz_cc_summary')+'</p>';
$('#wiz_cc_desc').html(h);
$('.videobtn').off().on('click', function(e){
if(e.target.id == "stop")
sendToKodi("stop");
else
sendToKodi("playV",e.target.id+'.mp4');
$(this).attr("disabled", true);
setTimeout(function(){$('.videobtn').attr("disabled", false)},10000);
});
$('#btn_wiz_next').attr("disabled", true);
$('#btn_wiz_save').toggle(true);
}
@@ -397,7 +397,7 @@
$('#btn_wiz_save').toggle(false);
}
}
function updateWEditor(el, all)
{
for (var key in cobj)
@@ -408,7 +408,7 @@
$('#editor_container_wiz [data-schemapath*=".'+profile+'.'+key+'"]').toggle(false);
}
}
function startWizardCC()
{
//create html
@@ -417,14 +417,14 @@
$('#wizp1_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_cont" disabled="disabled"><i class="fa fa-fw fa-check"></i>'+$.i18n('general_btn_continue')+'</button><button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>');
$('#wizp2_body').html('<div id="wiz_cc_desc" style="font-weight:bold"></div><div id="editor_container_wiz"></div>');
$('#wizp2_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_back"><i class="fa fa-fw fa-chevron-left"></i>'+$.i18n('general_btn_back')+'</button><button type="button" class="btn btn-primary" id="btn_wiz_next">'+$.i18n('general_btn_next')+'<i style="margin-left:4px;"class="fa fa-fw fa-chevron-right"></i></button><button type="button" class="btn btn-warning" id="btn_wiz_save" style="display:none"><i class="fa fa-fw fa-save"></i>'+$.i18n('general_btn_saverestart')+'</button><button type="button" class="btn btn-danger" id="btn_wiz_abort"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>')
//open modal
$("#wizard_modal").modal({
backdrop : "static",
keyboard: false,
show: true
});
$('#wiz_cc_kodiip').off().on('change',function() {
kodiAddress = $(this).val();
setStorage("kodiAddress", kodiAddress);
@@ -439,62 +439,62 @@
$('#kodi_status').html('<p style="color:green;font-weight:bold;margin-top:5px">'+$.i18n('wiz_cc_kodicon')+'</p>');
withKodi = true;
}
$('#btn_wiz_cont').attr('disabled', false);
});
});
//listen for continue
$('#btn_wiz_cont').off().on('click',function() {
beginWizardCC();
$('#wizp1').toggle(false);
$('#wizp2').toggle(true);
});
$('#wiz_cc_kodiip').trigger("change")
colorLength = serverConfig.color.channelAdjustment;
cobj = schema.color.properties.channelAdjustment.items.properties;
websAddress = document.location.hostname+':'+serverConfig.webConfig.port;
imgAddress = 'http://'+websAddress+'/img/cc/';
setStorage("wizardactive", true);
//check profile count
if(colorLength.length > 1)
{
$('#multi_cali').html('<p style="font-weight:bold;">'+$.i18n('wiz_cc_morethanone')+'</p><select id="wiz_select" class="form-control" style="width:200px;margin:auto"></select>');
for(var i = 0; i<colorLength.length; i++)
$('#wiz_select').append(createSelOpt(i,i+1+' ('+colorLength[i].id+')'));
$('#wiz_select').off().on('change', function(){
profile = $(this).val();
});
}
//prepare editor
wiz_editor = createJsonEditor('editor_container_wiz', {
color : schema.color
}, true, true);
$('#editor_container_wiz h4').toggle(false);
$('#editor_container_wiz .btn-group').toggle(false);
$('#editor_container_wiz [data-schemapath="root.color.imageToLedMappingType"]').toggle(false);
for(var i = 0; i<colorLength.length; i++)
$('#editor_container_wiz [data-schemapath*="root.color.channelAdjustment.'+i+'."]').toggle(false);
}
function beginWizardCC()
{
$('#btn_wiz_next').off().on('click',function() {
step++;
performAction();
});
$('#btn_wiz_back').off().on('click',function() {
step--;
performAction();
});
$('#btn_wiz_abort').off().on('click', resetWizard);
$('#btn_wiz_save').off().on('click',function() {
@@ -509,13 +509,13 @@
delete temp.leds
requestAdjustment(JSON.stringify(temp),"",true);
});
step++
performAction();
}
$('#btn_wizard_colorcalibration').off().on('click', startWizardCC);
//hue wizard
var hueIPs = [];
var hueIPsinc = 0;
@@ -525,7 +525,7 @@
var huePosLeft = {hscan: {maximum: 0.15,minimum: 0},index: 1,vscan: {maximum: 0.85,minimum: 0.15}};
var huePosRight = {hscan: {maximum: 1,minimum: 0.85},index: 3,vscan: {maximum: 0.85,minimum: 0.15}};
var huePosEntire = {hscan: {maximum: 1.0,minimum: 0.0},index: 0,vscan: {maximum: 1.0,minimum: 0.0}};
function startWizardPhilipsHue()
{
//create html
@@ -558,7 +558,7 @@
function checkHueBridge(cb,hueUser){
var usr = "";
if(typeof hueUser != "undefined")
usr = hueUser;
@@ -578,8 +578,8 @@
})
.fail( function( jqXHR, textStatus ) {
cb(false);
});
}
});
}
function checkUserResult(reply){
if(reply)
@@ -594,18 +594,18 @@
$('#wiz_hue_create_user').toggle(true);
}
};
function checkBridgeResult(reply){
if(reply)
{
//abort checking, first reachable result is used
$('#wiz_hue_ipstate').html("");
$('#ip').val(hueIPs[hueIPsinc].internalipaddress)
//now check hue user on this bridge
$('#usrcont').toggle(true);
checkHueBridge(checkUserResult,$('#user').val() ? $('#user').val() : "newdeveloper");
}
}
else
{
//increment and check again
@@ -618,14 +618,14 @@
{
$('#usrcont').toggle(false);
$('#wiz_hue_ipstate').html($.i18n('wiz_hue_failure_ip'));
}
}
}
};
function assignHuePos(id, pos, inc)
{
var i = null;
if(pos == "top")
i = huePosTop;
else if(pos == "bottom")
@@ -636,11 +636,11 @@
i = huePosRight;
else
i = huePosEntire;
i.index = inc;
return i;
}
function identHueId(id, off)
{
var on = true;
@@ -656,7 +656,7 @@
data: ' {"on":'+on+', "sat":254, "bri":254,"hue":47000}'
})
}
function getHueIPs(){
$('#wiz_hue_ipstate').html($.i18n('wiz_hue_searchb'));
$.ajax({
@@ -676,11 +676,17 @@
})
.fail( function( jqXHR, textStatus ) {
$('#wiz_hue_ipstate').html($.i18n('wiz_hue_failure_ip'));
});
});
};
function beginWizardHue()
{
var usr = conf_editor.getEditor("root.specificOptions.username").getValue();
if(usr != "")
{
$('#user').val(usr);
}
//check if ip is empty/reachable/search for bridge
if(conf_editor.getEditor("root.specificOptions.output").getValue() == "")
getHueIPs();
@@ -690,33 +696,30 @@
$('#ip').val(ip);
hueIPs.push({internalipaddress : ip});
checkHueBridge(checkBridgeResult);
var usr = conf_editor.getEditor("root.specificOptions.username").getValue();
$('#user').val(usr);
}
$('#retry_bridge').off().on('click', function(){
hueIPs[0].internalipaddress = $('#ip').val();
hueIPsinc = 0;
checkHueBridge(checkBridgeResult);
});
$('#retry_usr').off().on('click', function(){
checkHueBridge(checkUserResult,$('#user').val() ? $('#user').val() : "newdeveloper");
});
$('#wiz_hue_create_user').off().on('click',function() {
createHueUser();
});
$('#btn_wiz_save').off().on("click", function(){
var hueLedConfig = [];
var finalLightIds = [];
//create hue led config
var incC = 0;
for(key in lightIDs)
{
{
if($('#hue_'+key).val() != "disabled")
{
hueLedConfig.push(assignHuePos(key, $('#hue_'+key).val(), incC));
@@ -724,9 +727,9 @@
incC++;
}
}
serverConfig.leds = hueLedConfig;
//Adjust gamma, brightness and compensation
var c = serverConfig.color.channelAdjustment[0];
c.gammaBlue = 1.0;
@@ -734,7 +737,7 @@
c.gammaGreen = 1.0;
c.brightness = 100;
c.brightnessCompensation = 0;
//device config
var d = serverConfig.device;
d.output = $('#ip').val();
@@ -743,14 +746,14 @@
d.type = "philipshue";
d.transitiontime = 1;
d.switchOffOnBlack = true;
//smoothing off
serverConfig.smoothing.enable = false;
requestWriteConfig(serverConfig, true);
setTimeout(initRestart,200);
});
$('#btn_wiz_abort').off().on('click', resetWizard);
}
@@ -775,7 +778,7 @@
$("#connectionTime").html(connectionRetries);
if(connectionRetries == 0) {
abortConnection(UserInterval);
}
}
else
{
if (typeof r[0].error != 'undefined') {
@@ -813,16 +816,16 @@
$('#wh_topcontainer').toggle(false);
$('#hue_ids_t, #btn_wiz_save').toggle(true);
lightIDs = r;
for(var lightid in r)
{
$('.lidsb').append(createTableRow([lightid+' ('+r[lightid].name+')', '<select id="hue_'+lightid+'" class="hue_sel_watch form-control"><option value="disabled">'+$.i18n('wiz_hue_ids_disabled')+'</option><option value="top">'+$.i18n('conf_leds_layout_cl_top')+'</option><option value="bottom">'+$.i18n('conf_leds_layout_cl_bottom')+'</option><option value="left">'+$.i18n('conf_leds_layout_cl_left')+'</option><option value="right">'+$.i18n('conf_leds_layout_cl_right')+'</option><option value="entire">'+$.i18n('wiz_hue_ids_entire')+'</option></select>','<button class="btn btn-sm btn-primary" onClick=identHueId('+lightid+')>'+$.i18n('wiz_hue_blinkblue',lightid)+'</button>']));
}
$('.hue_sel_watch').bind("change", function(){
var cC = 0;
for(key in lightIDs)
{
{
if($('#hue_'+key).val() != "disabled")
{
cC++;
@@ -830,7 +833,7 @@
}
cC == 0 ? $('#btn_wiz_save').attr("disabled",true) : $('#btn_wiz_save').attr("disabled",false);
});
$('.hue_sel_watch').trigger('change');
}
else
@@ -847,4 +850,4 @@
$('#wizp2').toggle(true);
$('#wizp3').toggle(false);
$("#wiz_hue_usrstate").html($.i18n('wiz_hue_failure_connection'));
}
}