1window.addEventListener("load",function(event) { 2 3 var $grid = $('.type-grid'); 4 5 $grid.isotope({ 6 itemSelector: '.grid-item', 7 layoutMode: 'vertical', 8 stagger: 30 9 }); 10 11 // filter functions 12 var filterFns = { 13 // show if number is greater than 50 14 numberGreaterThan50: function() { 15 var number = $(this).find('.number').text(); 16 return parseInt( number, 10 ) > 50; 17 }, 18 // show if name ends with -ium 19 ium: function() { 20 var name = $(this).find('.name').text(); 21 return name.match( /ium$/ ); 22 } 23 }; 24 // bind filter button click 25 $('.filters-button-group').on( 'click', 'button', function() { 26 var filterValue = $( this ).attr('data-filter'); 27 // use filterFn if matches value 28 filterValue = filterFns[ filterValue ] || filterValue; 29 $grid.isotope({ filter: filterValue }); 30 }); 31 // change is-checked class on buttons 32 $('.button-group').each( function( i, buttonGroup ) { 33 var $buttonGroup = $( buttonGroup ); 34 $buttonGroup.on( 'click', 'button', function() { 35 $buttonGroup.find('.is-checked').removeClass('is-checked'); 36 $( this ).addClass('is-checked'); 37 }); 38 }); 39 40// bind filter on select change 41$('.form-control').on( 'change', function() { 42 // get filter value from option value 43 var filterValue = this.value; 44 // use filterFn if matches value 45 filterValue = filterFns[ filterValue ] || filterValue; 46 $grid.isotope({ filter: filterValue }); 47}); 48 49 $grid.on('click', '.accordion-title', function(event) { 50 var $title = $( event.currentTarget ); 51 var $gridItem = $title.parents('.grid-item'); 52 var isOpen = $gridItem.hasClass('is-accordion-open'); 53 // close other accordion 54 $grid.find('.is-accordion-open').removeClass('is-accordion-open') 55 .find('.accordion-content').slideUp( 'normal', layoutIsotope ); 56 if ( !isOpen ) { 57 $gridItem.addClass('is-accordion-open') 58 .find('.accordion-content').slideDown( 'normal', layoutIsotope ); 59 } 60 }); 61 62 function layoutIsotope() { 63 $grid.isotope('layout'); 64 } 65 66 67});
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.