From d9383e7db40a3d8cc9e61be12904e28bae6fd4fa Mon Sep 17 00:00:00 2001 From: dlandon Date: Sun, 8 Dec 2024 12:48:12 -0600 Subject: [PATCH] Readability improvement. --- .../dynamix/include/DefaultPageLayout.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/emhttp/plugins/dynamix/include/DefaultPageLayout.php b/emhttp/plugins/dynamix/include/DefaultPageLayout.php index a40d99ecc..304a0bdeb 100644 --- a/emhttp/plugins/dynamix/include/DefaultPageLayout.php +++ b/emhttp/plugins/dynamix/include/DefaultPageLayout.php @@ -586,17 +586,26 @@ function flashReport() { }); } $(function() { + let tab; - let tab = $.cookie('tab')||'tab1'; + tab = $.cookie('tab')||'tab1'; - let tab = $.cookie('one')||'tab1'; + tab = $.cookie('one')||'tab1'; - let tab = $.cookie('one')||'tab1'; + tab = $.cookie('one')||'tab1'; - if (tab=='tab0') tab = 'tab'+$('input[name$="tabs"]').length; else if ($('#'+tab).length==0) {initab(); tab = 'tab1';} + /* Check if the tab is 'tab0' */ + if (tab === 'tab0') { + /* Set tab to the last available tab based on input[name$="tabs"] length */ + tab = 'tab' + $('input[name$="tabs"]').length; + } else if ($('#' + tab).length === 0) { + /* If the tab element does not exist, initialize a tab and set to 'tab1' */ + initab(); + tab = 'tab1'; + } $('#'+tab).attr('checked', true); updateTime(); $.jGrowl.defaults.closeTemplate = '';