1(function($){ 2 'use strict'; 3 jQuery(window).load(function() { 4 5 6 // external js: isotope.pkgd.js 7 8 9 // init Isotope 10 var $grid = $('.course-items').isotope({ 11 itemSelector: '.item', 12 layoutMode: 'fitRows', 13 getSortData: { 14 name: '.name', 15 symbol: '.symbol', 16 number: '.number parseInt', 17 category: '[data-category]', 18 weight: function( itemElem ) { 19 var weight = $( itemElem ).find('.weight').text(); 20 return parseFloat( weight.replace( /[\(\)]/g, '') ); 21 } 22 } 23 }); 24 25 var $grid1 = $('.gallery-items').isotope({ 26 itemSelector: '.item', 27 layoutMode: 'fitRows', 28 getSortData: { 29 name: '.name', 30 symbol: '.symbol', 31 number: '.number parseInt', 32 category: '[data-category]', 33 weight: function( itemElem ) { 34 var weight = $( itemElem ).find('.weight').text(); 35 return parseFloat( weight.replace( /[\(\)]/g, '') ); 36 } 37 } 38 }); 39 40 41 // filter functions 42 var filterFns = { 43 // show if number is greater than 50 44 numberGreaterThan50: function() { 45 var number = $(this).find('.number').text(); 46 return parseInt( number, 10 ) > 50; 47 }, 48 // show if name ends with -ium 49 ium: function() { 50 var name = $(this).find('.name').text(); 51 return name.match( /ium$/ ); 52 } 53 }; 54 55 // bind filter button click 56 $('#filters').on( 'click', 'button', function() { 57 var filterValue = $( this ).attr('data-filter'); 58 // use filterFn if matches value 59 filterValue = filterFns[ filterValue ] || filterValue; 60 $grid.isotope({ filter: filterValue }); 61 $grid1.isotope({ filter: filterValue }); 62 }); 63 64 // bind sort button click 65 $('#sorts').on( 'click', 'button', function() { 66 var sortByValue = $(this).attr('data-sort-by'); 67 $grid.isotope({ sortBy: sortByValue }); 68 $grid1.isotope({ sortBy: sortByValue }); 69 }); 70 71 // change is-checked class on buttons 72 $('.button-group').each( function( i, buttonGroup ) { 73 var $buttonGroup = $( buttonGroup ); 74 $buttonGroup.on( 'click', 'button', function() { 75 $buttonGroup.find('.is-checked').removeClass('is-checked'); 76 $( this ).addClass('is-checked'); 77 }); 78 }); 79 80 }); 81}(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.