1(function($) { 2 'use strict'; 3 4 /** 5 * Utlity function to return part of a URL string 6 * e.g. var foo = getParameterByName('foo') 7 */ 8 function getParameterByName(name, url) { 9 if (!url) { 10 url = window.location.href; 11 } 12 name = name.replace(/[\[\]]/g, "\\$&"); 13 var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), 14 results = regex.exec(url); 15 if (!results) return null; 16 if (!results[2]) return ''; 17 return decodeURIComponent(results[2].replace(/\+/g, " ")); 18 } 19 20 $('[data-module="cta-grid-filter"]').each(function() { 21 var options = $(this).data('module-options'); 22 23 new CN.GridFilter($(this), { 24 'item': '.c-cta', 25 'layoutMode': options.layout 26 }); 27 }); 28 29 var filterGrid = getParameterByName('filter-grid'); 30 31 if (filterGrid) { 32 var filterValues = filterGrid.split(','); 33 34 $.each(filterValues, function (index, filterValue) { 35 var foundMatch = false; 36 37 $('[data-module="cta-grid-filter"] .js-filter').each(function() { 38 var filterChildren = $(this).children(); 39 var filterOptions = (filterChildren.length) ? $(this).children('option') : $(this); 40 41 $.each(filterOptions, function() { 42 var filterOption = $(this); 43 44 if (filterOption.val() === filterValue) { 45 filterOption.attr('selected', 'selected'); 46 filterOption.attr('checked', 'checked'); 47 foundMatch = true; 48 return; 49 } 50 }); 51 52 if (foundMatch) { 53 $(this).trigger('change'); 54 return; 55 } 56 }); 57 }); 58 } 59 60})(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.