1(function($) { 2 // On page load... 3 $(document).ready(() => { 4 // Highlight Active Hash Links in Primary Menu 5 HashMenuActiveLink(); // In case page is loaded from link call at beginning 6 CheckForHash(); 7 // ActivateMobileSearchTab(); 8 ActivateSettingsLink(); 9 ResizeListener(); 10 // MainMenuUpdates(); 11 // $(window).on("resize", mandalaWindowResize); 12 // Otherwise, add event listener for hash changes 13 window.addEventListener("hashchange", HashMenuActiveLink, false); 14 }); 15 16 17 // Highlights the active link in a menu if it is a Mandala hash which loads content asynchronously 18 const HashMenuActiveLink = () => { 19 const hash = window.location.hash; 20 // if hash is nothing, #, or #/ do nothing 21 if (hash.length < 3) { 22 return; 23 } 24 // Otherwise, go through each primary and subsite menu items and if one matches, then add class to highlight it 25 $.each($('#primary-menu .menu-item a, #subsite-menu .menu-item a'), (n, ael) => { 26 const mylink = $(ael).attr('href'); 27 if (mylink === hash) { 28 $('.current-menu-item').removeClass('current-menu-item') 29 $(ael).parent().addClass('current-menu-item') 30 } 31 }); 32 }; 33 34 // Checks whether there is a hash and insures that the mandala class is set for the body 35 const CheckForHash = () => { 36 const hsh = window.location.hash; 37 if (hsh?.length > 2 && !$('body').hasClass('mandala')) { 38 $('body').addClass('mandala'); 39 } 40 $('body').removeClass('loading'); 41 }; 42 43 /** 44 * Moves to banner for mobile sizes 45 */ 46 const mandalaWindowResize = () => { 47 const srchport = $('#basicSearchPortal'); 48 if ($(window).width() > 1000) { 49 if (srchport.parents('#basicAndBrowse').length === 0) { 50 const port = $('#basicSearchPortal').detach(); 51 $('#basicAndBrowse') 52 .prepend(port); 53 } 54 } else { 55 $('#l-column__search.closed').removeClass('closed'); 56 if (srchport.parents('#basicAndBrowse').length > 0) { 57 const port = $('#basicSearchPortal').detach(); 58 if($('.site-header-main-section-left.site-header-section.site-header-section-left #basicSearchPortal').length === 0) { 59 $('.site-header-main-section-left.site-header-section.site-header-section-left') 60 .append(port); 61 } 62 63 } 64 65 } 66 } 67 68 const ActivateMobileSearchTab = () => { 69 mandalaWindowResize(); 70 const srch_toggle_rep = $('#main-search-tree-toggle-replica'); 71 72 if (!srch_toggle_rep.hasClass('processed')) { 73 $('#main-search-tree-toggle-replica').click(() => { 74 $('#main-search-tree-toggle').click(); 75 $('.l-content__rightsidebar.closeSideBar').removeClass('closeSideBar'); 76 }); 77 srch_toggle_rep.addClass('processed'); 78 } 79 } 80 81 // Settings link in Main Menu has class "mandalaSettings" which is a React portal for the button to show the settings modal. 82 // But the button doesn't display in the menu. So need this function to click it when menu link is clicked. 83 const ActivateSettingsLink = () => { 84 $('nav#mobile-site-navigation').on('click', 'li.mandalaSettings a', () => { 85 $('button#advanced-site-settings').click(); 86 return false; 87 }); 88 } 89 90 /** ResizeListener for Window: checks if breadcrumbs go over parent container and are hiddne **/ 91 const ResizeListener = () => { 92 const checkBreadcrumbs = () => { 93 const bcitem = $('.breadcrumb-item.self'); 94 if (bcitem instanceof Array && bcitem.length > 0) { 95 const bc = bcitem[0].getBoundingClientRect(); 96 const pitem = bcitem.parent(); 97 const p = pitem.get(0).getBoundingClientRect(); 98 const ch = $('#c-content__header__main')[0].getBoundingClientRect(); 99 if (bc && ch) { 100 const end_of_bc = p.x + bc.x + bc.width; 101 if (ch.width < end_of_bc) { 102 pitem.addClass('truncate'); 103 } else { 104 pitem.removeClass('truncate'); 105 } 106 } 107 } 108 } 109 110 // Debouncing so breadcrumbs don't flash on and off during resizing 111 let timeout; 112 $(window).on('resize', (re) => { 113 if (timeout) { clearTimeout(timeout); } 114 timeout = setTimeout(checkBreadcrumbs, 250); 115 }); 116 }; 117 118 /* 119 const MainMenuUpdates = () => { 120 // $('#secondary .widget_nav_menu h2.widget-title').append('<div id="main-menu-close"></div>'); 121 122 $('#secondary .widget_nav_menu h2.widget-title').on('click', '.shanticon-cancel', function(e) { 123 $('#secondary, #secondary .l-content__rightsidebar').hide(); 124 console.log("right sidebar closed???", e.currentTarget, $(e.currentTarget).parent().hasClass('main-menu-close')); 125 if($(e.currentTarget).parent().hasClass('main-menu-close')) { 126 localStorage.setItem('mainmenu', 'closed'); 127 const evt = new Event('storage'); 128 document.dispatchEvent(evt); 129 console.log("Updated localstorage and dispatched event", localStorage); 130 } 131 }); 132 }*/ 133 134})(jQuery);
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.