mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
implement a function for easy json editor creation (#264)
* implement a function for easy json editor creation * grabber and kodi moved to new editor func * webui: implement conf editors * add missing files and remove debug code
This commit is contained in:
@@ -1,49 +1,19 @@
|
||||
|
||||
/*
|
||||
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;
|
||||
}
|
||||
*/
|
||||
|
||||
var grabber_conf_editor = null;
|
||||
var conf_editor = null;
|
||||
$(hyperion).one("cmd-config-getschema", function(event) {
|
||||
parsedConfSchemaJSON = event.response.result;
|
||||
schema = parsedConfSchemaJSON.properties;
|
||||
|
||||
var element = document.getElementById('editor_container');
|
||||
|
||||
grabber_conf_editor = new JSONEditor(element,{
|
||||
theme: 'bootstrap3',
|
||||
iconlib: "fontawesome4",
|
||||
disable_collapse: 'true',
|
||||
form_name_root: 'sa',
|
||||
disable_edit_json: 'true',
|
||||
disable_properties: 'true',
|
||||
no_additional_properties: 'true',
|
||||
schema: {
|
||||
conf_editor = createJsonEditor('editor_container',
|
||||
{
|
||||
title:'',
|
||||
properties: {
|
||||
framegrabber: schema.framegrabber,
|
||||
grabberV4L2 : schema["grabberV4L2"]
|
||||
grabberV4L2 : schema.grabberV4L2
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#editor_container .well').css("background-color","white");
|
||||
$('#editor_container .well').css("border","none");
|
||||
$('#editor_container .well').css("box-shadow","none");
|
||||
@@ -58,8 +28,7 @@ $(document).ready( function() {
|
||||
|
||||
document.getElementById('btn_submit').addEventListener('click',function() {
|
||||
// Get the value from the editor
|
||||
console.log(grabber_conf_editor.getValue());
|
||||
console.log(conf_editor.getValue());
|
||||
});
|
||||
// $("[type='checkbox']").bootstrapSwitch();
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user