1jQuery(window).on('load', function() { 2 3 // Function to remove "Menu" from the mobile menu and update the color once it is reloaded 4 function initializeMobileMenu() { 5 var mobileNav = jQuery('#genesis-mobile-nav-primary'); 6 mobileNav.text(''); // Removes the text from the button 7 mobileNav.css('color', '#333'); // Set color back to initial 8 } 9 10 // Function to adjust margin for mobile button navigation 11 function adjustMargin() { 12 var mobileNav = document.getElementById('genesis-mobile-nav-primary'); 13 var mainNav = document.getElementById('main_header_nav'); 14 var searchBtn = document.getElementById('searchModalBtn'); 15 var body = document.body; // Reference to the body element 16 17 // Only adjust the margin if body has the 'logged-in' class 18 if (body.classList.contains('logged-in') && mobileNav && mainNav && searchBtn) { 19 var widthDifference = mainNav.offsetWidth - searchBtn.offsetWidth - mobileNav.offsetWidth; 20 mobileNav.style.marginRight = widthDifference + 'px'; 21 } 22 } 23 24 // Function to set min-height on .site-inner when .sub-footer is not touching the bottom of the window 25 function adjustMinHeight() { 26 var siteInner = document.querySelector('.site-inner'); 27 var subFooter = document.querySelector('.sub-footer'); 28 var siteHeader = document.querySelector('.site-header'); 29 30 if (subFooter && siteInner && siteHeader) { 31 // Get the bottom position of the sub-footer 32 var subFooterBottom = subFooter.getBoundingClientRect().bottom; 33 // Get the height of the window 34 var windowHeight = window.innerHeight; 35 36 // Calculate the height of the site-inner including any padding 37 var siteInnerHeight = siteInner.offsetHeight; 38 var siteInnerStyle = getComputedStyle(siteInner); 39 var siteInnerPaddingTop = parseFloat(siteInnerStyle.paddingTop); 40 var siteInnerPaddingBottom = parseFloat(siteInnerStyle.paddingBottom); 41 42 // Get the height of the site-header 43 var siteHeaderHeight = siteHeader.offsetHeight; 44 45 // If the sub-footer is above the bottom of the window 46 if (subFooterBottom < windowHeight) { 47 // Calculate the required min-height for site-inner 48 var minHeight = windowHeight - siteInnerPaddingTop - siteInnerPaddingBottom - subFooter.offsetHeight - siteHeaderHeight; 49 50 // Ensure min-height is not less than the current height 51 siteInner.style.minHeight = Math.max(minHeight, siteInnerHeight) + 'px'; 52 } else { 53 // Reset min-height if the condition is not met 54 siteInner.style.minHeight = ''; 55 } 56 } 57 } 58 59 // Function for the search bar modal 60 function searchBarModal() { 61 // Get elements 62 const siteHeader = document.querySelector('.site-header'); 63 const searchModal = document.getElementById("searchModal"); 64 const searchModalContent = document.querySelector(".modal-content"); 65 const searchBtn = document.getElementById("searchModalBtn"); 66 const closeBtn = document.getElementsByClassName("close")[0]; 67 68 // Open the modal when the button is clicked 69 searchBtn.onclick = function() { 70 searchModal.style.display = "block"; 71 searchModalContent.style.marginTop = siteHeader.offsetHeight + 'px'; 72 } 73 74 // Close the modal when the 'x' is clicked 75 closeBtn.onclick = function() { 76 searchModal.style.display = "none"; 77 } 78 79 // Close the modal when clicking outside of the modal content 80 window.onclick = function(event) { 81 if (event.target == searchModal) { 82 searchModal.style.display = "none"; 83 } 84 } 85 } 86 87 function initSideScrollMenu() { 88 const scrollMenu = document.getElementById('menu-dashboard-menu'); 89 const scrollLeftBtn = document.getElementById('scroll-left'); 90 const scrollRightBtn = document.getElementById('scroll-right'); 91 92 // Only proceed if the elements exist 93 if (scrollMenu && scrollLeftBtn && scrollRightBtn) { 94 95 // Function to check and toggle the visibility of the scroll buttons 96 function checkScrollButtons() { 97 const scrollLeft = scrollMenu.scrollLeft; 98 const maxScrollLeft = scrollMenu.scrollWidth - scrollMenu.clientWidth; 99 100 // Add buffer of 1px to account for minor discrepancies 101 if (scrollLeft <= 1) { 102 scrollLeftBtn.classList.add('hidden'); 103 } else { 104 scrollLeftBtn.classList.remove('hidden'); 105 } 106 107 if (scrollLeft >= maxScrollLeft - 1) { 108 scrollRightBtn.classList.add('hidden'); 109 } else { 110 scrollRightBtn.classList.remove('hidden'); 111 } 112 } 113 114 // Scroll the menu to the left 115 scrollLeftBtn.addEventListener('click', () => { 116 scrollMenu.scrollBy({ left: -200, behavior: 'smooth' }); 117 }); 118 119 // Scroll the menu to the right 120 scrollRightBtn.addEventListener('click', () => { 121 scrollMenu.scrollBy({ left: 200, behavior: 'smooth' }); 122 }); 123 124 // Initial check for scroll button visibility 125 checkScrollButtons(); 126
127 // Check scroll position every time the menu is scrolled 128 scrollMenu.addEventListener('scroll', checkScrollButtons); 129 } 130 } 131 132 133 // Initialize the mobile menu 134 initializeMobileMenu(); 135 136 // Initialize the dashboard menu scroll 137 initSideScrollMenu(); 138 139 // Adjust the margin on page load 140 adjustMargin(); 141 142 // Adjust min-height on page load 143 adjustMinHeight(); 144 145 // Search bar modal on page load 146 searchBarModal(); 147 148 // Adjust the margin and min-height on window resize 149 window.addEventListener('resize', function() { 150 adjustMargin(); 151 adjustMinHeight(); 152 }); 153 154});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.