1'use strict' 2 3///////////////////////////////// 4//// NAVBAR HANDLER - navbar toggles mobile and desktop 5///////////////////////////////// 6const navbarHandler = { 7 // MOBILE MENU TOGGLE 8 mobileMenuToggle: function () { 9 let mobileSearchButton = document.querySelector('.navbar_mobilesearch'), 10 mobileSearchBox = document.querySelector('.navbar_mobile_search'), 11 mobileMenuButton = document.querySelector('.navbar_mobilemenu'), 12 mobileMenuBox = document.querySelector('.navbar_mobile_dropdown'), 13 buttonArray = [mobileSearchButton, mobileMenuButton], 14 boxArray = [mobileSearchBox, mobileMenuBox] 15 16 function boxToggle (button, box, _boxArray, _buttonArray) { 17 button.addEventListener('click', () => { 18 if (!button.classList.contains('active')){ 19 button.classList.add('active') 20 box.style.display = 'block' 21 22 _buttonArray.forEach( (c, i, a ) => { 23 if (c !== button) { 24 c.classList.remove('active') 25 } 26 }) 27 28 _boxArray.forEach((c, i, a ) => { 29 if (c !== box) { 30 c.style.display = '' 31 } 32 }) 33 } 34 else if (button.classList.contains('active')) { 35 button.classList.remove('active') 36 box.style.display = '' 37 } 38 }) 39 } 40 41 boxToggle(mobileSearchButton, mobileSearchBox, boxArray, buttonArray) 42 boxToggle(mobileMenuButton, mobileMenuBox, boxArray, buttonArray) 43 }, 44 45 // PROFILE SUBMENU TOGGLE 46 profileSubmenuToggle: function() { 47 let profileMenuButton = document.querySelectorAll('.navbar_profile'), 48 profileDropdownIcon = document.querySelectorAll('.navbar_dropdown_icon_mobile'), 49 profileSubMenu = document.querySelectorAll('.navbar_profile_submenu') 50 51 function submenuToggle (menubutton, icon, submenu) { 52 submenu.style.display = "none" 53 54 icon.addEventListener('click', function () { 55 if (submenu.style.display !== "none") { 56 submenu.style.display = "none" 57 menubutton.style.backgroundColor = "" 58 icon.classList.toggle('active') 59 } 60 else { 61 submenu.style.display = "block" 62 menubutton.style.backgroundColor = "#F1F1F1" 63 icon.classList.toggle('active') 64 } 65 }) 66 } 67 68 profileMenuButton.forEach((c, i, a) => { 69 submenuToggle(c, profileDropdownIcon[i], profileSubMenu[i]) 70 }) 71 72 }, 73 74 //navbarHandler INIT 75 init: function() { 76 let self = this 77 78 self.profileSubmenuToggle() 79 self.mobileMenuToggle() 80 } 81} 82 83navbarHandler.init()
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.