From 92801d6ddc507da1d340d73bf0419cf99e8153ac Mon Sep 17 00:00:00 2001 From: Jokob-sk Date: Tue, 5 Mar 2024 23:12:17 +1100 Subject: [PATCH] =?UTF-8?q?Menu=20updates=F0=9F=A7=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/js/pialert_common.js | 57 ++++++++--------- front/maintenance.php | 83 +++++++++++++------------ front/php/templates/header.php | 60 ++++++++++++++---- front/php/templates/language/en_us.json | 1 + 4 files changed, 122 insertions(+), 79 deletions(-) diff --git a/front/js/pialert_common.js b/front/js/pialert_common.js index 3181ef75..a41a658d 100755 --- a/front/js/pialert_common.js +++ b/front/js/pialert_common.js @@ -811,39 +811,40 @@ function updateApi() } // ----------------------------------------------------------------------------- - // handling smooth scrolling - // ----------------------------------------------------------------------------- - function setupSmoothScrolling() { - // Function to scroll to the element - function scrollToElement(id) { - $('html, body').animate({ - scrollTop: $("#" + id).offset().top - 50 - }, 500); - } +// handling smooth scrolling +// ----------------------------------------------------------------------------- +function setupSmoothScrolling() { + // Function to scroll to the element + function scrollToElement(id) { + $('html, body').animate({ + scrollTop: $("#" + id).offset().top - 50 + }, 1000); + } - // Scroll to the element when clicking on anchor links - $('a[href*="#"]').on('click', function(event) { - var href = $(this).attr('href'); - if (href && href.includes('#')) { - var id = href.substring(href.indexOf("#") + 1); // Get the ID from the href attribute - if ($("#" + id).length > 0) { - event.preventDefault(); // Prevent default anchor behavior - scrollToElement(id); // Scroll to the element - } - } - }); + // Scroll to the element when clicking on anchor links + $('a[href*="#"]').on('click', function(event) { + var href = $(this).attr('href'); + if (href && href.includes('#') && !$(this).is('[data-toggle="collapse"]')) { + var id = href.substring(href.indexOf("#") + 1); // Get the ID from the href attribute + if ($("#" + id).length > 0) { + event.preventDefault(); // Prevent default anchor behavior + scrollToElement(id); // Scroll to the element + } + } + }); - // Check if there's an ID in the URL and scroll to it - var url = window.location.href; - if (url.includes("#")) { - var idFromURL = url.substring(url.indexOf("#") + 1); - if ($("#" + idFromURL).length > 0) { - scrollToElement(idFromURL); - } - } + // Check if there's an ID in the URL and scroll to it + var url = window.location.href; + if (url.includes("#")) { + var idFromURL = url.substring(url.indexOf("#") + 1); + if ($("#" + idFromURL).length > 0) { + scrollToElement(idFromURL); + } + } } + // ----------------------------------------------------------------------------- // initialize // ----------------------------------------------------------------------------- diff --git a/front/maintenance.php b/front/maintenance.php index 9ea8bd32..15ae0b86 100755 --- a/front/maintenance.php +++ b/front/maintenance.php @@ -859,51 +859,56 @@ function initializeSelectedColumns () { // -------------------------------------------------------- function initializeTabs () { - key = "activeMaintenanceTab" + setTimeout(function() { - // default selection - selectedTab = "tab_Settings" + key = "activeMaintenanceTab" - // the #target from the url - target = window.location.hash.substr(1) + // default selection + selectedTab = "tab_Settings" - // get only the part between #...? - if(target.includes('?')) - { - target = target.split('?')[0] - } + // the #target from the url + target = window.location.hash.substr(1) - console.log(target) - - // update cookie if target specified - if(target != "") - { - setCache(key, target+'_id') // _id is added so it doesn't conflict with AdminLTE tab behavior - } - - // get the tab id from the cookie (already overriden by the target) - if(!emptyArr.includes(getCache(key))) - { - selectedTab = getCache(key); - } - - // Activate panel - $('.nav-tabs a[id='+ selectedTab +']').tab('show'); - - // When changed save new current tab - $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { - setCache(key, $(e.target).attr('id')) - }); - - // events on tab change - $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { - var target = $(e.target).attr("href") // activated tab - - if(target == "#tab_Logging") + // get only the part between #...? + if(target.includes('?')) { - scrollDown(); + target = target.split('?')[0] } - }); + + console.log(target) + + // update cookie if target specified + if(target != "") + { + setCache(key, target+'_id') // _id is added so it doesn't conflict with AdminLTE tab behavior + } + + // get the tab id from the cookie (already overriden by the target) + if(!emptyArr.includes(getCache(key))) + { + selectedTab = getCache(key); + } + + // Activate panel + $('.nav-tabs a[id='+ selectedTab +']').tab('show'); + + // When changed save new current tab + $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { + setCache(key, $(e.target).attr('id')) + }); + + // events on tab change + $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { + var target = $(e.target).attr("href") // activated tab + + if(target == "#tab_Logging") + { + scrollDown(); + } + }); + + }, 50); + } // -------------------------------------------------------- diff --git a/front/php/templates/header.php b/front/php/templates/header.php index d8aa7e96..ad5c2df5 100755 --- a/front/php/templates/header.php +++ b/front/php/templates/header.php @@ -243,11 +243,35 @@ if ($ENABLED_DARKMODE === True) { -
  • +
  • - + + + +
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • diff --git a/front/php/templates/language/en_us.json b/front/php/templates/language/en_us.json index 49acfb95..b18a393c 100755 --- a/front/php/templates/language/en_us.json +++ b/front/php/templates/language/en_us.json @@ -431,6 +431,7 @@ "Maintenance_version": "App updates", "NETWORK_DEVICE_TYPES_description": "Which device types are allowed to be used as network devices in the Network view. The device type has to match exactly the Type setting on a specific device in Device details. Do not remove existing types, only add new ones.", "NETWORK_DEVICE_TYPES_name": "Network device types", + "Navigation_About": "About", "Navigation_Devices": "Devices", "Navigation_Donations": "Donations", "Navigation_Events": "Events",