1jQuery(function(){ 2 jQuery('#Grid').mixitup(); 3 var $filters = jQuery('#Filters').find('li'), 4 dimensions = { 5 grid_filter: 'all', // Create string for first dimension 6 contract_type: 'all', // Create string for second dimension 7 portfolio_type: 'all' // Create string for second dimension 8 }; 9 10 11 $filters.on('click',function(){ 12 13 var $t = jQuery(this), 14 dimension = $t.attr('data-dimension'), 15 filter = $t.attr('data-filter'), 16 filterString = dimensions[dimension]; 17 if(filter == 'all'){ 18 // If "all" 19 if(!$t.hasClass('active')){ 20 // if unchecked, check "all" and uncheck all other active filters 21 $t.addClass('active').siblings().removeClass('active'); 22 // Replace entire string with "all" 23 filterString = 'all'; 24 } else { 25 // Uncheck 26 $t.removeClass('active'); 27 // Emtpy string 28 filterString = ''; 29 } 30 } else { 31 // Else, uncheck "all" 32 $t.siblings('[data-filter="all"]').removeClass('active'); 33 // Remove "all" from string 34 filterString = filterString.replace('all',''); 35 if(!$t.hasClass('active')){ 36 // Check checkbox 37 $t.addClass('active'); 38 // Append filter to string
39 filterString = filterString == '' ? filter : filterString+' '+filter; 40 } else { 41 // Uncheck 42 $t.removeClass('active'); 43 // Remove filter and preceeding space from string with RegEx 44 var re = new RegExp('(\\s|^)'+filter); 45 filterString = filterString.replace(re,''); 46 }; 47 }; 48 49 // Set demension with filterString 50 dimensions[dimension] = filterString; 51 52 // We now have two strings containing the filter arguments for each dimension: 53 console.info('dimension 1: '+dimensions.grid_filter); 54 console.info('dimension 2: '+dimensions.contract_type); 55 56 57 jQuery('#Grid').mixitup('filter',[dimensions.grid_filter, dimensions.contract_type]); 58 59 }); 60 61});
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.