1jQuery(document).ready(function($) { 2 3 'use strict'; 4 5 WPX.Utility = { 6 7 $body: $('body'), 8 $mobileNav: $('[data-footer="mobile-nav"]'), 9 $mobileNavParent: $('[data-footer="mobile-nav"] li.menu-item-has-children span'), 10 $exposeSearch: $('.expose-search a'), 11 $submitSearch: $('[data-search="search-submit"]'), 12 $submitInput: $('[data-search="search-field"]'), 13 $hamburger: $('[data-header="hamburger"]'), 14 $accordionItem: $('[data-accordion="expand"]'), 15 $tabItem: $('[data-tabs="tab"]'), 16 $navChildToggle: $('[data-children="toggle"]'), 17 $gallery: $('.gallery'), 18 $whichGallery: false, 19 $modalTrigger: $('[data-modal]'), 20 stickyHeight: 70, 21 $translationClose: $('[data-module="translation-close"]'), 22 $jumpMenu: $('[data-jumpmenu]'), 23 $translation: $('[data-translation="slides"]'), 24 25 init: function() { 26 27 this.bindEvents(); 28 29 this.galleries(); 30 31 this.translation(); 32 33 }, 34 35 bindEvents: function() { 36 37 var translationCookie = Cookies.get('wpx_translation'); 38 39 if (translationCookie === 'suppressed') { 40 $('.header-main').removeClass('has-translation'); 41 $('.nav-mobile').removeClass('has-translation'); 42 } else { 43 $('.header-main').addClass('has-translation'); 44 $('.nav-mobile').addClass('has-translation'); 45 $('[data-module="translation-note"]').addClass('is-active'); 46 WPX.Utility.stickyHeight = 140; 47 } 48 49 WPX.Utility.$translationClose.click(function(event) { 50 event.preventDefault(); 51 Cookies.set('wpx_translation', 'suppressed', { expires: 30 }); 52 $('.header-main').removeClass('has-translation'); 53 $('.nav-mobile').removeClass('has-translation'); 54 $('[data-module="translation-note"]').remove(); 55 WPX.Utility.stickyHeight = 140; 56 }); 57 58 WPX.Utility.$jumpMenu.on('change', function() { 59 $('html, body').animate({scrollTop: $('#'+this.value).offset().top-WPX.Utility.stickyHeight}, 1000); 60 }); 61 62 WPX.Utility.$navChildToggle.click(function(event) { 63 event.preventDefault(); 64 var isExpanded = $(this).attr('aria-expanded') === 'true'; 65 $(this).parent().toggleClass('is-expanded'); 66 $(this).attr('aria-expanded', isExpanded ? 'false' : 'true'); 67 }); 68 69 WPX.Utility.$tabItem.click(function(event) { 70 event.preventDefault(); 71 var whichTabID = $(this).attr('data-target'); 72 $(this).closest('[data-module="tabs"]').find('[data-tabs="tab"]').removeClass('is-active').attr('aria-selected', 'false'); 73 $(this).addClass('is-active').attr('aria-selected', 'true'); 74 $(this).closest('[data-module="tabs"]').find('[data-tabs="tab-item"]').attr('aria-hidden','true'); 75 $(this).closest('[data-module="tabs"]').find('[data-id="'+whichTabID+'"]').attr('aria-hidden','false'); 76 $(this).closest('[data-module="tabs"]').find('[data-tabs="tab-item"]').hide(); 77 $(this).closest('[data-module="tabs"]').find('[data-id="'+whichTabID+'"]').show(); 78 }); 79 80 WPX.Utility.$accordionItem.click(function(event) { 81 event.preventDefault(); 82 var $item = $(this).closest('.accordion-item'); 83 var $content = $item.find('[data-accordion="content"]'); 84 var isExpanded = $(this).attr('aria-expanded') === 'true'; 85 $item.toggleClass('is-expanded'); 86 $(this).attr('aria-expanded', isExpanded ? 'false' : 'true'); 87 $content.attr('aria-hidden', isExpanded ? 'true' : 'false'); 88 }); 89 90 WPX.Utility.$mobileNavParent.click(function(event) { 91 event.preventDefault(); 92 $(this).closest('.menu-item-has-children').toggleClass('is-expanded'); 93 }); 94 95 WPX.Utility.$hamburger.click(function(event) { 96 event.preventDefault(); 97 WPX.Utility.$body.toggleClass('is-mobile-open'); 98 var $btn = $(this).find('button'); 99 $btn.attr('aria-expanded', $btn.attr('aria-expanded') === 'true' ? 'false' : 'true'); 100 }); 101 102 WPX.Utility.$exposeSearch.click(function(event) { 103 event.preventDefault(); 104 $(this).closest('li').toggleClass('is-exposed'); 105 }); 106 107 WPX.Utility.$submitSearch.click(function(event) { 108 event.preventDefault(); 109 var search_query = $(this).closest('[data-search="search-wrap"]').find('[data-search="search-field"]').val(); 110 window.location.href = SITE_ROOT+"?s="+encodeURIComponent(search_query); 111 }); 112 113 WPX.Utility.$submitInput.keypress(function(event) { 114 if (event.which === 13) { 115 var search_query = $(this).closest('[data-search="search-wrap"]').find('[data-search="search-field"]').val(); 116 window.location.href = SITE_ROOT+"?s="+encodeURIComponent(search_query); 117 } 118 }); 119 120 $('#back-to-top').click(function(event) { 121 event.preventDefault(); 122 $('html, body').animate({scrollTop: 0}, 1000); 123 }); 124 125 if ($('.addeventatc').length) { 126 var aeObserver = new MutationObserver(function(mutations) { 127 mutations.forEach(function(mutation) { 128 var el = mutation.target; 129 var $dropdown = $(el).find('.addeventatc_dropdown'); 130 var isOpen = $dropdown.length && $dropdown.is(':visible'); 131 $(el).attr('aria-expanded', isOpen ? 'true' : 'false'); 132 });
133 }); 134 $('.addeventatc').each(function() { 135 aeObserver.observe(this, { attributes: true, childList: true, subtree: true, attributeFilter: ['class', 'style'] }); 136 }); 137 } 138 139 }, 140 141 translation: function() { 142 143 if (WPX.Utility.$translation.length) { 144 145 WPX.Utility.$translation.each(function( index ) { 146 147 WPX.Utility.$translation = $(this); 148 149 WPX.Utility.$translation.on('init', function(event, slick){ 150 }).slick({ 151 dots: false, 152 autoplaySpeed: 5000, 153 slide: 'p', 154 slidesToShow: 1, 155 arrows: false, 156 swipe: true, 157 autoplay: true, 158 fade: true, 159 slidesToScroll: 1, 160 infinite: true, 161 cssEase: 'ease' 162 }); 163 164 }); 165 166 } 167 168 }, 169 170 galleries: function() { 171 172 if (WPX.Utility.$gallery.length) { 173 174 WPX.Utility.$gallery.each(function( index ) { 175 176 WPX.Utility.$whichGallery = $(this); 177 178 WPX.Utility.$whichGallery.on('init', function(event, slick){ 179 WPX.Utility.$whichGallery.addClass('is-loaded'); 180 }).slick({ 181 dots: true, 182 appendDots: '.dots', 183 autoplaySpeed: 10000, 184 slide: '.gallery-item', 185 slidesToShow: 1, 186 arrows: true, 187 customPaging: function(slider, i) { 188 return '<span class="dot"></span>'; 189 }, 190 adaptiveHeight: true, 191 swipe: true, 192 autoplay: false, 193 slidesToScroll: 1, 194 infinite: true, 195 cssEase: 'ease' 196 }); 197 198 }); 199 200 } 201 } 202 203 }; 204 205 WPX.Utility.init(); 206 207});
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.