1// JavaScript Document 2 3//Isotopeè¨å® 4$( function() { 5 // init Isotope 6 var $container = $('.isotope').isotope({ 7 layoutMode: 'masonry', 8 itemSelector: '.element-item', 9 masonry: { 10 columnWidth: 10 11 }, 12 getSortData: { 13 what: '[data-what]', 14 system: '[data-system]', 15 farm: '[data-farm]', 16 sweets: '[data-sweets]', 17 access: '[data-access]' 18 } 19 }); 20 21 // filter functions 22 var filterFns = { 23 // show if number is greater than 50 24 numberGreaterThan50: function() { 25 var number = $(this).find('.number').text(); 26 return parseInt( number, 10 ) > 50; 27 }, 28 // show if name ends with -ium 29 ium: function() { 30 var name = $(this).find('.name').text(); 31 return name.match( /ium$/ ); 32 } 33 }; 34 35 // bind sort button click 36 $('#sorts').on( 'click', '.button', function() { 37 var sortValue = $(this).attr('data-sort-value'); 38 $container.isotope({ sortBy: sortValue }); 39 }); 40 41 // bind filter button click 42 $('#sorts').on( 'click', '.button', function() { 43 var filterValue = $(this).attr('data-filter'); 44 // use filterFn if matches value 45 filterValue = filterFns[ filterValue ] || filterValue; 46 $container.isotope({ filter: filterValue }); 47 }); 48 49 // change is-checked class on buttons 50 $('.button-group').each( function( i, buttonGroup ) { 51 var $buttonGroup = $( buttonGroup ); 52 $buttonGroup.on( 'click', '.button', function() { 53 $buttonGroup.find('.is-checked').removeClass('is-checked'); 54 $( this ).addClass('is-checked'); 55 }); 56 }); 57 58 59 if(getParam()){ 60 var sortValue= getParam(); 61 $container.isotope({ sortBy: sortValue }); 62 var filterValue = "."+sortValue; 63 filterValue = filterFns[ filterValue ] || filterValue; 64 $container.isotope({ filter: filterValue }); 65 } 66 67 function getParam() { 68 var url  = location.href; 69 parameters   = url.split("?"); 70 params  = parameters[1].split("&"); 71 var paramsArray = []; 72 for ( i = 0; i < params.length; i++ ) { 73 neet = params[i].split("="); 74 paramsArray.push(neet[0]); 75 paramsArray[neet[0]] = neet[1]; 76 } 77 var categoryMode = paramsArray["mode"]; 78 return categoryMode; 79 } 80});
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.