2016-09-07 20:10:37 +02:00
|
|
|
/*
|
|
|
|
function removeAdvanced(obj,searchStack)
|
|
|
|
{
|
|
|
|
searchStack = [];
|
|
|
|
$.each(obj, function(key, val) {
|
|
|
|
if ( typeof(val) == 'object' )
|
|
|
|
{
|
|
|
|
searchStack.push(key);
|
|
|
|
if (! removeAdvanced(val,searchStack) )
|
|
|
|
searchStack.pop();
|
|
|
|
}
|
|
|
|
else if ( key == "advanced" && val == true )
|
|
|
|
{
|
|
|
|
console.log(searchStack);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
$(hyperion).one("cmd-config-getschema", function(event) {
|
|
|
|
parsedConfSchemaJSON = event.response.result;
|
2016-09-09 18:59:58 +02:00
|
|
|
|
2016-09-07 20:10:37 +02:00
|
|
|
schema = parsedConfSchemaJSON.properties;
|
2016-09-10 23:30:05 +02:00
|
|
|
var element = document.getElementById('editor_container');
|
2016-09-09 10:15:35 +02:00
|
|
|
|
2016-09-07 20:10:37 +02:00
|
|
|
var general_conf_editor = new JSONEditor(element,{
|
|
|
|
theme: 'bootstrap3',
|
2016-09-10 23:30:05 +02:00
|
|
|
iconlib: "fontawesome4",
|
2016-09-07 20:10:37 +02:00
|
|
|
disable_collapse: 'true',
|
|
|
|
form_name_root: 'sa',
|
|
|
|
disable_edit_json: 'true',
|
|
|
|
disable_properties: 'true',
|
|
|
|
no_additional_properties: 'true',
|
|
|
|
schema: {
|
2016-09-10 23:30:05 +02:00
|
|
|
title:'',
|
2016-09-07 20:10:37 +02:00
|
|
|
properties: {
|
2016-09-21 22:01:50 +02:00
|
|
|
blackborderdetector: schema.blackborderdetector,
|
|
|
|
color : schema.color,
|
|
|
|
effects : schema.effects,
|
|
|
|
forwarder : schema.forwarder,
|
|
|
|
initialEffect : schema.initialEffect,
|
|
|
|
kodiVideoChecker : schema.kodiVideoChecker,
|
|
|
|
smoothing : schema.smoothing,
|
|
|
|
logger : schema.logger,
|
|
|
|
jsonServer : schema.jsonServer,
|
|
|
|
protoServer : schema.protoServer,
|
|
|
|
boblightServer : schema.boblightServer,
|
|
|
|
udpListener : schema.udpListener,
|
|
|
|
webConfig : schema.webConfig
|
2016-09-07 20:10:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-10 23:30:05 +02:00
|
|
|
// $('#editor_container .well').css("background-color","white");
|
|
|
|
// $('#editor_container .well').css("border","none");
|
|
|
|
// $('#editor_container .well').css("box-shadow","none");
|
|
|
|
$('#editor_container .btn').addClass("btn-primary");
|
|
|
|
$('#editor_container h3').first().remove();
|
|
|
|
|
2016-09-09 10:15:35 +02:00
|
|
|
//Called everytime a Input Field is changed = No need for save button
|
2016-09-15 20:42:58 +02:00
|
|
|
// general_conf_editor.off().on('change',function() {
|
|
|
|
// console.log(JSON.stringify(general_conf_editor.getValue()));
|
|
|
|
// requestWriteConfig(general_conf_editor.getValue());
|
|
|
|
// });
|
2016-09-07 20:10:37 +02:00
|
|
|
|
2016-09-09 10:15:35 +02:00
|
|
|
//Alternative Function with submit button to get Values
|
2016-09-21 22:01:50 +02:00
|
|
|
$('#btn_submit').off().on('click',function() {
|
2016-09-09 10:15:35 +02:00
|
|
|
console.log(general_conf_editor.getValue());
|
2016-09-07 20:10:37 +02:00
|
|
|
});
|
2016-09-09 10:15:35 +02:00
|
|
|
|
|
|
|
$(hyperion).on("cmd-config-setconfig",function(event){
|
|
|
|
parsedServerInfoJSON = event.response;
|
|
|
|
console.log(parsedServerInfoJSON);
|
|
|
|
});
|
|
|
|
|
2016-09-07 20:10:37 +02:00
|
|
|
});
|
|
|
|
|
2016-09-09 10:15:35 +02:00
|
|
|
$(document).ready( function() {
|
|
|
|
requestServerConfigSchema();
|
|
|
|
//$("[type='checkbox']").bootstrapSwitch();
|
|
|
|
});
|