Gold linker, CCache, Stats, LGTM

- Increases linker performance under Linux builds by using Gold linker, if available
- ccache is used if available
- removed statistic class (Stats.cpp) from project due to the missing result (sorry @Brindosch)
- add LGTM bandges for code analysis overview

Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com>
This commit is contained in:
Paulchen-Panther
2019-06-05 18:19:08 +02:00
parent 140d841404
commit 2ccdfeb9e1
71 changed files with 532 additions and 750 deletions

View File

@@ -20,7 +20,6 @@ import sys
import socket
import serial
import serial.threaded
import time
class SerialToNet(serial.threaded.Protocol):

View File

@@ -34,7 +34,7 @@
createTable("","atb","about_cont");
for(var i = 0; i<fc.length; i++)
$('.atb').append(createTableRow([fc[i],sc[i]], "atb", false, true));
$('.atb').append(createTableRow([fc[i],sc[i]], "atb", false));
$('#danger_trig').off().on('click',function(){
dcount++;

View File

@@ -15,7 +15,8 @@
</div>
<script>
performTranslation('trans_update');
// performTranslation('trans_update');
performTranslation();
for (key in parsedUpdateJSON)
{

View File

@@ -4,22 +4,22 @@ $(document).ready( function() {
var editor_smoothing = null;
var editor_blackborder = null;
if(showOptHelp)
if(window.showOptHelp)
{
//color
$('#conf_cont').append(createRow('conf_cont_color'))
$('#conf_cont').append(createRow('conf_cont_color'));
$('#conf_cont_color').append(createOptPanel('fa-photo', $.i18n("edt_conf_color_heading_title"), 'editor_container_color', 'btn_submit_color'));
$('#conf_cont_color').append(createHelpTable(schema.color.properties, $.i18n("edt_conf_color_heading_title")));
$('#conf_cont_color').append(createHelpTable(window.schema.color.properties, $.i18n("edt_conf_color_heading_title")));
//smoothing
$('#conf_cont').append(createRow('conf_cont_smoothing'))
$('#conf_cont').append(createRow('conf_cont_smoothing'));
$('#conf_cont_smoothing').append(createOptPanel('fa-photo', $.i18n("edt_conf_smooth_heading_title"), 'editor_container_smoothing', 'btn_submit_smoothing'));
$('#conf_cont_smoothing').append(createHelpTable(schema.smoothing.properties, $.i18n("edt_conf_smooth_heading_title")));
$('#conf_cont_smoothing').append(createHelpTable(window.schema.smoothing.properties, $.i18n("edt_conf_smooth_heading_title")));
//blackborder
$('#conf_cont').append(createRow('conf_cont_blackborder'))
$('#conf_cont').append(createRow('conf_cont_blackborder'));
$('#conf_cont_blackborder').append(createOptPanel('fa-photo', $.i18n("edt_conf_bb_heading_title"), 'editor_container_blackborder', 'btn_submit_blackborder'));
$('#conf_cont_blackborder').append(createHelpTable(schema.blackborderdetector.properties, $.i18n("edt_conf_bb_heading_title")));
$('#conf_cont_blackborder').append(createHelpTable(window.schema.blackborderdetector.properties, $.i18n("edt_conf_bb_heading_title")));
}
else
{
@@ -31,7 +31,7 @@ $(document).ready( function() {
//color
editor_color = createJsonEditor('editor_container_color', {
color : schema.color
color : window.schema.color
}, true, true);
editor_color.on('change',function() {
@@ -44,7 +44,7 @@ $(document).ready( function() {
//smoothing
editor_smoothing = createJsonEditor('editor_container_smoothing', {
smoothing : schema.smoothing
smoothing : window.schema.smoothing
}, true, true);
editor_smoothing.on('change',function() {
@@ -57,7 +57,7 @@ $(document).ready( function() {
//blackborder
editor_blackborder = createJsonEditor('editor_container_blackborder', {
blackborderdetector: schema.blackborderdetector
blackborderdetector: window.schema.blackborderdetector
}, true, true);
editor_blackborder.on('change',function() {
@@ -72,7 +72,7 @@ $(document).ready( function() {
$('#editor_container_blackborder').append(buildWL("user/moretopics/bbmode","edt_conf_bb_mode_title",true));
//create introduction
if(showOptHelp)
if(window.showOptHelp)
{
createHint("intro", $.i18n('conf_colors_color_intro'), "editor_container_color");
createHint("intro", $.i18n('conf_colors_smoothing_intro'), "editor_container_smoothing");

View File

@@ -1,58 +1,58 @@
$(document).ready( function() {
performTranslation();
function newsCont(t,e,l)
{
var h = '<div style="padding-left:9px;border-left:6px solid #0088cc;">';
h += '<h4 style="font-weight:bold;font-size:17px">'+t+'</h4>';
h += e;
h += '<a href="'+l+'" class="" target="_blank"><i class="fa fa-fw fa-newspaper-o"></i>'+$.i18n('dashboard_newsbox_readmore')+'</a>';
h += '</div><hr/>';
$('#dash_news').append(h);
}
// function newsCont(t,e,l)
// {
// var h = '<div style="padding-left:9px;border-left:6px solid #0088cc;">';
// h += '<h4 style="font-weight:bold;font-size:17px">'+t+'</h4>';
// h += e;
// h += '<a href="'+l+'" class="" target="_blank"><i class="fa fa-fw fa-newspaper-o"></i>'+$.i18n('dashboard_newsbox_readmore')+'</a>';
// h += '</div><hr/>';
// $('#dash_news').append(h);
// }
function createNews(d)
{
for(var i = 0; i<d.length; i++)
{
if(i > 5)
break;
// function createNews(d)
// {
// for(var i = 0; i<d.length; i++)
// {
// if(i > 5)
// break;
//
// var title = d[i].title.rendered;
// var excerpt = d[i].excerpt.rendered;
// var link = d[i].link+'?pk_campaign=WebUI&pk_kwd=news_'+d[i].slug;
//
// newsCont(title,excerpt,link);
// }
// }
title = d[i].title.rendered;
excerpt = d[i].excerpt.rendered;
link = d[i].link+'?pk_campaign=WebUI&pk_kwd=news_'+d[i].slug;
// function getNews()
// {
// var h = '<span style="color:red;font-weight:bold">'+$.i18n('dashboard_newsbox_noconn')+'</span>';
// $.ajax({
// url: 'https://hyperion-project.org/wp-json/wp/v2/posts?_embed',
// dataType: 'json',
// type: 'GET',
// timeout: 2000
// })
// .done( function( data, textStatus, jqXHR ) {
// if(jqXHR.status == 200)
// createNews(data);
// else
// $('#dash_news').html(h);
// })
// .fail( function( jqXHR, textStatus ) {
// $('#dash_news').html(h);
// });
// }
newsCont(title,excerpt,link);
}
}
function getNews()
{
var h = '<span style="color:red;font-weight:bold">'+$.i18n('dashboard_newsbox_noconn')+'</span>';
$.ajax({
url: 'https://hyperion-project.org/wp-json/wp/v2/posts?_embed',
dataType: 'json',
type: 'GET',
timeout: 2000
})
.done( function( data, textStatus, jqXHR ) {
if(jqXHR.status == 200)
createNews(data);
else
$('#dash_news').html(h);
})
.fail( function( jqXHR, textStatus ) {
$('#dash_news').html(h);
});
}
//getNews();
// getNews();
function updateComponents()
{
var components = comps;
components_html = "";
for ( idx=0; idx<components.length;idx++)
var components = window.comps;
var components_html = "";
for ( var idx=0; idx<components.length;idx++)
{
if(components[idx].name != "ALL")
components_html += '<tr><td>'+$.i18n('general_comp_'+components[idx].name)+'</td><td><i class="fa fa-circle component-'+(components[idx].enabled?"on":"off")+'"></i></td></tr>';
@@ -60,7 +60,7 @@ $(document).ready( function() {
$("#tab_components").html(components_html);
//info
hyperion_enabled = true;
var hyperion_enabled = true;
components.forEach( function(obj) {
if (obj.name == "ALL")
@@ -74,27 +74,28 @@ $(document).ready( function() {
}
// add more info
$('#dash_leddevice').html(serverInfo.ledDevices.active);
$('#dash_currv').html(currentVersion);
$('#dash_instance').html(serverConfig.general.name);
$('#dash_ports').html(serverConfig.flatbufServer.port+' | '+serverConfig.protoServer.port);
$('#dash_leddevice').html(window.serverInfo.ledDevices.active);
$('#dash_currv').html(window.currentVersion);
$('#dash_instance').html(window.serverConfig.general.name);
$('#dash_ports').html(window.serverConfig.flatbufServer.port+' | '+window.serverConfig.protoServer.port);
$.get( "https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/version.json", function( data ) {
parsedUpdateJSON = JSON.parse(data);
latestVersion = parsedUpdateJSON[0].versionnr;
var cleanLatestVersion = latestVersion.replace(/\./g, '');
var cleanCurrentVersion = currentVersion.replace(/\./g, '');
window.parsedUpdateJSON = JSON.parse(data);
window.latestVersion = window.parsedUpdateJSON[0].versionnr;
// var cleanLatestVersion = window.latestVersion.replace(/\./g, '');
// var cleanCurrentVersion = window.currentVersion.replace(/\./g, '');
// $('#dash_latev').html(latestVersion);
$('#dash_latev').html(window.currentVersion);
// $('#dash_latev').html(window.latestVersion);
// if ( cleanCurrentVersion < cleanLatestVersion )
// $('#versioninforesult').html('<div class="bs-callout bs-callout-warning" style="margin:0px">'+$.i18n('dashboard_infobox_message_updatewarning', latestVersion)+'</div>');
// $('#versioninforesult').html('<div class="bs-callout bs-callout-warning" style="margin:0px">'+$.i18n('dashboard_infobox_message_updatewarning', window.latestVersion)+'</div>');
// else
$('#versioninforesult').html('<div class="bs-callout bs-callout-success" style="margin:0px">'+$.i18n('dashboard_infobox_message_updatesuccess')+'</div>');
});
//determine platform
var grabbers = serverInfo.grabbers.available;
var grabbers = window.serverInfo.grabbers.available;
var html = "";
if(grabbers.indexOf('dispmanx') > -1)
@@ -113,9 +114,9 @@ $(document).ready( function() {
//interval update
updateComponents();
$(hyperion).on("components-updated",updateComponents);
$(window.hyperion).on("components-updated",updateComponents);
if(showOptHelp)
if(window.showOptHelp)
createHintH("intro", $.i18n('dashboard_label_intro'), "dash_intro");
removeOverlay();

View File

@@ -2,29 +2,29 @@ $(document).ready( function() {
performTranslation();
var oldEffects = [];
var effects_editor = null;
var confFgEff = serverConfig.foregroundEffect.effect;
var confBgEff = serverConfig.backgroundEffect.effect;
var confFgEff = window.serverConfig.foregroundEffect.effect;
var confBgEff = window.serverConfig.backgroundEffect.effect;
var foregroundEffect_editor = null;
var backgroundEffect_editor = null;
if(showOptHelp)
if(window.showOptHelp)
{
//foreground effect
$('#conf_cont').append(createRow('conf_cont_fge'))
$('#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")));
$('#conf_cont_fge').append(createHelpTable(window.schema.foregroundEffect.properties, $.i18n("edt_conf_fge_heading_title")));
//background effect
$('#conf_cont').append(createRow('conf_cont_bge'))
$('#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")));
$('#conf_cont_bge').append(createHelpTable(window.schema.backgroundEffect.properties, $.i18n("edt_conf_bge_heading_title")));
//effect path
if(storedAccess != 'default')
{
$('#conf_cont').append(createRow('conf_cont_ef'))
$('#conf_cont').append(createRow('conf_cont_ef'));
$('#conf_cont_ef').append(createOptPanel('fa-spinner', $.i18n("edt_conf_effp_heading_title"), 'editor_container_effects', 'btn_submit_effects'));
$('#conf_cont_ef').append(createHelpTable(schema.effects.properties, $.i18n("edt_conf_effp_heading_title")));
$('#conf_cont_ef').append(createHelpTable(window.schema.effects.properties, $.i18n("edt_conf_effp_heading_title")));
}
}
else
@@ -39,7 +39,7 @@ $(document).ready( function() {
if(storedAccess != 'default')
{
effects_editor = createJsonEditor('editor_container_effects', {
effects : schema.effects
effects : window.schema.effects
}, true, true);
effects_editor.on('change',function() {
@@ -52,11 +52,11 @@ $(document).ready( function() {
}
foregroundEffect_editor = createJsonEditor('editor_container_foregroundEffect', {
foregroundEffect : schema.foregroundEffect
foregroundEffect : window.schema.foregroundEffect
}, true, true);
backgroundEffect_editor = createJsonEditor('editor_container_backgroundEffect', {
backgroundEffect : schema.backgroundEffect
backgroundEffect : window.schema.backgroundEffect
}, true, true);
@@ -75,19 +75,19 @@ $(document).ready( function() {
$('#btn_submit_foregroundEffect').off().on('click',function() {
var value = foregroundEffect_editor.getValue();
if(typeof value.foregroundEffect.effect == 'undefined')
value.foregroundEffect.effect = serverConfig.foregroundEffect.effect;
value.foregroundEffect.effect = window.serverConfig.foregroundEffect.effect;
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;
value.backgroundEffect.effect = window.serverConfig.backgroundEffect.effect;
requestWriteConfig(value);
});
//create introduction
if(showOptHelp)
if(window.showOptHelp)
{
createHint("intro", $.i18n('conf_effect_path_intro'), "editor_container_effects");
createHint("intro", $.i18n('conf_effect_fgeff_intro'), "editor_container_foregroundEffect");
@@ -95,14 +95,14 @@ $(document).ready( function() {
}
function updateEffectlist(){
var newEffects = serverInfo.effects;
var newEffects = window.serverInfo.effects;
if (newEffects.length != oldEffects.length)
{
$('#root_foregroundEffect_effect').html('');
var usrEffArr = [];
var sysEffArr = [];
for(i = 0; i < newEffects.length; i++)
for(var i = 0; i < newEffects.length; i++)
{
var effectName = newEffects[i].name;
if(!/^\:/.test(newEffects[i].file))
@@ -121,8 +121,8 @@ $(document).ready( function() {
}
//interval update
$(hyperion).on("cmd-effects-update", function(event){
serverInfo.effects = event.response.data.effects
$(window.hyperion).on("cmd-effects-update", function(event){
window.serverInfo.effects = event.response.data.effects
updateEffectlist();
});

View File

@@ -7,11 +7,11 @@ $(document).ready( function() {
var effectPy = "";
var testrun;
if(showOptHelp)
if(window.showOptHelp)
createHintH("intro", $.i18n('effectsconfigurator_label_intro'), "intro_effc");
function updateDelEffectlist(){
var newDelList = serverInfo.effects;
var newDelList = window.serverInfo.effects;
if(newDelList.length != oldDelList.length)
{
$('#effectsdellist').html("");
@@ -107,7 +107,7 @@ $(document).ready( function() {
// Save Effect
$('#btn_write').off().on('click',function() {
requestWriteEffect(effectName,effectPy,JSON.stringify(effects_editor.getValue()),imageData);
$(hyperion).one("cmd-create-effect", function(event) {
$(window.hyperion).one("cmd-create-effect", function(event) {
if (event.response.success)
showInfoDialog('success', "", $.i18n('infoDialog_effconf_created_text', effectName));
});
@@ -137,7 +137,7 @@ $(document).ready( function() {
$('#btn_delete').off().on('click',function() {
var name = $("#effectsdellist").val().split("_")[1];
requestDeleteEffect(name);
$(hyperion).one("cmd-delete-effect", function(event) {
$(window.hyperion).one("cmd-delete-effect", function(event) {
if (event.response.success)
showInfoDialog('success', "", $.i18n('infoDialog_effconf_deleted_text', name));
});
@@ -163,15 +163,15 @@ $(document).ready( function() {
$("#name-input").val(name);
}
var efx = serverInfo.effects;
var efx = window.serverInfo.effects;
for(var i = 0; i<efx.length; i++)
{
if(efx[i].name == name)
{
var py = efx[i].script.split("/").pop()
var py = efx[i].script.split("/").pop();
$("#effectslist").val(py).trigger("change");
for(key in efx[i].args)
for(var key in efx[i].args)
{
var ed = effects_editor.getEditor('root.args.'+[key]);
if(ed)
@@ -183,7 +183,7 @@ $(document).ready( function() {
});
//create basic effect list
var effects = serverSchema.properties.effectSchemas.internal
var effects = window.serverSchema.properties.effectSchemas.internal;
for(var idx=0; idx<effects.length; idx++)
{
$("#effectslist").append(createSelOpt(effects[idx].schemaContent.script, $.i18n(effects[idx].schemaContent.title)));
@@ -193,8 +193,8 @@ $(document).ready( function() {
updateDelEffectlist();
//interval update
$(hyperion).on("cmd-effects-update", function(event){
serverInfo.effects = event.response.data.effects
$(window.hyperion).on("cmd-effects-update", function(event){
window.serverInfo.effects = event.response.data.effects
updateDelEffectlist();
});

View File

@@ -6,15 +6,15 @@ $(document).ready( function() {
var conf_editor = null;
$('#conf_cont').append(createOptPanel('fa-wrench', $.i18n("edt_conf_gen_heading_title"), 'editor_container', 'btn_submit'));
if(showOptHelp)
if(window.showOptHelp)
{
$('#conf_cont').append(createHelpTable(schema.general.properties, $.i18n("edt_conf_gen_heading_title")));
$('#conf_cont').append(createHelpTable(window.schema.general.properties, $.i18n("edt_conf_gen_heading_title")));
}
else
$('#conf_imp').appendTo('#conf_cont');
conf_editor = createJsonEditor('editor_container', {
general: schema.general
general: window.schema.general
}, true, true);
conf_editor.on('change',function() {
@@ -88,7 +88,7 @@ $(document).ready( function() {
//export
$('#btn_export_conf').off().on('click', function(){
var name = serverConfig.general.name;
var name = window.serverConfig.general.name;
var d = new Date();
var month = d.getMonth()+1;
@@ -98,11 +98,11 @@ $(document).ready( function() {
(month<10 ? '0' : '') + month + '.' +
(day<10 ? '0' : '') + day;
download(JSON.stringify(serverConfig, null, "\t"), 'Hyperion-'+currentVersion+'-Backup ('+name+') '+timestamp+'.json', "application/json");
download(JSON.stringify(window.serverConfig, null, "\t"), 'Hyperion-'+window.currentVersion+'-Backup ('+name+') '+timestamp+'.json', "application/json");
});
//create introduction
if(showOptHelp)
if(window.showOptHelp)
createHint("intro", $.i18n('conf_general_intro'), "editor_container");
removeOverlay();

View File

@@ -12,22 +12,22 @@ $(document).ready( function() {
}
}
if(showOptHelp)
if(window.showOptHelp)
{
//fg
$('#conf_cont').append(createRow('conf_cont_instCapt'))
$('#conf_cont').append(createRow('conf_cont_instCapt'));
$('#conf_cont_instCapt').append(createOptPanel('fa-camera', $.i18n("edt_conf_instCapture_heading_title"), 'editor_container_instCapt', 'btn_submit_instCapt'));
$('#conf_cont_instCapt').append(createHelpTable(schema.instCapture.properties, $.i18n("edt_conf_instCapture_heading_title")));
$('#conf_cont_instCapt').append(createHelpTable(window.schema.instCapture.properties, $.i18n("edt_conf_instCapture_heading_title")));
//fg
$('#conf_cont').append(createRow('conf_cont_fg'))
$('#conf_cont').append(createRow('conf_cont_fg'));
$('#conf_cont_fg').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_fg', 'btn_submit_fg'));
$('#conf_cont_fg').append(createHelpTable(schema.framegrabber.properties, $.i18n("edt_conf_fg_heading_title")));
$('#conf_cont_fg').append(createHelpTable(window.schema.framegrabber.properties, $.i18n("edt_conf_fg_heading_title")));
//v4l
$('#conf_cont').append(createRow('conf_cont_v4l'))
$('#conf_cont').append(createRow('conf_cont_v4l'));
$('#conf_cont_v4l').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2'));
$('#conf_cont_v4l').append(createHelpTable(schema.grabberV4L2.properties, $.i18n("edt_conf_v4l2_heading_title")));
$('#conf_cont_v4l').append(createHelpTable(window.schema.grabberV4L2.properties, $.i18n("edt_conf_v4l2_heading_title")));
}
else
{
@@ -38,7 +38,7 @@ $(document).ready( function() {
}
//instCapt
conf_editor_instCapt = createJsonEditor('editor_container_instCapt', {
instCapture: schema.instCapture
instCapture: window.schema.instCapture
}, true, true);
conf_editor_instCapt.on('change',function() {
@@ -52,7 +52,7 @@ $(document).ready( function() {
//fg
conf_editor_fg = createJsonEditor('editor_container_fg', {
framegrabber: schema.framegrabber
framegrabber: window.schema.framegrabber
}, true, true);
conf_editor_fg.on('change',function() {
@@ -65,7 +65,7 @@ $(document).ready( function() {
//vl4
conf_editor_v4l2 = createJsonEditor('editor_container_v4l2', {
grabberV4L2 : schema.grabberV4L2
grabberV4L2 : window.schema.grabberV4L2
}, true, true);
conf_editor_v4l2.on('change',function() {
@@ -77,7 +77,7 @@ $(document).ready( function() {
});
//create introduction
if(showOptHelp)
if(window.showOptHelp)
{
createHint("intro", $.i18n('conf_grabber_fg_intro'), "editor_container_fg");
createHint("intro", $.i18n('conf_grabber_v4l_intro'), "editor_container_v4l2");
@@ -85,7 +85,7 @@ $(document).ready( function() {
//hide specific options
conf_editor_fg.on('ready',function() {
var grabbers = serverInfo.grabbers.available;
var grabbers = window.serverInfo.grabbers.available;
if(grabbers.indexOf('dispmanx') > -1)
hideEl(["device","pixelDecimation"]);

View File

@@ -4,14 +4,14 @@ $(document).ready( function() {
loadContentTo("#container_restart","restart");
initWebSocket();
$(hyperion).on("cmd-serverinfo",function(event){
serverInfo = event.response.info;
$(window.hyperion).on("cmd-serverinfo",function(event){
window.serverInfo = event.response.info;
// comps
comps = event.response.info.components
window.comps = event.response.info.components
$(hyperion).trigger("ready");
$(window.hyperion).trigger("ready");
comps.forEach( function(obj) {
window.comps.forEach( function(obj) {
if (obj.name == "ALL")
{
if(obj.enabled)
@@ -21,7 +21,7 @@ $(document).ready( function() {
}
});
if (serverInfo.hyperion.enabled)
if (window.serverInfo.hyperion.enabled)
$("#hyperion_disabled_notify").fadeOut("fast");
else
$("#hyperion_disabled_notify").fadeIn("fast");
@@ -29,59 +29,59 @@ $(document).ready( function() {
updateSessions();
}); // end cmd-serverinfo
$(hyperion).on("cmd-sessions-update", function(event) {
serverInfo.sessions = event.response.data;
$(window.hyperion).on("cmd-sessions-update", function(event) {
window.serverInfo.sessions = event.response.data;
updateSessions();
});
$(hyperion).on("cmd-sysinfo", function(event) {
$(window.hyperion).on("cmd-sysinfo", function(event) {
requestServerInfo();
sysInfo = event.response.info;
window.sysInfo = event.response.info;
currentVersion = sysInfo.hyperion.version;
window.currentVersion = window.sysInfo.hyperion.version;
});
$(hyperion).one("cmd-config-getschema", function(event) {
serverSchema = event.response.info;
$(window.hyperion).one("cmd-config-getschema", function(event) {
window.serverSchema = event.response.info;
requestServerConfig();
schema = serverSchema.properties;
window.schema = window.serverSchema.properties;
});
$(hyperion).on("cmd-config-getconfig", function(event) {
serverConfig = event.response.info;
$(window.hyperion).on("cmd-config-getconfig", function(event) {
window.serverConfig = event.response.info;
requestSysInfo();
showOptHelp = serverConfig.general.showOptHelp;
window.showOptHelp = window.serverConfig.general.showOptHelp;
});
$(hyperion).on("cmd-config-setconfig", function(event) {
$(window.hyperion).on("cmd-config-setconfig", function(event) {
if (event.response.success === true) {
$('#hyperion_config_write_success_notify').fadeIn().delay(5000).fadeOut();
}
});
$(hyperion).on("error",function(event){
$(window.hyperion).on("error",function(event){
showInfoDialog("error","Error", event.reason);
});
$(hyperion).on("open",function(event){
$(window.hyperion).on("open",function(event){
requestServerConfigSchema();
});
$(hyperion).one("ready", function(event) {
$(window.hyperion).one("ready", function(event) {
loadContent();
});
$(hyperion).on("cmd-adjustment-update", function(event) {
serverInfo.adjustment = event.response.data
$(window.hyperion).on("cmd-adjustment-update", function(event) {
window.serverInfo.adjustment = event.response.data
});
$(hyperion).on("cmd-videomode-update", function(event) {
serverInfo.videomode = event.response.data.videomode
$(window.hyperion).on("cmd-videomode-update", function(event) {
window.serverInfo.videomode = event.response.data.videomode
});
$(hyperion).on("cmd-components-update", function(event) {
$(window.hyperion).on("cmd-components-update", function(event) {
let obj = event.response.data
// notfication in index
@@ -93,17 +93,17 @@ $(document).ready( function() {
$("#hyperion_disabled_notify").fadeIn("fast");
}
comps.forEach((entry, index) => {
window.comps.forEach((entry, index) => {
if (entry.name === obj.name){
comps[index] = obj;
window.comps[index] = obj;
}
});
// notify the update
$(hyperion).trigger("components-updated");
$(window.hyperion).trigger("components-updated");
});
$(hyperion).on("cmd-effects-update", function(event){
serverInfo.effects = event.response.data.effects
$(window.hyperion).on("cmd-effects-update", function(event){
window.serverInfo.effects = event.response.data.effects
});
$(".mnava").bind('click.menu', function(e){

View File

@@ -30,19 +30,19 @@ function createLedPreview(leds, origin){
$('.st_helper').css("border", "8px solid grey");
canvas_height = $('#leds_preview').innerHeight();
canvas_width = $('#leds_preview').innerWidth();
var canvas_height = $('#leds_preview').innerHeight();
var canvas_width = $('#leds_preview').innerWidth();
leds_html = "";
var leds_html = "";
for(var idx=0; idx<leds.length; idx++)
{
led = leds[idx];
led_id='ledc_'+[idx];
bgcolor = "background-color:hsl("+(idx*360/leds.length)+",100%,50%);";
pos = "left:"+(led.hscan.minimum * canvas_width)+"px;"+
var led = leds[idx];
var led_id='ledc_'+[idx];
var bgcolor = "background-color:hsl("+(idx*360/leds.length)+",100%,50%);";
var pos = "left:"+(led.hscan.minimum * canvas_width)+"px;"+
"top:"+(led.vscan.minimum * canvas_height)+"px;"+
"width:"+((led.hscan.maximum-led.hscan.minimum) * canvas_width-1)+"px;"+
"height:"+((led.vscan.maximum-led.vscan.minimum) * canvas_height-1)+"px;";
"width:"+((led.hscan.maximum-led.hscan.minimum) * (canvas_width-1))+"px;"+
"height:"+((led.vscan.maximum-led.vscan.minimum) * (canvas_height-1))+"px;";
leds_html += '<div id="'+led_id+'" class="led" style="'+bgcolor+pos+'" title="'+led.index+'"><span id="'+led_id+'_num" class="led_prev_num">'+led.index+'</span></div>';
}
$('#leds_preview').html(leds_html);
@@ -87,10 +87,10 @@ function createClassicLeds(){
function createFinalArray(array){
finalLedArray = [];
for(var i = 0; i<array.length; i++){
hmin = array[i].hscan.minimum;
hmax = array[i].hscan.maximum;
vmin = array[i].vscan.minimum;
vmax = array[i].vscan.maximum;
var hmin = array[i].hscan.minimum;
var hmax = array[i].hscan.maximum;
var vmin = array[i].vscan.minimum;
var vmax = array[i].vscan.maximum;
finalLedArray[i] = { "index" : i, "hscan": { "maximum" : hmax, "minimum" : hmin }, "vscan": { "maximum": vmax, "minimum": vmin}}
}
createLedPreview(finalLedArray, 'classic');
@@ -115,9 +115,9 @@ function createClassicLeds(){
function valScan(val)
{
if(val > 1)
return val = 1;
return 1;
if(val < 0)
return val = 0;
return 0;
return val;
}
@@ -138,62 +138,65 @@ function createClassicLeds(){
}
function createTopLeds(){
step=(Hmax-Hmin)/ledstop;
var step=(Hmax-Hmin)/ledstop;
//if(cornerVGap != '0')
// step=(Hmax-Hmin-(cornerHGap*2))/ledstop;
vmin=Vmin;
vmax=vmin+ledsHDepth;
var vmin=Vmin;
var vmax=vmin+ledsHDepth;
for (var i = 0; i<ledstop; i++){
hmin = ovl("-",(Hdiff/ledstop*[i])+edgeHGap);
hmax = ovl("+",(Hdiff/ledstop*[i])+step+edgeHGap);
var hmin = ovl("-",(Hdiff/ledstop*Number([i]))+edgeHGap);
var hmax = ovl("+",(Hdiff/ledstop*Number([i]))+step+edgeHGap);
createLedArray(hmin, hmax, vmin, vmax);
}
}
function createLeftLeds(){
step=(Vmax-Vmin)/ledsleft;
var step=(Vmax-Vmin)/ledsleft;
//if(cornerVGap != '0')
// step=(Vmax-Vmin-(cornerVGap*2))/ledsleft;
hmin=Hmin;
hmax=hmin+ledsVDepth;
var hmin=Hmin;
var hmax=hmin+ledsVDepth;
for (var i = ledsleft-1; i>-1; --i){
vmin = ovl("-",(Vdiff/ledsleft*[i])+edgeVGap);
vmax = ovl("+",(Vdiff/ledsleft*[i])+step+edgeVGap);
var vmin = ovl("-",(Vdiff/ledsleft*Number([i]))+edgeVGap);
var vmax = ovl("+",(Vdiff/ledsleft*Number([i]))+step+edgeVGap);
createLedArray(hmin, hmax, vmin, vmax);
}
}
function createRightLeds(){
step=(Vmax-Vmin)/ledsright;
var step=(Vmax-Vmin)/ledsright;
//if(cornerVGap != '0')
// step=(Vmax-Vmin-(cornerVGap*2))/ledsright;
hmax=Hmax;
hmin=hmax-ledsVDepth;
var hmax=Hmax;
var hmin=hmax-ledsVDepth;
for (var i = 0; i<ledsright; i++){
vmin = ovl("-",(Vdiff/ledsright*[i])+edgeVGap);
vmax = ovl("+",(Vdiff/ledsright*[i])+step+edgeVGap);
var vmin = ovl("-",(Vdiff/ledsright*Number([i]))+edgeVGap);
var vmax = ovl("+",(Vdiff/ledsright*Number([i]))+step+edgeVGap);
createLedArray(hmin, hmax, vmin, vmax);
}
}
function createBottomLeds(){
step=(Hmax-Hmin)/ledsbottom;
var step=(Hmax-Hmin)/ledsbottom;
//if(cornerVGap != '0')
// step=(Hmax-Hmin-(cornerHGap*2))/ledsbottom;
vmax=Vmax;
vmin=vmax-ledsHDepth;
var vmax=Vmax;
var vmin=vmax-ledsHDepth;
for (var i = ledsbottom-1; i>-1; i--){
hmin = ovl("-",(Hdiff/ledsbottom*[i])+edgeHGap);
hmax = ovl("+",(Hdiff/ledsbottom*[i])+step+edgeHGap);
var hmin = ovl("-",(Hdiff/ledsbottom*Number([i]))+edgeHGap);
var hmax = ovl("+",(Hdiff/ledsbottom*Number([i]))+step+edgeHGap);
createLedArray(hmin, hmax, vmin, vmax);
}
}
createLeftLeds(createBottomLeds(createRightLeds(createTopLeds())));
createLeftLeds();
createBottomLeds();
createRightLeds();
createTopLeds();
//check led gap pos
if (ledsgpos+ledsglength > ledArray.length)
@@ -308,17 +311,17 @@ $(document).ready(function() {
performTranslation();
//add intros
if(showOptHelp)
if(window.showOptHelp)
{
createHintH("intro", $.i18n('conf_leds_device_intro'), "leddevice_intro");
createHintH("intro", $.i18n('conf_leds_layout_intro'), "layout_intro");
$('#led_vis_help').html('<div><div class="led_ex" style="background-color:black;margin-right:5px;margin-top:3px"></div><div style="display:inline-block;vertical-align:top">'+$.i18n('conf_leds_layout_preview_l1')+'</div></div><div class="led_ex" style="background-color:grey;margin-top:3px;margin-right:2px"></div><div class="led_ex" style="background-color: rgb(169, 169, 169);margin-right:5px;margin-top:3px;"></div><div style="display:inline-block;vertical-align:top">'+$.i18n('conf_leds_layout_preview_l2')+'</div>');
}
var slConfig = serverConfig.ledConfig;
var slConfig = window.serverConfig.ledConfig;
//restore ledConfig
for(key in slConfig)
for(var key in slConfig)
{
if(typeof(slConfig[key]) === "boolean")
$('#ip_cl_'+key).prop('checked', slConfig[key]);
@@ -329,7 +332,7 @@ $(document).ready(function() {
function saveValues()
{
var ledConfig = {};
for(key in slConfig)
for(var key in slConfig)
{
if(typeof(slConfig[key]) === "boolean")
ledConfig[key] = $('#ip_cl_'+key).is(':checked');
@@ -370,7 +373,7 @@ $(document).ready(function() {
});
// v4 of json schema with diff required assignment - remove when hyperion schema moved to v4
var ledschema = {"items":{"additionalProperties":false,"required":["hscan","vscan","index"],"properties":{"clone":{"type":"integer"},"colorOrder":{"enum":["rgb","bgr","rbg","brg","gbr","grb"],"type":"string"},"hscan":{"additionalProperties":false,"properties":{"maximum":{"maximum":1,"minimum":0,"type":"number"},"minimum":{"maximum":1,"minimum":0,"type":"number"}},"type":"object"},"index":{"type":"integer"},"vscan":{"additionalProperties":false,"properties":{"maximum":{"maximum":1,"minimum":0,"type":"number"},"minimum":{"maximum":1,"minimum":0,"type":"number"}},"type":"object"}},"type":"object"},"type":"array"}
var ledschema = {"items":{"additionalProperties":false,"required":["hscan","vscan","index"],"properties":{"clone":{"type":"integer"},"colorOrder":{"enum":["rgb","bgr","rbg","brg","gbr","grb"],"type":"string"},"hscan":{"additionalProperties":false,"properties":{"maximum":{"maximum":1,"minimum":0,"type":"number"},"minimum":{"maximum":1,"minimum":0,"type":"number"}},"type":"object"},"index":{"type":"integer"},"vscan":{"additionalProperties":false,"properties":{"maximum":{"maximum":1,"minimum":0,"type":"number"},"minimum":{"maximum":1,"minimum":0,"type":"number"}},"type":"object"}},"type":"object"},"type":"array"};
//create jsonace editor
var aceEdt = new JSONACEEditor(document.getElementById("aceedit"),{
mode: 'code',
@@ -396,7 +399,7 @@ $(document).ready(function() {
$('#leds_custom_save').attr("disabled", true);
}
}
}, serverConfig.leds);
}, window.serverConfig.leds);
//TODO: HACK! No callback for schema validation - Add it!
setInterval(function(){
@@ -405,12 +408,12 @@ $(document).ready(function() {
$('#leds_custom_updsim').attr("disabled", true);
$('#leds_custom_save').attr("disabled", true);
}
},1000)
},1000);
$('.jsoneditor-menu').toggle();
// leds to finalLedArray
finalLedArray = serverConfig.leds;
finalLedArray = window.serverConfig.leds;
// cl/ma leds push to textfield
$('#btn_cl_generate, #btn_ma_generate').off().on("click", function(e) {
@@ -425,28 +428,28 @@ $(document).ready(function() {
// create and update editor
$("#leddevices").off().on("change", function() {
generalOptions = serverSchema.properties.device;
specificOptions = serverSchema.properties.alldevices[$(this).val()];
var generalOptions = window.serverSchema.properties.device;
var specificOptions = window.serverSchema.properties.alldevices[$(this).val()];
conf_editor = createJsonEditor('editor_container', {
generalOptions : generalOptions,
specificOptions : specificOptions,
});
values_general = {};
values_specific = {};
isCurrentDevice = (serverInfo.ledDevices.active == $(this).val());
var values_general = {};
var values_specific = {};
var isCurrentDevice = (window.serverInfo.ledDevices.active == $(this).val());
for(var key in serverConfig.device){
for(var key in window.serverConfig.device){
if (key != "type" && key in generalOptions.properties)
values_general[key] = serverConfig.device[key];
values_general[key] = window.serverConfig.device[key];
};
conf_editor.getEditor("root.generalOptions").setValue( values_general );
if (isCurrentDevice)
{
specificOptions_val = conf_editor.getEditor("root.specificOptions").getValue()
var specificOptions_val = conf_editor.getEditor("root.specificOptions").getValue()
for(var key in specificOptions_val){
values_specific[key] = (key in serverConfig.device) ? serverConfig.device[key] : specificOptions_val[key];
values_specific[key] = (key in window.serverConfig.device) ? window.serverConfig.device[key] : specificOptions_val[key];
};
conf_editor.getEditor("root.specificOptions").setValue( values_specific );
@@ -469,12 +472,12 @@ $(document).ready(function() {
});
// create led device selection
ledDevices = serverInfo.ledDevices.available
devRPiSPI = ['apa102', 'apa104', 'ws2801', 'lpd6803', 'lpd8806', 'p9813', 'sk6812spi', 'sk6822spi', 'ws2812spi'];
devRPiPWM = ['ws281x'];
devRPiGPIO = ['piblaster'];
devNET = ['atmoorb', 'fadecandy', 'philipshue', 'nanoleaf', 'tinkerforge', 'tpm2net', 'udpe131', 'udpartnet', 'udph801', 'udpraw'];
devUSB = ['adalight', 'dmx', 'atmo', 'hyperionusbasp', 'lightpack', 'multilightpack', 'paintpack', 'rawhid', 'sedu', 'tpm2', 'karate'];
var ledDevices = window.serverInfo.ledDevices.available;
var devRPiSPI = ['apa102', 'apa104', 'ws2801', 'lpd6803', 'lpd8806', 'p9813', 'sk6812spi', 'sk6822spi', 'ws2812spi'];
var devRPiPWM = ['ws281x'];
var devRPiGPIO = ['piblaster'];
var devNET = ['atmoorb', 'fadecandy', 'philipshue', 'aurora', 'tinkerforge', 'tpm2net', 'udpe131', 'udpartnet', 'udph801', 'udpraw'];
var devUSB = ['adalight', 'dmx', 'atmo', 'hyperionusbasp', 'lightpack', 'multilightpack', 'paintpack', 'rawhid', 'sedu', 'tpm2', 'karate'];
var optArr = [[]];
optArr[1]=[];
@@ -483,7 +486,7 @@ $(document).ready(function() {
optArr[4]=[];
optArr[5]=[];
for (idx=0; idx<ledDevices.length; idx++)
for (var idx=0; idx<ledDevices.length; idx++)
{
if($.inArray(ledDevices[idx], devRPiSPI) != -1)
optArr[0].push(ledDevices[idx]);
@@ -505,7 +508,7 @@ $(document).ready(function() {
$("#leddevices").append(createSel(optArr[3], $.i18n('conf_leds_optgroup_network')));
$("#leddevices").append(createSel(optArr[4], $.i18n('conf_leds_optgroup_usb')));
$("#leddevices").append(createSel(optArr[5], $.i18n('conf_leds_optgroup_debug')));
$("#leddevices").val(serverInfo.ledDevices.active);
$("#leddevices").val(window.serverInfo.ledDevices.active);
$("#leddevices").trigger("change");
// validate textfield and update preview
@@ -559,11 +562,11 @@ $(document).ready(function() {
// save led device config
$("#btn_submit_controller").off().on("click", function(event) {
ledDevice = $("#leddevices").val();
result = {device:{}};
var ledDevice = $("#leddevices").val();
var result = {device:{}};
general = conf_editor.getEditor("root.generalOptions").getValue();
specific = conf_editor.getEditor("root.specificOptions").getValue();
var general = conf_editor.getEditor("root.generalOptions").getValue();
var specific = conf_editor.getEditor("root.specificOptions").getValue();
for(var key in general){
result.device[key] = general[key];
}
@@ -577,6 +580,3 @@ $(document).ready(function() {
removeOverlay();
});

View File

@@ -10,15 +10,15 @@ $(document).ready(function() {
var reportUrl = 'https://report.hyperion-project.org/#';
$('#conf_cont').append(createOptPanel('fa-reorder', $.i18n("edt_conf_log_heading_title"), 'editor_container', 'btn_submit'));
if(showOptHelp)
if(window.showOptHelp)
{
$('#conf_cont').append(createHelpTable(schema.logger.properties, $.i18n("edt_conf_log_heading_title")));
$('#conf_cont').append(createHelpTable(window.schema.logger.properties, $.i18n("edt_conf_log_heading_title")));
createHintH("intro", $.i18n('conf_logging_label_intro'), "log_head");
}
$("#log_upl_pol").append('<span style="color:grey;font-size:80%">'+$.i18n("conf_logging_uplpolicy")+' '+buildWL("user/support#report_privacy_policy",$.i18n("conf_logging_contpolicy")));
conf_editor = createJsonEditor('editor_container', {
logger : schema.logger
logger : window.schema.logger
}, true, true);
conf_editor.on('change',function() {
@@ -61,11 +61,11 @@ $(document).ready(function() {
function uploadLog()
{
var log = "";
var config = JSON.stringify(serverConfig, null).replace(/"/g, '\"');
var prios = serverInfo.priorities;
var comps = serverInfo.components;
var sys = sysInfo.system;
var shy = sysInfo.hyperion;
var config = JSON.stringify(window.serverConfig, null).replace(/"/g, '\\"');
var prios = window.serverInfo.priorities;
var comps = window.serverInfo.components;
var sys = window.sysInfo.system;
var shy = window.sysInfo.hyperion;
var info;
//create log
@@ -78,8 +78,8 @@ $(document).ready(function() {
info += 'Version: '+shy.version+'\n';
info += 'UI Lang: '+storedLang+' (BrowserL: '+navigator.language+')\n';
info += 'UI Access: '+storedAccess+'\n';
info += 'Log lvl: '+serverConfig.logger.level+'\n';
info += 'Avail Capt: '+serverInfo.grabbers.available+'\n\n';
info += 'Log lvl: '+window.serverConfig.logger.level+'\n';
info += 'Avail Capt: '+window.serverInfo.grabbers.available+'\n\n';
info += 'Distribution:'+sys.prettyName+'\n';
info += 'Arch: '+sys.architecture+'\n';
info += 'Kernel: '+sys.kernelType+' ('+sys.kernelVersion+' (WS: '+sys.wordSize+'))\n';
@@ -96,10 +96,10 @@ $(document).ready(function() {
info += ' ';
info += ' ('+prios[i].component+') Owner: '+prios[i].owner+'\n';
}
info += '\npriorities_autoselect: '+serverInfo.priorities_autoselect+'\n\n';
info += '\npriorities_autoselect: '+window.serverInfo.priorities_autoselect+'\n\n';
//create comps
info += '### COMPONENTS ### \n'
info += '### COMPONENTS ### \n';
for(var i = 0; i<comps.length; i++)
{
info += comps[i].enabled+' - '+comps[i].name+'\n';
@@ -109,7 +109,7 @@ $(document).ready(function() {
info = JSON.stringify(info);
log = JSON.stringify(log);
config = JSON.stringify(config);
var title = 'Hyperion '+currentVersion+' Report ('+serverConfig.general.name+' ('+serverInfo.ledDevices.active+'))';
var title = 'Hyperion '+window.currentVersion+' Report ('+window.serverConfig.general.name+' ('+window.serverInfo.ledDevices.active+'))';
$.ajax({
url: 'https://api.hyperion-project.org/report.php',
@@ -140,15 +140,15 @@ $(document).ready(function() {
});
}
if (!loggingHandlerInstalled)
if (!window.loggingHandlerInstalled)
{
loggingHandlerInstalled = true;
$(hyperion).on("cmd-logging-update",function(event){
window.loggingHandlerInstalled = true;
$(window.hyperion).on("cmd-logging-update",function(event){
if ($("#logmessages").length == 0 && loggingStreamActive)
if ($("#logmessages").length == 0 && window.loggingStreamActive)
{
requestLoggingStop();
loggingStreamActive = false;
window.loggingStreamActive = false;
}
messages = (event.response.result.messages);
@@ -163,13 +163,13 @@ $(document).ready(function() {
}
for(var idx=0; idx<messages.length; idx++)
{
app_name = messages[idx].appName;
logger_name = messages[idx].loggerName;
function_ = messages[idx].function;
line = messages[idx].line;
file_name = messages[idx].fileName;
msg = messages[idx].message;
level_string = messages[idx].levelString;
var app_name = messages[idx].appName;
var logger_name = messages[idx].loggerName;
var function_ = messages[idx].function;
var line = messages[idx].line;
var file_name = messages[idx].fileName;
var msg = messages[idx].message;
var level_string = messages[idx].levelString;
var debug = "";

View File

@@ -1,7 +1,6 @@
$(document).ready( function() {
performTranslation();
var conf_editor_net = null;
var conf_editor_json = null;
var conf_editor_proto = null;
var conf_editor_fbs = null;
@@ -9,39 +8,39 @@ $(document).ready( function() {
var conf_editor_udpl = null;
var conf_editor_forw = null;
if(showOptHelp)
if(window.showOptHelp)
{
//jsonserver
$('#conf_cont').append(createRow('conf_cont_json'))
$('#conf_cont_json').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_js_heading_title"), 'editor_container_jsonserver', 'btn_submit_jsonserver'));
$('#conf_cont_json').append(createHelpTable(schema.jsonServer.properties, $.i18n("edt_conf_js_heading_title")));
$('#conf_cont_json').append(createHelpTable(window.schema.jsonServer.properties, $.i18n("edt_conf_js_heading_title")));
//flatbufserver
$('#conf_cont').append(createRow('conf_cont_flatbuf'))
$('#conf_cont_flatbuf').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_fbs_heading_title"), 'editor_container_fbserver', 'btn_submit_fbserver'));
$('#conf_cont_flatbuf').append(createHelpTable(schema.flatbufServer.properties, $.i18n("edt_conf_fbs_heading_title")));
$('#conf_cont_flatbuf').append(createHelpTable(window.schema.flatbufServer.properties, $.i18n("edt_conf_fbs_heading_title")));
//protoserver
$('#conf_cont').append(createRow('conf_cont_proto'))
$('#conf_cont_proto').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_pbs_heading_title"), 'editor_container_protoserver', 'btn_submit_protoserver'));
$('#conf_cont_proto').append(createHelpTable(schema.protoServer.properties, $.i18n("edt_conf_pbs_heading_title")));
$('#conf_cont_proto').append(createHelpTable(window.schema.protoServer.properties, $.i18n("edt_conf_pbs_heading_title")));
//boblight
$('#conf_cont').append(createRow('conf_cont_bobl'))
$('#conf_cont_bobl').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_bobls_heading_title"), 'editor_container_boblightserver', 'btn_submit_boblightserver'));
$('#conf_cont_bobl').append(createHelpTable(schema.boblightServer.properties, $.i18n("edt_conf_bobls_heading_title")));
$('#conf_cont_bobl').append(createHelpTable(window.schema.boblightServer.properties, $.i18n("edt_conf_bobls_heading_title")));
//udplistener
$('#conf_cont').append(createRow('conf_cont_udpl'))
$('#conf_cont_udpl').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_udpl_heading_title"), 'editor_container_udplistener', 'btn_submit_udplistener'));
$('#conf_cont_udpl').append(createHelpTable(schema.udpListener.properties, $.i18n("edt_conf_udpl_heading_title")));
$('#conf_cont_udpl').append(createHelpTable(window.schema.udpListener.properties, $.i18n("edt_conf_udpl_heading_title")));
//forwarder
if(storedAccess != 'default')
{
$('#conf_cont').append(createRow('conf_cont_fw'))
$('#conf_cont_fw').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_fw_heading_title"), 'editor_container_forwarder', 'btn_submit_forwarder'));
$('#conf_cont_fw').append(createHelpTable(schema.forwarder.properties, $.i18n("edt_conf_fw_heading_title")));
$('#conf_cont_fw').append(createHelpTable(window.schema.forwarder.properties, $.i18n("edt_conf_fw_heading_title")));
}
}
else
@@ -58,7 +57,7 @@ $(document).ready( function() {
//json
conf_editor_json = createJsonEditor('editor_container_jsonserver', {
jsonServer : schema.jsonServer
jsonServer : window.schema.jsonServer
}, true, true);
conf_editor_json.on('change',function() {
@@ -71,7 +70,7 @@ $(document).ready( function() {
//flatbuffer
conf_editor_fbs = createJsonEditor('editor_container_fbserver', {
flatbufServer : schema.flatbufServer
flatbufServer : window.schema.flatbufServer
}, true, true);
conf_editor_fbs.on('change',function() {
@@ -84,7 +83,7 @@ $(document).ready( function() {
//protobuffer
conf_editor_proto = createJsonEditor('editor_container_protoserver', {
protoServer : schema.protoServer
protoServer : window.schema.protoServer
}, true, true);
conf_editor_proto.on('change',function() {
@@ -97,7 +96,7 @@ $(document).ready( function() {
//boblight
conf_editor_bobl = createJsonEditor('editor_container_boblightserver', {
boblightServer : schema.boblightServer
boblightServer : window.schema.boblightServer
}, true, true);
conf_editor_bobl.on('change',function() {
@@ -110,7 +109,7 @@ $(document).ready( function() {
//udplistener
conf_editor_udpl = createJsonEditor('editor_container_udplistener', {
udpListener : schema.udpListener
udpListener : window.schema.udpListener
}, true, true);
conf_editor_udpl.on('change',function() {
@@ -125,7 +124,7 @@ $(document).ready( function() {
{
//forwarder
conf_editor_forw = createJsonEditor('editor_container_forwarder', {
forwarder : schema.forwarder
forwarder : window.schema.forwarder
}, true, true);
conf_editor_forw.on('change',function() {
@@ -138,7 +137,7 @@ $(document).ready( function() {
}
//create introduction
if(showOptHelp)
if(window.showOptHelp)
{
createHint("intro", $.i18n('conf_network_json_intro'), "editor_container_jsonserver");
createHint("intro", $.i18n('conf_network_fbs_intro'), "editor_container_fbserver");

View File

@@ -3,7 +3,7 @@ $(document).ready(function() {
var oldEffects = [];
var cpcolor = '#B500FF';
var mappingList = serverSchema.properties.color.properties.imageToLedMappingType.enum;
var mappingList = window.serverSchema.properties.color.properties.imageToLedMappingType.enum;
var duration = 0;
var rgb = {r:255,g:0,b:0};
@@ -14,7 +14,7 @@ $(document).ready(function() {
//create introduction
if(showOptHelp)
if(window.showOptHelp)
{
createHint("intro", $.i18n('remote_color_intro', $.i18n('remote_losthint')), "color_intro");
createHint("intro", $.i18n('remote_input_intro', $.i18n('remote_losthint')), "sstcont");
@@ -25,16 +25,16 @@ $(document).ready(function() {
}
//color adjustment
var sColor = sortProperties(serverSchema.properties.color.properties.channelAdjustment.items.properties)
var values = serverInfo.adjustment[0]
var sColor = sortProperties(window.serverSchema.properties.color.properties.channelAdjustment.items.properties);
var values = window.serverInfo.adjustment[0];
for(key in sColor)
for(var key in sColor)
{
if(sColor[key].key != "id" && sColor[key].key != "leds")
{
var title = '<label for="cr_'+sColor[key].key+'">'+$.i18n(sColor[key].title)+'</label>';
var property;
var value = values[sColor[key].key]
var value = values[sColor[key].key];
if(sColor[key].type == "array")
{
@@ -71,11 +71,11 @@ $(document).ready(function() {
function sendEffect()
{
efx = $("#effect_select").val();
var efx = $("#effect_select").val();
if(efx != "__none__")
{
requestPriorityClear();
$(hyperion).one("cmd-clear", function(event) {
$(window.hyperion).one("cmd-clear", function(event) {
setTimeout(function() {requestPlayEffect(efx,duration)}, 100);
});
}
@@ -89,8 +89,7 @@ $(document).ready(function() {
function updateInputSelect()
{
$('.sstbody').html("");
var data = "";
var prios = serverInfo.priorities
var prios = window.serverInfo.priorities;
var i;
var clearAll = false;
@@ -172,9 +171,9 @@ $(document).ready(function() {
if(btn_type != 'default')
$('.sstbody').append(createTableRow([origin, owner, priority, btn], false, true));
}
var btn_auto_color = (serverInfo.priorities_autoselect? "btn-success" : "btn-danger");
var btn_auto_state = (serverInfo.priorities_autoselect? "disabled" : "enabled");
var btn_auto_text = (serverInfo.priorities_autoselect? $.i18n('general_btn_on') : $.i18n('general_btn_off'));
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'));
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>');
@@ -189,15 +188,15 @@ $(document).ready(function() {
function updateLedMapping()
{
mapping = serverInfo.imageToLedMappingType;
var mapping = window.serverInfo.imageToLedMappingType;
$('#mappingsbutton').html("");
for(var ix = 0; ix < mappingList.length; ix++)
{
if(mapping == mappingList[ix])
btn_style = 'btn-success';
var btn_style = 'btn-success';
else
btn_style = 'btn-primary';
var btn_style = 'btn-primary';
$('#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/>');
}
@@ -205,7 +204,7 @@ $(document).ready(function() {
function updateComponents()
{
components = comps;
var components = window.comps;
var hyperionEnabled = true;
components.forEach( function(obj) {
if (obj.name == "ALL")
@@ -216,21 +215,21 @@ $(document).ready(function() {
// create buttons
$('#componentsbutton').html("");
for ( idx=0; idx<components.length;idx++)
for (var idx=0; idx<components.length;idx++)
{
if(components[idx].name == "ALL")
continue
continue;
enable_style = (components[idx].enabled? "btn-success" : "btn-danger");
enable_icon = (components[idx].enabled? "fa-play" : "fa-stop");
comp_name = components[idx].name;
comp_btn_id = "comp_btn_"+comp_name;
comp_goff = hyperionEnabled? "enabled" : "disabled";
var enable_style = (components[idx].enabled? "btn-success" : "btn-danger");
var enable_icon = (components[idx].enabled? "fa-play" : "fa-stop");
var comp_name = components[idx].name;
var comp_btn_id = "comp_btn_"+comp_name;
var comp_goff = hyperionEnabled? "enabled" : "disabled";
// create btn if not there
if ($("#"+comp_btn_id).length == 0)
{
d='<span style="display:block;margin:3px"><button type="button" '+comp_goff+' id="'+comp_btn_id+'" class="btn '+enable_style
var d='<span style="display:block;margin:3px"><button type="button" '+comp_goff+' id="'+comp_btn_id+'" class="btn '+enable_style
+'" onclick="requestSetComponentState(\''+comp_name+'\','+(!components[idx].enabled)
+')"><i id="'+comp_btn_id+'_icon" class="fa '+enable_icon+'"></i></button> '+$.i18n('general_comp_'+components[idx].name)+'</span>';
$('#componentsbutton').append(d);
@@ -246,14 +245,14 @@ $(document).ready(function() {
function updateEffectlist()
{
var newEffects = serverInfo.effects;
var newEffects = window.serverInfo.effects;
if (newEffects.length != oldEffects.length)
{
$('#effect_select').html('<option value="__none__"></option>');
var usrEffArr = [];
var sysEffArr = [];
for(i = 0; i < newEffects.length; i++) {
for(var i = 0; i < newEffects.length; i++) {
var effectName = newEffects[i].name;
if(!/^\:/.test(newEffects[i].file)){
usrEffArr.push(effectName);
@@ -270,16 +269,16 @@ $(document).ready(function() {
function updateVideoMode()
{
videoModes = ["2D","3DSBS","3DTAB"];
currVideoMode = serverInfo.videomode;
var videoModes = ["2D","3DSBS","3DTAB"];
var currVideoMode = window.serverInfo.videomode;
$('#videomodebtns').html("");
for(var ix = 0; ix < videoModes.length; ix++)
{
if(currVideoMode == videoModes[ix])
btn_style = 'btn-success';
var btn_style = 'btn-success';
else
btn_style = 'btn-primary';
var 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/>');
}
}
@@ -339,25 +338,25 @@ $(document).ready(function() {
updateEffectlist();
// interval updates
$(hyperion).on("components-updated",updateComponents);
$(window.hyperion).on("components-updated",updateComponents);
$(hyperion).on("cmd-priorities-update", function(event){
serverInfo.priorities = event.response.data.priorities
serverInfo.priorities_autoselect = event.response.data.priorities_autoselect
$(window.hyperion).on("cmd-priorities-update", function(event){
window.serverInfo.priorities = event.response.data.priorities
window.serverInfo.priorities_autoselect = event.response.data.priorities_autoselect
updateInputSelect()
});
$(hyperion).on("cmd-imageToLedMapping-update", function(event){
serverInfo.imageToLedMappingType = event.response.data.imageToLedMappingType
$(window.hyperion).on("cmd-imageToLedMapping-update", function(event){
window.serverInfo.imageToLedMappingType = event.response.data.imageToLedMappingType
updateLedMapping()
});
$(hyperion).on("cmd-videomode-update", function(event){
serverInfo.videomode = event.response.data.videomode
$(window.hyperion).on("cmd-videomode-update", function(event){
window.serverInfo.videomode = event.response.data.videomode
updateVideoMode()
});
$(hyperion).on("cmd-effects-update", function(event){
serverInfo.effects = event.response.data.effects
$(window.hyperion).on("cmd-effects-update", function(event){
window.serverInfo.effects = event.response.data.effects
updateEffectlist();
});

View File

@@ -4,13 +4,13 @@
var conf_editor = null;
$('#conf_cont').append(createOptPanel('fa-wrench', $.i18n("edt_conf_webc_heading_title"), 'editor_container', 'btn_submit'));
if(showOptHelp)
if(window.showOptHelp)
{
$('#conf_cont').append(createHelpTable(schema.webConfig.properties, $.i18n("edt_conf_webc_heading_title")));
$('#conf_cont').append(createHelpTable(window.schema.webConfig.properties, $.i18n("edt_conf_webc_heading_title")));
}
conf_editor = createJsonEditor('editor_container', {
webConfig : schema.webConfig
webConfig : window.schema.webConfig
}, true, true);
conf_editor.on('change',function() {
@@ -21,7 +21,7 @@
requestWriteConfig(conf_editor.getValue());
});
if(showOptHelp)
if(window.showOptHelp)
createHint("intro", $.i18n('conf_webconfig_label_intro'), "editor_container");
removeOverlay();

View File

@@ -1,44 +1,39 @@
// global vars
var webPrio = 1;
var webOrigin = "Web Configuration";
var showOptHelp;
var currentVersion;
var latestVersion;
var serverInfo = {};
var parsedUpdateJSON = {};
var serverSchema = {};
var serverConfig = {};
var schema;
var sysInfo = {};
var jsonPort = 19444;
var websocket = null;
var hyperion = {};
var wsTan = 1;
var ledStreamActive = false;
var imageStreamActive = false;
var loggingStreamActive = false;
var loggingHandlerInstalled = false;
var watchdog = 0;
var debugMessagesActive = true;
var wSess = [];
var plugins_installed = {};
var plugins_available = {};
//comps serverinfo
comps = [];
// global vars (read and write in window object)
window.webPrio = 1;
window.webOrigin = "Web Configuration";
window.showOptHelp = true;
window.currentVersion = null;
window.latestVersion = null;
window.serverInfo = {};
window.parsedUpdateJSON = {};
window.serverSchema = {};
window.serverConfig = {};
window.schema = {};
window.sysInfo = {};
window.jsonPort = 19444;
window.websocket = null;
window.hyperion = {};
window.wsTan = 1;
window.ledStreamActive = false;
window.imageStreamActive = false;
window.loggingStreamActive = false;
window.loggingHandlerInstalled = false;
window.watchdog = 0;
window.debugMessagesActive = true;
window.wSess = [];
window.comps = [];
function initRestart()
{
$(hyperion).off();
$(window.hyperion).off();
requestServerConfigReload();
watchdog = 10;
window.watchdog = 10;
connectionLostDetection('restart');
}
function connectionLostDetection(type)
{
if ( watchdog > 2 )
if ( window.watchdog > 2 )
{
var interval_id = window.setInterval("", 9999); // Get a reference to the last
for (var i = 1; i < interval_id; i++)
@@ -57,7 +52,7 @@ function connectionLostDetection(type)
}
else
{
$.get( "/cgi/cfg_jsonserver", function() {watchdog=0}).fail(function() {watchdog++;});
$.get( "/cgi/cfg_jsonserver", function() {window.watchdog=0}).fail(function() {window.watchdog++;});
}
}
@@ -69,20 +64,20 @@ function initWebSocket()
{
if ("WebSocket" in window)
{
if (websocket == null)
if (window.websocket == null)
{
jsonPort = (document.location.port == '') ? '80' : document.location.port;
websocket = new WebSocket('ws://'+document.location.hostname+":"+jsonPort);
window.jsonPort = (document.location.port == '') ? '80' : document.location.port;
window.websocket = new WebSocket('ws://'+document.location.hostname+":"+window.jsonPort);
websocket.onopen = function (event) {
$(hyperion).trigger({type:"open"});
window.websocket.onopen = function (event) {
$(window.hyperion).trigger({type:"open"});
$(hyperion).on("cmd-serverinfo", function(event) {
watchdog = 0;
$(window.hyperion).on("cmd-serverinfo", function(event) {
window.watchdog = 0;
});
};
websocket.onclose = function (event) {
window.websocket.onclose = function (event) {
// See http://tools.ietf.org/html/rfc6455#section-7.4.1
var reason;
switch(event.code)
@@ -102,45 +97,44 @@ function initWebSocket()
case 1015: reason = "The connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)."; break;
default: reason = "Unknown reason";
}
console.log("[websocket::onclose] "+reason)
$(hyperion).trigger({type:"close", reason:reason});
watchdog = 10;
$(window.hyperion).trigger({type:"close", reason:reason});
window.watchdog = 10;
connectionLostDetection();
};
websocket.onmessage = function (event) {
window.websocket.onmessage = function (event) {
try
{
response = JSON.parse(event.data);
success = response.success;
cmd = response.command;
var response = JSON.parse(event.data);
var success = response.success;
var cmd = response.command;
if (success || typeof(success) == "undefined")
{
$(hyperion).trigger({type:"cmd-"+cmd, response:response});
$(window.hyperion).trigger({type:"cmd-"+cmd, response:response});
}
else
{
error = response.hasOwnProperty("error")? response.error : "unknown";
$(hyperion).trigger({type:"error",reason:error});
console.log("[websocket::onmessage] "+error)
var error = response.hasOwnProperty("error")? response.error : "unknown";
$(window.hyperion).trigger({type:"error",reason:error});
console.log("[window.websocket::onmessage] "+error)
}
}
catch(exception_error)
{
$(hyperion).trigger({type:"error",reason:exception_error});
console.log("[websocket::onmessage] "+exception_error)
$(window.hyperion).trigger({type:"error",reason:exception_error});
console.log("[window.websocket::onmessage] "+exception_error)
}
};
websocket.onerror = function (error) {
$(hyperion).trigger({type:"error",reason:error});
console.log("[websocket::onerror] "+error)
window.websocket.onerror = function (error) {
$(window.hyperion).trigger({type:"error",reason:error});
console.log("[window.websocket::onerror] "+error)
};
}
}
else
{
$(hyperion).trigger("error");
$(window.hyperion).trigger("error");
alert("Websocket is not supported by your browser");
return;
}
@@ -158,7 +152,7 @@ function sendToHyperion(command, subcommand, msg)
else
msg = "";
websocket.send(encode_utf8('{"command":"'+command+'", "tan":'+wsTan+subcommand+msg+'}'));
window.websocket.send(encode_utf8('{"command":"'+command+'", "tan":'+window.wsTan+subcommand+msg+'}'));
}
// -----------------------------------------------------------
@@ -192,32 +186,32 @@ function requestServerConfigReload()
function requestLedColorsStart()
{
ledStreamActive=true;
window.ledStreamActive=true;
sendToHyperion("ledcolors", "ledstream-start");
}
function requestLedColorsStop()
{
ledStreamActive=false;
window.ledStreamActive=false;
sendToHyperion("ledcolors", "ledstream-stop");
}
function requestLedImageStart()
{
imageStreamActive=true;
window.imageStreamActive=true;
sendToHyperion("ledcolors", "imagestream-start");
}
function requestLedImageStop()
{
imageStreamActive=false;
window.imageStreamActive=false;
sendToHyperion("ledcolors", "imagestream-stop");
}
function requestPriorityClear(prio)
{
if(typeof prio !== 'number')
prio = webPrio;
prio = window.webPrio;
sendToHyperion("clear", "", '"priority":'+prio+'');
}
@@ -229,22 +223,22 @@ function requestClearAll()
function requestPlayEffect(effectName, duration)
{
sendToHyperion("effect", "", '"effect":{"name":"'+effectName+'"},"priority":'+webPrio+',"duration":'+validateDuration(duration)+',"origin":"'+webOrigin+'"');
sendToHyperion("effect", "", '"effect":{"name":"'+effectName+'"},"priority":'+window.webPrio+',"duration":'+validateDuration(duration)+',"origin":"'+window.webOrigin+'"');
}
function requestSetColor(r,g,b,duration)
{
sendToHyperion("color", "", '"color":['+r+','+g+','+b+'], "priority":'+webPrio+',"duration":'+validateDuration(duration)+',"origin":"'+webOrigin+'"');
sendToHyperion("color", "", '"color":['+r+','+g+','+b+'], "priority":'+window.webPrio+',"duration":'+validateDuration(duration)+',"origin":"'+window.webOrigin+'"');
}
function requestSetImage(data,width,height,duration)
{
sendToHyperion("image", "", '"imagedata":"'+data+'", "imagewidth":'+width+',"imageheight":'+height+', "priority":'+webPrio+',"duration":'+validateDuration(duration)+'');
sendToHyperion("image", "", '"imagedata":"'+data+'", "imagewidth":'+width+',"imageheight":'+height+', "priority":'+window.webPrio+',"duration":'+validateDuration(duration)+'');
}
function requestSetComponentState(comp, state)
{
state_str = state ? "true" : "false";
var state_str = state ? "true" : "false";
sendToHyperion("componentstate", "", '"componentstate":{"component":"'+comp+'","state":'+state_str+'}');
}
@@ -259,15 +253,15 @@ function requestSetSource(prio)
function requestWriteConfig(config, full)
{
if(full === true)
serverConfig = config;
window.serverConfig = config;
else
{
jQuery.each(config, function(i, val) {
serverConfig[i] = val;
window.serverConfig[i] = val;
});
}
sendToHyperion("config","setconfig", '"config":'+JSON.stringify(serverConfig));
sendToHyperion("config","setconfig", '"config":'+JSON.stringify(window.serverConfig));
}
function requestWriteEffect(effectName,effectPy,effectArgs,data)
@@ -278,7 +272,7 @@ function requestWriteEffect(effectName,effectPy,effectArgs,data)
function requestTestEffect(effectName,effectPy,effectArgs,data)
{
sendToHyperion("effect", "", '"effect":{"name":"'+effectName+'", "args":'+effectArgs+'}, "priority":'+webPrio+', "origin":"'+webOrigin+'", "pythonScript":"'+effectPy+'", "imageData":"'+data+'"');
sendToHyperion("effect", "", '"effect":{"name":"'+effectName+'", "args":'+effectArgs+'}, "priority":'+window.webPrio+', "origin":"'+window.webOrigin+'", "pythonScript":"'+effectPy+'", "imageData":"'+data+'"');
}
function requestDeleteEffect(effectName)
@@ -288,13 +282,13 @@ function requestDeleteEffect(effectName)
function requestLoggingStart()
{
loggingStreamActive=true;
window.loggingStreamActive=true;
sendToHyperion("logging", "start");
}
function requestLoggingStop()
{
loggingStreamActive=false;
window.loggingStreamActive=false;
sendToHyperion("logging", "stop");
}

View File

@@ -43,14 +43,7 @@ $(document).ready(function() {
* @return {Path2D} The final path
*/
function build2DPath(x, y, width, height, radius) {
var useColor = false
if (typeof stroke == 'undefined') {
stroke = true;
}
if (typeof radius === 'undefined') {
radius = 5;
}
if (typeof radius === 'number') {
if (typeof radius == 'number') {
radius = {tl: radius, tr: radius, br: radius, bl: radius};
} else {
var defaultRadius = {tl: 0, tr: 0, br: 0, bl: 0};
@@ -59,7 +52,7 @@ $(document).ready(function() {
}
}
var path = new Path2D()
var path = new Path2D();
path.moveTo(x + radius.tl, y);
path.lineTo(x + width - radius.tr, y);
@@ -74,10 +67,10 @@ $(document).ready(function() {
return path;
}
$(hyperion).one("ready",function(){
leds = serverConfig.leds;
$(window.hyperion).one("ready",function(){
leds = window.serverConfig.leds;
if(showOptHelp)
if(window.showOptHelp)
{
createHint('intro', $.i18n('main_ledsim_text'), 'ledsim_text');
$('#ledsim_text').css({'margin':'10px 15px 0px 15px'});
@@ -125,7 +118,7 @@ $(document).ready(function() {
}
});
// apply new serverinfos
$(hyperion).on("cmd-config-getconfig",function(event){
$(window.hyperion).on("cmd-config-getconfig",function(event){
leds = event.response.info.leds;
updateLedLayout();
});
@@ -135,7 +128,7 @@ $(document).ready(function() {
{
// toggle leds, do not print
if(toggleLeds)
return
return;
var useColor = false;
ledsCanvasNodeCtx.clear();
@@ -169,7 +162,7 @@ $(document).ready(function() {
canvas_width = $('#ledsim_dialog').outerWidth()-30;
$('#leds_canvas').html("");
leds_html = '<canvas id="image_preview_canv" width="'+canvas_width+'" height="'+canvas_height+'" style="position: absolute; left: 0; top: 0; z-index: 99998;"></canvas>';
var leds_html = '<canvas id="image_preview_canv" width="'+canvas_width+'" height="'+canvas_height+'" style="position: absolute; left: 0; top: 0; z-index: 99998;"></canvas>';
leds_html += '<canvas id="leds_preview_canv" width="'+canvas_width+'" height="'+canvas_height+'" style="position: absolute; left: 0; top: 0; z-index: 99999;"></canvas>';
$('#leds_canvas').html(leds_html);
@@ -178,7 +171,7 @@ $(document).ready(function() {
ledsCanvasNodeCtx = document.getElementById("leds_preview_canv").getContext("2d");
create2dPaths();
printLedsToCanvas();
resetImage()
resetImage();
}
// ------------------------------------------------------------------
@@ -196,8 +189,8 @@ $(document).ready(function() {
// ------------------------------------------------------------------
$('#leds_toggle_live_video').off().on("click", function() {
setClassByBool('#leds_toggle_live_video',imageStreamActive,"btn-success","btn-danger");
if ( imageStreamActive )
setClassByBool('#leds_toggle_live_video',window.imageStreamActive,"btn-success","btn-danger");
if ( window.imageStreamActive )
{
requestLedImageStop();
resetImage();
@@ -209,7 +202,7 @@ $(document).ready(function() {
});
// ------------------------------------------------------------------
$(hyperion).on("cmd-ledcolors-ledstream-update",function(event){
$(window.hyperion).on("cmd-ledcolors-ledstream-update",function(event){
if (!modalOpened)
{
requestLedColorsStop();
@@ -221,14 +214,14 @@ $(document).ready(function() {
});
// ------------------------------------------------------------------
$(hyperion).on("cmd-ledcolors-imagestream-update",function(event){
$(window.hyperion).on("cmd-ledcolors-imagestream-update",function(event){
if (!modalOpened)
{
requestLedImageStop();
}
else
{
imageData = (event.response.result.image);
var imageData = (event.response.result.image);
var image = new Image();
image.onload = function() {
@@ -243,12 +236,12 @@ $(document).ready(function() {
});
// ------------------------------------------------------------------
$(hyperion).on("cmd-settings-update",function(event){
$(window.hyperion).on("cmd-settings-update",function(event){
var obj = event.response.data
Object.getOwnPropertyNames(obj).forEach(function(val, idx, array) {
serverInfo[val] = obj[val];
window.serverInfo[val] = obj[val];
});
leds = serverConfig.leds
leds = window.serverConfig.leds
updateLedLayout();
});

View File

@@ -1,4 +1,4 @@
var storedAccess;
var storedAccess;
var storedLang;
var availLang = ['en','de','es','it','cs'];
var availAccess = ['default','advanced','expert'];
@@ -30,7 +30,7 @@ $(document).ready( function() {
storedLang = getStorage("langcode");
if (storedLang == null)
{
setStorage("langcode", 'auto')
setStorage("langcode", 'auto');
storedLang = 'auto';
initTrans(storedLang);
}
@@ -119,14 +119,14 @@ $(document).ready( function() {
// instance switcher
$('#btn_instanceswitch').off().on('click',function() {
var lsys = sysInfo.system.hostName+':'+serverConfig.webConfig.port;
var lsys = window.sysInfo.system.hostName+':'+window.serverConfig.webConfig.port;
showInfoDialog('iswitch', $.i18n('InfoDialog_iswitch_title'), $.i18n('InfoDialog_iswitch_text'));
for (var i = 0; i<wSess.length; i++)
for (var i = 0; i<window.wSess.length; i++)
{
if(lsys != wSess[i].host+':'+wSess[i].port)
$('#id_select').append(createSelOpt('http://'+wSess[i].address+':'+wSess[i].port, wSess[i].name))
if(lsys != window.wSess[i].host+':'+window.wSess[i].port)
$('#id_select').append(createSelOpt('http://'+window.wSess[i].address+':'+window.wSess[i].port, window.wSess[i].name))
}
$('#id_btn_saveset').off().on('click',function() {

View File

@@ -42,7 +42,7 @@ function setStorage(item, value, session)
function debugMessage(msg)
{
if (debugMessagesActive)
if (window.debugMessagesActive)
{
console.log(msg);
}
@@ -50,19 +50,19 @@ function debugMessage(msg)
function updateSessions()
{
var sess = serverInfo.sessions;
var sess = window.serverInfo.sessions;
if (sess.length)
{
wSess = [];
window.wSess = [];
for(var i = 0; i<sess.length; i++)
{
if(sess[i].type == "_hyperiond-http._tcp.")
{
wSess.push(sess[i]);
window.wSess.push(sess[i]);
}
}
if (wSess.length > 1)
if (window.wSess.length > 1)
$('#btn_instanceswitch').toggle(true);
else
$('#btn_instanceswitch').toggle(false);
@@ -72,7 +72,7 @@ function updateSessions()
function validateDuration(d)
{
if(typeof d === "undefined" || d < 0)
return d = 0;
return 0;
else
return d *= 1000;
}
@@ -110,8 +110,10 @@ function loadContent(event, forceRefresh)
$("#page-content").off();
$("#page-content").load("/content/"+tag+".html", function(response,status,xhr){
if(status == "error")
{
$("#page-content").html('<h3>'+$.i18n('info_404')+'</h3>');
removeOverlay();
}
});
}
}
@@ -212,7 +214,8 @@ function showInfoDialog(type,header,message)
function createHintH(type, text, container)
{
if(type = "intro")
type = String(type);
if(type == "intro")
tclass = "introd";
$('#'+container).prepend('<div class="'+tclass+'"><h4 style="font-size:16px">'+text+'</h4><hr/></div>');
@@ -349,7 +352,7 @@ function createJsonEditor(container,schema,setconfig,usePanel,arrayre)
{
for(var key in editor.root.editors)
{
editor.getEditor("root."+key).setValue( serverConfig[key] );
editor.getEditor("root."+key).setValue( window.serverConfig[key] );
}
}
@@ -476,8 +479,8 @@ function createCP(id, color, cb)
}
});
$('#'+id).colorpicker().on('changeColor', function(e) {
rgb = e.color.toRGB();
hex = e.color.toHex();
var rgb = e.color.toRGB();
var hex = e.color.toHex();
cb(rgb,hex,e);
});
}
@@ -549,7 +552,7 @@ function createRow(id)
function createOptPanel(phicon, phead, bodyid, footerid)
{
phead = '<i class="fa '+phicon+' fa-fw"></i>'+phead;
pfooter = document.createElement('button');
var pfooter = document.createElement('button');
pfooter.className = "btn btn-primary";
pfooter.setAttribute("id", footerid);
pfooter.innerHTML = '<i class="fa fa-fw fa-save"></i>'+$.i18n('general_button_savesettings');
@@ -559,7 +562,7 @@ function createOptPanel(phicon, phead, bodyid, footerid)
function sortProperties(list)
{
for(key in list)
for(var key in list)
{
list[key].key = key;
}
@@ -583,7 +586,7 @@ function createHelpTable(list, phead){
thead.appendChild(createTableRow([$.i18n('conf_helptable_option'), $.i18n('conf_helptable_expl')], true, false));
for (key in list)
for (var key in list)
{
if(list[key].access != 'system')
{
@@ -596,7 +599,7 @@ function createHelpTable(list, phead){
if(list[key].items && list[key].items.properties)
{
var ilist = sortProperties(list[key].items.properties);
for (ikey in ilist)
for (var ikey in ilist)
{
// break one iteration (in the loop), if the schema has the entry hidden=true
if ("options" in ilist[ikey] && "hidden" in ilist[ikey].options && (ilist[ikey].options.hidden))
@@ -635,7 +638,7 @@ function createPanel(head, body, footer, type, bodyid){
if(typeof bodyid != 'undefined')
{
pfooter.style.textAlign = 'right';
pbody.setAttribute("id", bodyid)
pbody.setAttribute("id", bodyid);
}
if(typeof body != 'undefined' && body != "")

View File

@@ -1,11 +1,11 @@
//clear priority and other tasks if people reload the page or lost connection while a wizard was active
$(hyperion).one("ready", function(event) {
$(window.hyperion).one("ready", function(event) {
if(getStorage("wizardactive") === 'true')
{
requestPriorityClear();
setStorage("wizardactive", false);
if(getStorage("kodiAddress" != null))
if(getStorage("kodiAddress") != null)
{
kodiAddress = getStorage("kodiAddress");
sendToKodi("stop");
@@ -58,7 +58,7 @@
$('#wizp2_body').append('<div class="form-group"><label>'+$.i18n('wiz_rgb_switchevery')+'</label><div class="input-group" style="width:100px"><select id="wiz_switchtime_select" class="form-control"></select><div class="input-group-addon">'+$.i18n('edt_append_s')+'</div></div></div>');
$('#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_save')+'</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>')
$('#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_save')+'</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({
@@ -84,7 +84,7 @@
});
$('.wselect').change(function () {
var rgb_order = serverConfig.device.colorOrder.split("");
var rgb_order = window.serverConfig.device.colorOrder.split("");
var redS = $("#wiz_r_select").val();
var greenS = $("#wiz_g_select").val();
var blueS = rgb_order.toString().replace(/,/g,"").replace(redS, "").replace(greenS,"");
@@ -127,7 +127,7 @@
$('#btn_wiz_save').toggle(true);
$('#btn_wiz_checkok').toggle(false);
}
new_rgb_order = rgb_order
new_rgb_order = rgb_order;
}
else
$('#btn_wiz_save').attr('disabled',true);
@@ -153,8 +153,8 @@
$('#btn_wiz_save').off().on('click',function() {
resetWizard();
serverConfig.device.colorOrder = new_rgb_order;
requestWriteConfig({"device" : serverConfig.device});
window.serverConfig.device.colorOrder = new_rgb_order;
requestWriteConfig({"device" : window.serverConfig.device});
});
}
@@ -232,10 +232,10 @@
{
$('#wiz_cc_desc').html($.i18n('wiz_cc_chooseid'));
updateWEditor(["id"]);
$('#btn_wiz_back').attr("disabled", true)
$('#btn_wiz_back').attr("disabled", true);
}
else
$('#btn_wiz_back').attr("disabled", false)
$('#btn_wiz_back').attr("disabled", false);
if(step == 2)
{
@@ -415,7 +415,7 @@
$('#wizp1_body').html('<h4 style="font-weight:bold;text-transform:uppercase;">'+$.i18n('wiz_cc_title')+'</h4><p>'+$.i18n('wiz_cc_intro1')+'</p><label>'+$.i18n('wiz_cc_kwebs')+'</label><input class="form-control" style="width:170px;margin:auto" id="wiz_cc_kodiip" type="text" placeholder="'+kodiAddress+'" value="'+kodiAddress+'" /><span id="kodi_status"></span><span id="multi_cali"></span>');
$('#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_save')+'</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>')
$('#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_save')+'</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({
@@ -450,10 +450,10 @@
$('#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;
$('#wiz_cc_kodiip').trigger("change");
colorLength = window.serverConfig.color.channelAdjustment;
cobj = window.schema.color.properties.channelAdjustment.items.properties;
websAddress = document.location.hostname+':'+window.serverConfig.webConfig.port;
imgAddress = 'http://'+websAddress+'/img/cc/';
setStorage("wizardactive", true);
@@ -471,7 +471,7 @@
//prepare editor
wiz_editor = createJsonEditor('editor_container_wiz', {
color : schema.color
color : window.schema.color
}, true, true);
$('#editor_container_wiz h4').toggle(false);
@@ -716,7 +716,7 @@
//create hue led config
var incC = 0;
for(key in lightIDs)
for(var key in lightIDs)
{
if($('#hue_'+key).val() != "disabled")
{
@@ -726,10 +726,10 @@
}
}
serverConfig.leds = hueLedConfig;
window.serverConfig.leds = hueLedConfig;
//Adjust gamma, brightness and compensation
var c = serverConfig.color.channelAdjustment[0];
var c = window.serverConfig.color.channelAdjustment[0];
c.gammaBlue = 1.0;
c.gammaRed = 1.0;
c.gammaGreen = 1.0;
@@ -737,7 +737,7 @@
c.brightnessCompensation = 0;
//device config
var d = serverConfig.device;
var d = window.serverConfig.device;
d.output = $('#ip').val();
d.lightIds = finalLightIds;
d.username = $('#user').val();
@@ -746,9 +746,9 @@
d.switchOffOnBlack = true;
//smoothing off
serverConfig.smoothing.enable = false;
window.serverConfig.smoothing.enable = false;
requestWriteConfig(serverConfig, true);
requestWriteConfig(window.serverConfig, true);
resetWizard();
});
@@ -822,7 +822,7 @@
$('.hue_sel_watch').bind("change", function(){
var cC = 0;
for(key in lightIDs)
for(var key in lightIDs)
{
if($('#hue_'+key).val() != "disabled")
{