1// Custom JavaScript 2jQuery(document).ready(function($) { 3 4 /** 5 * Search overlay 6 */ 7 $('li.search .nav-link').click(function(e) { 8 e.preventDefault(); 9 if ( $('body').hasClass('search-open') ) { 10 $('body').removeClass('search-open'); 11 $('#wrapper-search').attr('aria-hidden', 'true'); 12 $('#wrapper-search').attr('role', ''); 13 } else { 14 $('body').addClass('search-open'); 15 $('#wrapper-search #s').focus(); 16 $('#wrapper-search').attr('aria-hidden', 'false'); 17 $('#wrapper-search').attr('role', 'search'); 18 } 19 }); 20 21 $('#wrapper-search .close').click(function() { 22 $('body').removeClass('search-open'); 23 $('#wrapper-search').attr('aria-hidden', 'true'); 24 $('#wrapper-search').attr('role', ''); 25 }); 26 27 28 /** 29 * Gridder for team page 30 */ 31 $('.block.team .gridder-list').matchHeight({ 32 property: 'min-height', 33 byRow: false 34 }); 35 36 $('.block.team .gridder').gridderExpander({ 37 scroll: true, 38 scrollOffset: 140, 39 scrollTo: "panel", // panel or listitem 40 animationSpeed: 400, 41 animationEasing: "easeInOutExpo", 42 showNav: true, // Show Navigation 43 nextText: "Next", // Next button text 44 prevText: "Previous", // Previous button text 45 closeText: "", // Close button text 46 onStart: function(){ 47 //Gridder Inititialized 48 }, 49 onContent: function(){ 50 //Gridder Content Loaded 51 }, 52 onClosed: function(){ 53 //Gridder Closed 54 } 55 }); 56 57 58 /** 59 * Accordion 60 */ 61 $('.answer.collapse').on('shown.bs.collapse', function() { 62 63 var $fixed_offset = 92; 64 if ( Modernizr.mq('(max-width: 1024px)')) { 65 $fixed_offset = 92; 66 } 67 if ( Modernizr.mq('(max-width: 768px)')) { 68 $fixed_offset = 68; 69 } 70 71 var $card = $(this).parent(); 72 var $scroll_top = $card.offset().top - $fixed_offset; 73 $('html,body').animate({ 74 scrollTop: $scroll_top 75 }, 500) 76 77 }); 78 79 80 /** 81 * Team Members 82 */ 83 84 // Team Roles 85 $('.block.team a.team-role').click(function(event) { 86 87 event.preventDefault(); 88 89 if ( $(this).hasClass( 'btn-primary' )) { 90 $('a.team-role').removeClass( 'btn-outline-primary' ).addClass('btn-primary'); 91 $(this).removeClass( 'btn-primary' ).addClass( 'btn-outline-primary' ); 92 } else { 93 $('a.team-role').removeClass( 'btn-primary' ).addClass('btn-outline-primary'); 94 $(this).removeClass( 'btn-outline-primary' ).addClass( 'btn-primary' ); 95 } 96 97 var url = [location.protocol, '//', location.host, location.pathname].join(''); 98 99 var team_role = $(this).data('team-role'); 100 101 $('.pagination-row').remove(); 102 $('#posts-ajax .resource').remove(); 103 $('.gridder-show').hide(); 104 $('.spinner-row').addClass('visible'); 105 106 var href = url + '?team_roles=' + team_role; 107 108 history.pushState(null, null, '?team_roles=' + team_role); 109 110 $('#posts-ajax').load(href + ' #posts-ajax>*', function(){ 111 $('.spinner-row.visible').remove(); 112 113 // Call Gridder 114 $('.gridder').gridderExpander({ 115 scroll: true, 116 scrollOffset: 140, 117 scrollTo: "panel", // panel or listitem 118 animationSpeed: 400, 119 animationEasing: "easeInOutExpo", 120 showNav: true, // Show Navigation 121 nextText: "Next", // Next button text 122 prevText: "Previous", // Previous button text 123 closeText: "", // Close button text 124 onStart: function(){ 125 //Gridder Inititialized 126 }, 127 onContent: function(){ 128 //Gridder Content Loaded 129 }, 130 onClosed: function(){ 131 //Gridder Closed 132 } 133 }); 134 135 }); 136 }); 137 138 139 /** 140 * Pretty Dropdown 141 */ 142 143 $dropdown = $('select').prettyDropdown({ 144 classic: true, 145 height: 44, 146 width: '100%' 147 }); 148 149 150 /** 151 * Resources 152 */ 153 154 // Functions 155 function hideElements() { 156 $('.not-found').hide(); 157 $('.pagination-row').remove(); 158 $('#posts-ajax .item').remove(); 159 $('.spinner-row').addClass('visible'); 160 } 161 162 function loadAjax(href) { 163 164 console.log( href ); 165 $('#posts-ajax').load(href + ' #posts-ajax>*', function(){ 166 $('.spinner-row.visible').remove(); 167 }); 168 169 } 170 171 function buildHref(thisObj) { 172 173 var url = [location.protocol, '//', location.host, location.pathname].join(''); 174 var href = url + '?'; 175 var queryParams = new URLSearchParams(window.location.search); 176 177 // Taxonomy filters 178 var taxonomies = thisObj.data('taxonomies'); 179 $.each( taxonomies, function(index, element) { 180 var filter = $('#select-' + element ).val(); 181 if ( filter ) { 182 href = href + element + '=' + filter + '&'; 183 queryParams.set( element, filter); 184 } else { 185 queryParams.delete( element ); 186 } 187 }); 188 189 // Search query 190 var post_type = thisObj.data('post_type'); 191 var search_query = encodeURIComponent($('#' + post_type + '-search-query').val()); 192 if ( search_query ) { 193 href = href + 'search=' + search_query; 194 queryParams.set('search', search_query); 195 } else { 196 queryParams.delete('search'); 197 } 198 199 // Update querystrings 200 history.pushState(null, null, '?'+queryParams.toString()); 201 202 return href; 203 } 204 205 // AJAX pagination 206 $('#posts-ajax').on('click', '#pagination-ajax', function(e){ 207 208 e.preventDefault(); 209 $('.pagination-row').remove(); 210 $('.spinner-row').addClass('visible'); 211 212 var existinghtml = $('#posts-ajax').html(); 213 $('#posts-ajax').load($(this).attr('href') + ' #posts-ajax>*', function(){ 214 $('#posts-ajax').prepend(existinghtml); 215 $('.spinner-row.visible').remove(); 216 }); 217 218 }); 219 220 // Filters 221 $(document).on('change', '.filter select', function() { 222 223 hideElements(); 224 if ( $(this).hasClass( 'cleared' )) { 225 // "Clear filters" forces a "change" state for Pretty Dropdown. 226 // Prevent unnecessary AJAX reloads with the "cleared" class. 227 $(this).removeClass( 'cleared' ); 228 } else { 229 href = buildHref( $(this) ); 230 loadAjax(href); 231 } 232 233 }); 234 235 // Search 236 $('.filters .filters-search-form').submit(function( event ) { 237 event.preventDefault(); 238 239 hideElements(); 240 241 href = buildHref( $(this) ); 242 loadAjax(href); 243 }); 244 245 // Clear filters 246 $('.clear-filters').click(function() { 247 248 hideElements(); 249 250 var post_type = $(this).data('post_type'); 251 var search_placeholder = $(this).data('search_placeholder'); 252 253 var url = [location.protocol, '//', location.host, location.pathname].join(''); 254 var href = url; 255 var queryParams = new URLSearchParams(window.location.search); 256 257 var taxonomies = $(this).data('taxonomies'); 258 $.each( taxonomies, function(index, element) { 259 queryParams.delete( element ); 260 }); 261 queryParams.delete( 'search' ); 262 history.pushState(null, null, '?'+queryParams.toString()); 263 264 $('.filter select').val('').attr('selected','selected').addClass('cleared').change(); 265 $dropdown.refresh(); 266 267 $('#' + post_type + '-search-query').val('').attr('placeholder', search_placeholder ); 268 269 loadAjax(href); 270 }); 271 272 $('.block.blog .slider').slick({ 273 centerMode: false, 274 slidesToShow: 2, 275 slidesToScroll: 2, 276 responsive: [ 277 { 278 breakpoint: 1024, 279 settings: { 280 arrows: true, 281 slidesToShow: 2 282 } 283 }, 284 { 285 breakpoint: 768, 286 settings: { 287 arrows: true, 288 slidesToShow: 1 289 } 290 } 291 ] 292 }); 293 294 295}); 296 297 298jQuery(function($) { 299 $(window).on('resize', function() { 300/* 301 if ( Modernizr.mq('(min-width: 768px)')) { 302 } 303*/ 304 305 }).trigger('resize'); 306});
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.