1(function ($) { 2 // Check to see if there are multiple nav elements 3 // TODO: Is this still necessary? 4 $navs = $(".flourishing-main-wrapper .elementor-widget-wrap > .elementor-widget-nav-menu"); 5 if ($navs.length > 1) { 6 $($navs[0]).attr('style', 'display:none !important'); 7 $($navs[1]).css('margin-top', '-23px'); 8 } 9 10 // **** Sidebar Setup **** // 11 // Move setting button into group (Do this in Mandala code?) 12 $(document).ready(() => { 13 $('#browseSearchPortal button#advanced-site-settings').appendTo($('#browseSearchPortal .c-MainSearchToggle--group')); 14 }); 15 16 // Hide sidebar on circle-x button clicks 17 $('#secondary').on('click', '.search-column-close-filters, .treeNav-header__closeButton', (e) => { 18 $('#secondary').hide(); 19 }); 20 21 // Open sidebar when buttons in navbar are clicked 22 $('#browseSearchPortal').on('click', '#advanced-search-tree-toggle, #main-search-tree-toggle', 23 (e) => { 24 if ($('#secondary').is(":hidden")) { 25 $('#secondary').show(); 26 window.scrollTo(0,0); 27 } 28 setTimeout(() => { 29 if ($('#l-column__search, #l-column__search--treeNav').hasClass('closed')) { 30 $('#secondary').hide(); 31 } else if ($('#secondary').is(":hidden")) { 32 $('#secondary').show(); 33 window.scrollTo(0,0); 34 } 35 }, 10); 36 }); 37 38 // **** Hash Processing ****// 39 // Function to add "mandala" class to body when a link with a mandala hash is clicked 40 // This has the effect of immediately hiding the WP content before the mandala content loads 41 // TODO: check if this is still necessary or if it can be merged with "hashchange" code below 42 $('body').on('click', 'a', function (e) { 43 const ael = $(this); 44 const anchor_ref = ael.data('anchor-ref'); 45 const href = ael.attr('href'); 46 if (href?.includes('#/')) { 47 const he = window?.mandala?.hash_execptions; // hash exceptions are set in the admin page 48 const hash = '#/' + href.split("#/")[1]; 49 if (!he || !he.includes(hash)) { 50 if (!$('body').hasClass('mandala') && e.originalEvent.which === 1 && e.originalEvent.metaKey === false) { 51 window.scrollTo(0, 0); 52 $('body').addClass('mandala'); 53 } 54 } 55 } else if (anchor_ref?.length > 0) { 56 if ($('#shanti-texts-body')?.length === 1) { 57 // For Footnotes in texts use anchors to scroll not as paths. 58 const curroff = ael.offset().top; 59 const currscroll = $('#shanti-texts-body').scrollTop(); 60 let offtop = $(anchor_ref).offset().top; 61 // console.log(`curroff: ${curroff}, anchoroff: ${offtop}, curr scroll: ${currscroll}`); 62 offtop = currscroll + offtop - 175; 63 if (!isNaN(offtop)) { 64 $('#shanti-texts-body').animate({ 65 scrollTop: offtop 66 }, 800); 67 } 68 return false; 69 } else { 70 $(anchor_ref).get(0).scrollIntoView(); 71 } 72 } 73 }); 74 75 // 'mandala' body class is initially added automatically by plugin php, this hides mandala page content 76 // Remove it here if there is no hash to load Mandala content 77 setTimeout(function() { 78 const hash = window.location.hash; 79 const he = window?.mandala_wp?.hash_exceptions; // hash exceptions are set in the admin page and added as a js object 80 const setFilterQuery = hash?.includes('#/?'); // if the hash include '/#/?...' this is to set filters in advanced search sidebar but we still want the WP page to show so remove mandala class 81 if (hash === '' || hash === '#/' || he?.includes(hash) || setFilterQuery) { 82 $('body').removeClass('mandala'); 83 } 84 85 // Remove loading class from body that hides both #primary and #secondary via styles. 86 $('body.loading').removeClass('loading'); 87 }, 500); 88 89 // Use Hash Listener to determine when hash is removed and re-expose WP site by removing mandala class from body 90 // Mainly for back button cases, but also for menu-highlighting 91 window.addEventListener('hashchange', function(e) { 92 const hv = window.location.hash; 93 // console.log('hv is', hv); 94 const he = window?.mandala?.hash_execptions; // hash exceptions are set in the admin page and added as a js object 95 if (['', '#/', '#'].includes(hv) || he?.includes(hv)) { // When there is no hash or its an exception 96 $('body').removeClass('mandala'); // remove mandala body class allows WP content to show
97 // console.log("removing mandala in listener"); 98 // Highlight the home menu item and remove any previous highlighted items 99 $('#primary-menu .current-menu-item').removeClass('current-menu-item'); 100 $('#primary-menu .menu-item-home').addClass('current-menu-item'); 101 } else { 102 // When there is a hash, add mandala class and highlight appropriate menu item 103 if (!$('body').hasClass('mandala')) { $('body').addClass('mandala'); } 104 // Look for submenu items and highlight the parent 105 let mi = false; 106 $('#primary-menu li.menu-item a').each(function (i) { 107 let eh = $(this).attr('href'); 108 if (eh.includes('/#/')) { 109 // remove the domain or path if there is one to just compare hashes 110 const ehpts = eh.split('/#/'); 111 eh = '#/' + ehpts[1]; 112 } 113 // If menu item found with href same as current hash, then highlight it 114 if (eh == hv) { 115 if ($(this).parents('.sub-menu').length > 0) { 116 $('#primary-menu .current-menu-item').removeClass('current-menu-item'); 117 $(this).parents('.sub-menu').eq(0).parent().addClass('current-menu-item'); 118 } 119 } 120 }); 121 } 122 }, false); 123 124 // **** Handle WP Sidebar Menu **** // 125 const menu_id = $('#secondary .widget_nav_menu').eq(0).attr('id'); 126 if (menu_id) { 127 if (window?.mandala_wp) { 128 window.mandala_wp.navmenu = menu_id; // Add menu id to mandala_wp settings in window and use in react. 129 } 130 } 131})(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.