1$(function() { 2 // Dropdown toggle 3 $(document).delegate('.locator-dropdown > span', 'click', function(e) { 4 e.preventDefault(); 5 var dropdown = $(this).closest('.locator-dropdown'); 6 var ul = dropdown.children('ul'); 7 var isOpen = ul.is(':visible'); 8 if (dropdown.data('group') && !isOpen) { 9 $('.locator-dropdown[data-group="' + dropdown.data('group') + '"]').children('ul').slideUp('fast', function() { 10 $(this).closest('.locator-dropdown').removeClass('open'); 11 }); 12 } 13 ul.slideToggle('fast', function() { 14 dropdown.toggleClass('open', !isOpen); 15 }); 16 }); 17 // Filter Scrollbar 18 $('.scrollable').perfectScrollbar({ 19 suppressScrollX: true 20 }); 21 // Filter Slider 22 $('.filter-price-slider').each(function(){ 23 var fromValue = parseFloat($(this).closest('.filter-price-controls').find('.from').val()); 24 var toValue = parseFloat($(this).closest('.filter-price-controls').find('.to').val()); 25 var minValue = parseFloat($(this).data('min')); 26 var maxValue = parseFloat($(this).data('max')); 27 28 $(this).children('div').slider({ 29 range: true, 30 min: minValue, 31 max: maxValue, 32 values: [fromValue, toValue], 33 step: 1, 34 slide: function(event, ui) {
35 $(this).closest('.filter-price-controls').find('.from').val(ui.values[0].toFixed(0).replace('.', ',')); 36 $(this).closest('.filter-price-controls').find('.to').val(ui.values[1].toFixed(0).replace('.', ',')); 37 }, 38 stop: function(event, ui) { 39 evaluateFilter(); 40 var active = 0; 41 if (isSaleFilterActive() > 0) { 42 active += 1; 43 } 44 if (isOutletFilterActive() > 0) { 45 active += 1; 46 } 47 $(this).closest('.locator-filter').children('span').children('span').text(active > 0 ? '(' + active + ')' : ''); 48 } 49 }); 50 }); 51 // Filter handling 52 var getFilterValues = function() { 53 var activeFilters = []; 54 $('.locator-filter .filter-option.active').each(function() { 55 activeFilters.push('f' + $(this).data('filter') + ':o' + $(this).data('value')); 56 }); 57 58 var filterNumber = $('.locator-filter .filter-price').data('filter'); 59 var fromValue = parseFloat($('.filter-price .from').val()); 60 var toValue = parseFloat($('.filter-price .to').val()); 61 var minValue = parseFloat($('.filter-price-slider').data('min')); 62 var maxValue = parseFloat($('.filter-price-slider').data('max')); 63 64 if (filterNumber && (fromValue != minValue || toValue != maxValue)) { 65 activeFilters.push('f' + filterNumber + ':o' + fromValue + '-' + toValue); 66 } 67 68 if ($('.filter-price-sale input').is(':checked')) { 69 activeFilters.push('f99:oSale'); 70 } 71 72 if ($('.filter-price-outlet input').is(':checked')) { 73 activeFilters.push('f99:oOutlet'); 74 } 75 76 if ($('.filter-new').length > 0) { 77 activeFilters.push('f99:oNew'); 78 } 79 80 return activeFilters; 81 } 82 var evaluateFilter = function() { 83 var btn = $('.filter-btn a'); 84 btn.find('span').html('<i class="fa fa-spinner fa-spin"></i>'); 85 86 var activeFilters = getFilterValues(); 87 88 $.ajax({ 89 url: btn.data('href'), 90 type: 'GET', 91 dataType: 'json', 92 data: { 93 'fnc': 'getFilterResponse', 94 'filter': activeFilters.join(';') 95 } 96 }).done(function(data) { 97 btn.html(data.count == 1 ? btn.data('text-single') : btn.data('text')); 98 btn.find('span').text(data.count); 99 btn.attr('href', data.link); 100 btn.toggleClass('disabled', data.count < 1); 101 }).fail(function() { 102 btn.html(btn.data('text')); 103 btn.find('span').text(0); 104 btn.addClass('disabled'); 105 }); 106 }; 107 var isSaleFilterActive = function() { 108 var fromValue = parseFloat($('.filter-price .from').val()); 109 var toValue = parseFloat($('.filter-price .to').val()); 110 var minValue = parseFloat($('.filter-price-slider').data('min')); 111 var maxValue = parseFloat($('.filter-price-slider').data('max')); 112 113 return $('.filter-price-sale input').is(':checked') || fromValue != minValue || toValue != maxValue; 114 }; 115 var isOutletFilterActive = function() { 116 var fromValue = parseFloat($('.filter-price .from').val()); 117 var toValue = parseFloat($('.filter-price .to').val()); 118 var minValue = parseFloat($('.filter-price-slider').data('min')); 119 var maxValue = parseFloat($('.filter-price-slider').data('max')); 120 121 return $('.filter-price-outlet input').is(':checked') || fromValue != minValue || toValue != maxValue; 122 }; 123 $(document).delegate('.filter-option', 'click', function(e) { 124 e.preventDefault(); 125 var status = $(this).hasClass('active'); 126 $(this).toggleClass('active', !status); 127 evaluateFilter(); 128 129 var parent = $(this).closest('.locator-filter'); 130 var activeFiltersCount = parent.find('.filter-option.active').length; 131 parent.children('span').children('span').text(activeFiltersCount > 0 ? '(' + activeFiltersCount + ')' : ''); 132 }); 133 $(document).delegate('.filter-price-sale input', 'change', function(e) { 134 e.preventDefault(); 135 evaluateFilter(); 136 137 $(this).closest('.locator-filter').children('span').children('span').text(isSaleFilterActive() > 0 ? '(1)' : ''); 138 }); 139 $(document).delegate('.filter-price-outlet input', 'change', function(e) { 140 e.preventDefault(); 141 evaluateFilter(); 142 143 $(this).closest('.locator-filter').children('span').children('span').text(isOutletFilterActive() > 0 ? '(1)' : ''); 144 }); 145 $(document).delegate('.filter-btn a', 'click', function(e) { 146 if ($(this).hasClass('disabled')) { 147 e.preventDefault(); 148 } 149 }); 150});
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.