diff --git a/src/www/javascript/opnsense_legacy.js b/src/www/javascript/opnsense_legacy.js index bcc1d800d..c97168755 100644 --- a/src/www/javascript/opnsense_legacy.js +++ b/src/www/javascript/opnsense_legacy.js @@ -70,32 +70,35 @@ function hook_stacked_form_tables(match) row_number = 0; // traverse all tags root_node.find('tr').each(function(){ - var children = $(this).children(); - // copy zebra color on striped table - if (root_node.hasClass('table-striped')) { - if ( $(this).children(0).css("background-color") != 'transparent') { - root_node.data('stripe-color', $(this).children(0).css("background-color")); + // only evaluate children under this table or in element + if (root_node.is($(this).parent()) || root_node.is($(this).parent().parent())) { + var children = $(this).children(); + // copy zebra color on striped table + if (root_node.hasClass('table-striped')) { + if ( $(this).children(0).css("background-color") != 'transparent') { + root_node.data('stripe-color', $(this).children(0).css("background-color")); + } } - } - if (children.length == 1) { - // simple seperator line, colspan = 2 - $(this).before($(this).clone().attr('colspan', 1).addClass('hidden-sm hidden-md hidden-lg')); - $(this).addClass('hidden-xs'); - } else if (children.length == 2) { - // form input row, create new for mobile header containing first content - var mobile_header = $("").addClass('hidden-sm hidden-md hidden-lg'); - mobile_header.append($('').append(children.first().clone(true, true))); - // hide "all help" on mobile - if (row_number == 0 && $(this).find('td:eq(1) > i').length == 1) { + if (children.length == 1) { + // simple seperator line, colspan = 2 + $(this).before($(this).clone().attr('colspan', 1).addClass('hidden-sm hidden-md hidden-lg')); $(this).addClass('hidden-xs'); - } else { - // annotate mobile header with a classname - mobile_header.addClass('opnsense-table-mobile-header'); + } else if (children.length == 2) { + // form input row, create new for mobile header containing first content + var mobile_header = $("").addClass('hidden-sm hidden-md hidden-lg'); + mobile_header.append($('').append(children.first().clone(true, true))); + // hide "all help" on mobile + if (row_number == 0 && $(this).find('td:eq(1) > i').length == 1) { + $(this).addClass('hidden-xs'); + } else { + // annotate mobile header with a classname + mobile_header.addClass('opnsense-table-mobile-header'); + } + $(this).before(mobile_header); + children.first().addClass('hidden-xs'); } - $(this).before(mobile_header); - children.first().addClass('hidden-xs'); + row_number++; } - row_number++; }); // hook in re-apply zebra when table-striped was selected.. (on window resize and initial load) if (root_node.data('stripe-color') != undefined) {