#11328 Fixed toggle

This commit is contained in:
Daniel Maya 2023-05-23 12:25:56 +02:00
parent dbf7d4dcfe
commit ef30f19b19
1 changed files with 29 additions and 28 deletions

View File

@ -4521,7 +4521,7 @@ function ui_toggle(
// Link to toggle.
$output = '<div class="'.$main_class.'" id="'.$id.'" '.$toggl_attr.'>';
$output .= '<div class="'.$header_class.'" '.(($disableToggle === true) ? 'style="cursor: pointer;" ' : '').' id="tgl_ctrl_'.$uniqid.'">';
$output .= '<div class="'.$header_class.'" '.(($disableToggle === false) ? 'style="cursor: pointer;" ' : '').' id="tgl_ctrl_'.$uniqid.'">';
if ($reverseImg === false) {
if ($switch === true) {
if (empty($switch_name) === true) {
@ -4610,8 +4610,8 @@ function ui_toggle(
$output .= ' var is_metaconsole = '.(int) is_metaconsole().";\n";
$output .= ' /* <![CDATA[ */'."\n";
$output .= " $(document).ready (function () {\n";
$output .= ' var switch_enable = '.(int) $switch.";\n";
$output .= " $('#checkbox-".$switch_name."').click(function() {\n";
$output .= ' if (is_metaconsole == 0) {';
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
$output .= " $('#tgl_div_".$uniqid."').css('height', 'auto');\n";
@ -4622,9 +4622,9 @@ function ui_toggle(
$output .= " $('#tgl_div_".$uniqid."').css('height', 0);\n";
$output .= " $('#tgl_div_".$uniqid."').css('position', 'absolute');\n";
$output .= " }\n";
$output .= " }\n";
$output .= " });\n";
$output .= " $('#checkbox-".$switch_name."').click(function() {\n";
$output .= ' if (switch_enable === 0) {';
$output .= " $('#tgl_ctrl_".$uniqid."').click(function() {\n";
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
$output .= " $('#tgl_div_".$uniqid."').css('height', 'auto');\n";
@ -4641,6 +4641,7 @@ function ui_toggle(
$output .= " $('#checkbox-".$switch_name."').prop('checked', false);\n";
$output .= " }\n";
$output .= " });\n";
$output .= " }\n";
$output .= " });\n";
$output .= '/* ]]> */';
$output .= '</script>';