Handle "Show Explainations scenario" correctly

This commit is contained in:
Lord-Grey 2021-05-05 13:31:31 +02:00
parent 184cfb1e72
commit 7a31ef559f
3 changed files with 170 additions and 175 deletions

View File

@ -6,8 +6,7 @@ $(document).ready( function() {
var conf_editor = null;
$('#conf_cont').append(createOptPanel('fa-wrench', $.i18n("edt_conf_gen_heading_title"), 'editor_container', 'btn_submit', 'panel-system'));
if(window.showOptHelp)
{
if (window.showOptHelp) {
$('#conf_cont').append(createHelpTable(window.schema.general.properties, $.i18n("edt_conf_gen_heading_title")));
}
else
@ -22,12 +21,12 @@ $(document).ready( function() {
});
$('#btn_submit').off().on('click', function () {
window.showOptHelp = conf_editor.getEditor("root.general.showOptHelp").getValue();
requestWriteConfig(conf_editor.getValue());
});
// Instance handling
function handleInstanceRename(e)
{
function handleInstanceRename(e) {
conf_editor.on('change', function () {
window.readOnlyMode ? $('#btn_cl_save').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
@ -46,8 +45,7 @@ $(document).ready( function() {
});
}
function handleInstanceDelete(e)
{
function handleInstanceDelete(e) {
var inst = e.currentTarget.id.split("_")[1];
showInfoDialog('delInst', $.i18n('conf_general_inst_delreq_h'), $.i18n('conf_general_inst_delreq_t', getInstanceNameByIndex(inst)));
$("#id_btn_yes").off().on('click', function () {
@ -55,18 +53,15 @@ $(document).ready( function() {
});
}
function buildInstanceList()
{
function buildInstanceList() {
var inst = serverInfo.instance
$('.itbody').html("");
for(var key in inst)
{
for (var key in inst) {
var enable_style = inst[key].running ? "checked" : "";
var renameBtn = '<button id="instren_' + inst[key].instance + '" type="button" class="btn btn-primary"><i class="mdi mdi-lead-pencil""></i></button>';
var startBtn = ""
var delBtn = "";
if(inst[key].instance > 0)
{
if (inst[key].instance > 0) {
delBtn = '<button id="instdel_' + inst[key].instance + '" type="button" class="btn btn-danger"><i class="mdi mdi-delete-forever""></i></button>';
startBtn = '<input id="inst_' + inst[key].instance + '"' + enable_style + ' type="checkbox" data-toggle="toggle" data-onstyle="success font-weight-bold" data-on="' + $.i18n('general_btn_on') + '" data-offstyle="default font-weight-bold" data-off="' + $.i18n('general_btn_off') + '">';
@ -109,40 +104,32 @@ $(document).ready( function() {
});
//import
function dis_imp_btn(state)
{
function dis_imp_btn(state) {
state || window.readOnlyMode ? $('#btn_import_conf').attr('disabled', true) : $('#btn_import_conf').attr('disabled', false);
}
function readFile(evt)
{
function readFile(evt) {
var f = evt.target.files[0];
if (f)
{
if (f) {
var r = new FileReader();
r.onload = function(e)
{
r.onload = function (e) {
var content = e.target.result.replace(/[^:]?\/\/.*/g, ''); //remove Comments
//check file is json
var check = isJsonString(content);
if(check.length != 0)
{
if (check.length != 0) {
showInfoDialog('error', "", $.i18n('infoDialog_import_jsonerror_text', f.name, JSON.stringify(check)));
dis_imp_btn(true);
}
else
{
else {
content = JSON.parse(content);
//check for hyperion json
if(typeof content.leds === 'undefined' || typeof content.general === 'undefined')
{
if (typeof content.leds === 'undefined' || typeof content.general === 'undefined') {
showInfoDialog('error', "", $.i18n('infoDialog_import_hyperror_text', f.name));
dis_imp_btn(true);
}
else
{
else {
dis_imp_btn(false);
importedConf = content;
confName = f.name;
@ -185,8 +172,7 @@ $(document).ready( function() {
});
//create introduction
if(window.showOptHelp)
{
if (window.showOptHelp) {
createHint("intro", $.i18n('conf_general_intro'), "editor_container");
createHint("intro", $.i18n('conf_general_tok_desc'), "tok_desc_cont");
createHint("intro", $.i18n('conf_general_inst_desc'), "inst_desc_cont");

View File

@ -13,21 +13,21 @@ $(document).ready(function () {
// Screen-Grabber
$('#conf_cont').append(createRow('conf_cont_screen'));
$('#conf_cont_screen').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_screengrabber', 'btn_submit_screengrabber', 'panel-system'));
$('#conf_cont_screen').append(createHelpTable(window.schema.framegrabber.properties, $.i18n("edt_conf_fg_heading_title")));
$('#conf_cont_screen').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_screengrabber', 'btn_submit_screengrabber', 'panel-system', 'screengrabberPanelId'));
$('#conf_cont_screen').append(createHelpTable(window.schema.framegrabber.properties, $.i18n("edt_conf_fg_heading_title"), "screengrabberHelpPanelId"));
// Video-Grabber - hide if not available
if (VIDEOGRABBER_AVAIL) {
$('#conf_cont').append(createRow('conf_cont_video'));
$('#conf_cont_video').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_videograbber', 'btn_submit_videograbber', 'panel-system'));
$('#conf_cont_video').append(createHelpTable(window.schema.grabberV4L2.properties, $.i18n("edt_conf_v4l2_heading_title")));
$('#conf_cont_video').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_videograbber', 'btn_submit_videograbber', 'panel-system', 'videograbberPanelId'));
$('#conf_cont_video').append(createHelpTable(window.schema.grabberV4L2.properties, $.i18n("edt_conf_v4l2_heading_title"), "videograbberHelpPanelId"));
}
} else {
$('#conf_cont').addClass('row');
$('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_instCapture_heading_title"), 'editor_container_instCapt', 'btn_submit_instCapt', 'panel-system'));
$('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_screengrabber', 'btn_submit_screengrabber', 'panel-system'));
$('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_screengrabber', 'btn_submit_screengrabber', 'panel-system', 'screengrabberPanelId'));
if (VIDEOGRABBER_AVAIL) {
$('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_videograbber', 'btn_submit_videograbber', 'panel-system'));
$('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_videograbber', 'btn_submit_videograbber', 'panel-system', 'videograbberPanelId'));
}
}
@ -46,9 +46,13 @@ $(document).ready(function () {
var screenEnable = conf_editor_instCapt.getEditor("root.instCapture.systemEnable").getValue();
if (screenEnable) {
showInputOptions("instCapture", ["systemPriority"], true);
$('#conf_cont_screen').show();
$('#screengrabberPanelId').show();
if (window.showOptHelp) {
$('#screengrabberHelpPanelId').show();
}
} else {
$('#conf_cont_screen').hide();
$('#screengrabberPanelId').hide();
$('#screengrabberHelpPanelId').hide();
showInputOptions("instCapture", ["systemPriority"], false);
}
@ -56,11 +60,15 @@ $(document).ready(function () {
var videoEnable = conf_editor_instCapt.getEditor("root.instCapture.v4lEnable").getValue();
if (videoEnable) {
showInputOptions("instCapture", ["v4lPriority"], true);
$('#conf_cont_video').show();
$('#videograbberPanelId').show();
if (window.showOptHelp) {
$('#videograbberHelpPanelId').show();
}
}
else {
showInputOptions("instCapture", ["v4lPriority"], false);
$('#conf_cont_video').hide();
$('#videograbberPanelId').hide();
$('#videograbberHelpPanelId').hide();
}
}

View File

@ -809,14 +809,15 @@ function createRow(id) {
return el;
}
function createOptPanel(phicon, phead, bodyid, footerid, css) {
function createOptPanel(phicon, phead, bodyid, footerid, css, panelId) {
phead = '<i class="fa ' + phicon + ' fa-fw"></i>' + phead;
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');
return createPanel(phead, "", pfooter, "panel-default", bodyid, css);
return createPanel(phead, "", pfooter, "panel-default", bodyid, css, panelId);
}
function compareTwoValues(key1, key2, order = 'asc') {