1"use static"; 2 3(function($){ 4 window.isDesktopMediaQuery = function() { 5 let mediaQuery = $.xData('desktop_media_query'); 6 7 return $.isMediaQuery(mediaQuery); 8 // var results = window.matchMedia(mediaQuery); 9 // return results.matches; 10 }; 11 12 window.isTabletMediaQuery = function() { 13 let enabled = true === $.xData('tablet_enabled'); 14 if (!enabled) { 15 return false; 16 } 17 18 let mediaQuery = $.xData('tablet_media_query'); 19 20 return $.isMediaQuery(mediaQuery); 21 }; 22 23 window.isMobileMediaQuery = function() { 24 let mediaQuery = $.xData('mobile_media_query'); 25 26 return $.isMediaQuery(mediaQuery); 27 }; 28 29 window.currentMediaQuery = function() { 30 if (isMobileMediaQuery()) { 31 return 'mobile'; 32 } 33 34 let tablet = true === $.xData('tablet_enabled'); 35 if (tablet) { 36 if (isTabletMediaQuery()) { 37 return 'tablet'; 38 } 39 } 40 41 return 'desktop'; 42 }; 43 44 45 window.toggleGototopVisibility = function() { 46 let headerHeight = $('header.top:visible').outerHeight(); 47 let current = $(window).scrollTop(); 48 49 if (current > headerHeight) { 50 $('#goto-top-box').addClass('active'); 51 } else { 52 $('#goto-top-box').removeClass('active'); 53 } 54 }; 55 56 window.toggleMobileStickTop = function() { 57 var adminbar = $('#wpadminbar.mobile'); 58 if (adminbar.length > 0) { 59 var pos = $(adminbar).offsetEdgePosition(); 60 if (pos.bottom >= 0) { 61 $('html, body').removeClass('adminbar-is-hide'); 62 $('.toggle-for-mobile-scroll').css('--adminbar-offset', pos.bottom.toString() + 'px'); 63 } else { 64 $('html, body').addClass('adminbar-is-hide'); 65 $('.toggle-for-mobile-scroll').css('--adminbar-offset', '0'); 66 } 67 } 68 }; 69 70 window.updateMobileHeaderPos = function() { 71 var header = $('header.mobile.top'); 72 if ($(header).is(':visible')) { 73 var pos = $(header).outerSize(); 74 75 $('.toggle-for-mobile-header-pos').css('--mobile-header-height', pos.height.toString() + 'px'); 76 } else { 77 $('.toggle-for-mobile-header-pos').css('--mobile-header-height', '0'); 78 } 79 }; 80 81 window.updateMobileFooterSize = function() { 82 var footer = $('#mobile-footer'); 83 if (footer.length > 0) { 84 var size = $(footer).outerSize(); 85 $('.toggle-for-mobile-footer').css('--mobile-footer-height', size.height.toString() + 'px'); 86 } 87 }; 88 89 $(document).ready(function() { 90 $(window).on('scroll', function(e) { 91 toggleGototopVisibility(); 92 toggleMobileStickTop(); 93 updateMobileHeaderPos(); 94 }); 95 96 $(window).resize(function(e) { 97 $(window).trigger('scroll'); 98 }); 99 100 $(document).on('click', '.mobile-menu-trigger:not(.expanded)', function(e) { 101 $('body').addClass('mobile-menu-expanded'); 102 $('button.mobile-menu-trigger:not(.expanded)').addClass('expanded'); 103 }); 104 $(document).on('click', '.mobile-menu-trigger.expanded', function(e) { 105 $('body').removeClass('mobile-menu-expanded'); 106 $('button.mobile-menu-trigger.expanded').removeClass('expanded'); 107 }); 108 109 $(document).on('click', '#mobile-flyout-nav li.has-children', function(e) { 110 if ($(this).is('.active')) { 111 $(this).removeClass('active'); 112 } else { 113 $(this).addClass('active'); 114 } 115 }); 116 117 $(document).on('click', '#desktop-top-nav a.submenu-trigger:not(.active)', function(e) { 118 let target = $(this).attr('href'); 119 let submenu = $(target); 120 121 if (submenu.length < 1) { 122 return; 123 } 124 125 $(submenu).addClass('active'); 126 $(this).addClass('active'); 127 128 }); 129 130 $(document).on('click', '#desktop-top-nav a.submenu-trigger.active', function(e) { 131 let target = $(this).attr('href'); 132 let submenu = $(target); 133 134 if (submenu.length < 1) { 135 return; 136 } 137 138 $(submenu).removeClass('active'); 139 $(this).removeClass('active'); 140 }); 141 142 $('form.search button.search.trigger').click(function(e) { 143 e.stopPropagation(); 144 var form = $(this).closest('form'); 145 $(form).removeClass('collapse'); 146 $('body').addClass('desktop-search-expanded'); 147 $(form).find('input[type=search]').focus(); 148 }); 149 $('form.search button.search.submit').click(function(e) { 150 e.stopPropagation(); 151 // var form = $(this).closest('form'); 152 // $(form).addClass('collapse'); 153 }); 154 $(document).on('click', 'form.search input.escape[type=search]', function(e) { 155 e.stopPropagation(); 156 }); 157 158 $(document).on('keyup', 'form.search input.escape[type=search]', function(e) { 159 if (e.key == "Escape") { 160 e.stopImmediatePropagation(); 161 var form = $(this).closest('form'); 162 $(form).addClass('collapse'); 163 $('body').removeClass('desktop-search-expanded'); 164 } 165 }); 166 167 $(document).on('click', 'body.desktop-search-expanded', function(e) { 168 e.stopImmediatePropagation(); 169 $('form.search:not(.collapse)').addClass('collapse'); 170 }); 171 172 173 174 /* 175 $(window).on('x-scrollbar-show', function(e) { 176 console.log('show'); 177 $.setRootCssVar('scrollbar-offset', e.width); 178 }); 179 180 $(window).on('x-scrollbar-hide', function(e) { 181 console.log('hide'); 182 $.setRootCssVar('scrollbar-offset', 0); 183 }); 184 */ 185 186 $(window).resize(function() { 187 let contentWidth = $.xData('desktop_content_width'); 188 let windowWidth = $(window).width(); 189 let gototopWidth = $('#goto-top-box').width(); 190 191 if (windowWidth > (contentWidth + gototopWidth + 50)) { 192 $('#goto-top-box').addClass('desktop-wide-screen'); 193 } else { 194 $('#goto-top-box').removeClass('desktop-wide-screen'); 195 } 196 }); 197 198 $('#goto-top').click(function(e) { 199 e.preventDefault(); 200 $('html, body').animate({ 201 scrollTop: "0" 202 }, 1200); 203 }); 204 205 toggleGototopVisibility(); 206 toggleMobileStickTop(); 207 updateMobileFooterSize(); 208 209 $(window).trigger('resize'); 210 }); 211})(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.