1function journal_filter_url() { 2 var f = {}; 3 4 $('input[data-filter-trigger]:checked, select[data-filter-trigger]').each(function () { 5 var $this = $(this); 6 7 var name = 'f' + $this.attr('name'); 8 var value = $this.val().trim(); 9 10 f[name] = f[name] || []; 11 f[name].push(value); 12 }); 13 14 if ($('.filter-price').length) { 15 var min = $('.filter-price-min').data('min'); 16 var max = $('.filter-price-max').data('max'); 17 var from = parseInt($('.filter-price-min').val(), 10); 18 var to = parseInt($('.filter-price-max').val(), 10); 19 20 if (((from !== '') && (from !== min)) || ((to !== '') && (to !== max))) { 21 f['fmin'] = [from]; 22 f['fmax'] = [to]; 23 } 24 } 25 26 var url = []; 27 28 $.each(f, function (k, v) { 29 url.push(k + '=' + v.join(Journal['filterUrlValuesSeparator'] || ',')); 30 }); 31 32 url = url.join('&'); 33 34 if (!url) { 35 return Journal['filterBase']; 36 } 37 38 if (Journal['filterBase'].indexOf('?') === -1) { 39 return Journal['filterBase'] + '?' + url; 40 } 41 42 return Journal['filterBase'] + '&' + url; 43} 44 45function journal_filter_price_slider() { 46 $('.filter-price .range-slider input').ionRangeSlider({ 47 type: 'double', 48 min: $('.filter-price-min').data('min'), 49 max: $('.filter-price-max').data('max'), 50 from: $('.filter-price-min').val(), 51 to: $('.filter-price-max').val(), 52 onFinish: function (data) { 53 $('.filter-price-min').val(data.from); 54 $('.filter-price-max').val(data.to).trigger('blur'); 55 }, 56 prettify: function (value) { 57 if (Journal['currency_left']) { 58 return accounting.formatMoney(value, Journal['currency_left'], 0, Journal['currency_thousand'], Journal['currency_decimal'], '%s%v'); 59 } 60 61 return accounting.formatMoney(value, Journal['currency_right'], 0, Journal['currency_thousand'], Journal['currency_decimal'], '%v%s'); 62 } 63 }); 64} 65 66function journal_filter(url, opts) { 67 opts = opts || {}; 68 69 var source = opts.source; 70 var updateHistory = opts.updateHistory; 71 72 try { 73 var u = new URL(url); 74 75 u.host = window.location.host; 76 u.hostname = window.location.hostname; 77 u.protocol = window.location.protocol; 78 79 url = u.toString(); 80 } catch (e) { 81 } 82 83 if (updateHistory !== false && window.history && window.history.pushState) { 84 var state = { Title: document.title, Url: url }; 85 86 window.history.pushState(state, state.Title, state.Url); 87 } 88 89 if (Journal.infiniteScrollInstance) { 90 Journal.infiniteScrollInstance.destroy(); 91 } 92 93 $.ajax({ 94 url: url, 95 dataType: 'html', 96 beforeSend: function () { 97 var $slider = $('.filter-price .range-slider input'); 98 99 if ($slider.length && $slider.data('ionRangeSlider')) { 100 $slider.data('ionRangeSlider').destroy(); 101 } 102 103 $('[data-toggle="tooltip"]').tooltip('hide'); 104 105 loader('.container > .row', true); 106 }, 107 complete: function () { 108 loader('.container > .row', false); 109 110 if (Journal['filterScrollTop'] || (source === 'pagination')) { 111 $('html, body').animate({ scrollTop: 0 }, 700); 112 } 113 }, 114 success: function (response) { 115 var $response = $(response); 116 117 Journal['filterCollapsed'] = {}; 118 119 $('.module-filter .module-item .panel-heading a').each(function () { 120 var $this = $(this); 121 Journal['filterCollapsed'][$this.data('filter')] = $this.hasClass('collapsed'); 122 }); 123 124 $('.module-filter').replaceWith($response.find('.module-filter')); 125 $('.main-products-wrapper').replaceWith($response.find('.main-products-wrapper')); 126 $('#input-sort, #input-limit').removeAttr('onchange'); 127 128 var $panel_group = $('.panel-group'); 129 130 $panel_group.on('show.bs.collapse', function (e) { 131 $(e.target).parent().addClass('panel-active'); 132 $(e.target).parent().removeClass('panel-collapsed'); 133 }); 134 135 $panel_group.on('hide.bs.collapse', function (e) { 136 $(e.target).parent().removeClass('panel-active'); 137 $(e.target).parent().addClass('panel-collapsing'); 138 }); 139 140 $panel_group.on('hidden.bs.collapse', function (e) { 141 $(e.target).parent().removeClass('panel-collapsing'); 142 $(e.target).parent().addClass('panel-collapsed'); 143 }); 144 145 Object.keys(Journal['filterCollapsed']).forEach(function (key) { 146 var $collapse = $($('.module-filter .module-item .panel-heading a[data-filter="' + key + '"]').attr('href')); 147 148 if (Journal['filterCollapsed'][key] === true) { 149 $collapse.collapse('hide'); 150 } 151 152 if (Journal['filterCollapsed'][key] === false) { 153 $collapse.collapse('show'); 154 } 155 }); 156
157 Journal.lazyLoadInstance && Journal.lazyLoadInstance.update(); 158 159 journal_filter_price_slider(); 160 journal_enable_stepper(); 161 journal_enable_countdown(); 162 163 if (Journal.infiniteScrollInstance) { 164 $('.ias-trigger').remove(); 165 setTimeout(function () { 166 Journal.infiniteScrollInstance.reinitialize(); 167 }, 100); 168 } 169 } 170 }); 171} 172 173jQuery(function ($) { 174 // price slider 175 journal_filter_price_slider(); 176 177 // handle price change 178 var old; 179 180 $(document).delegate('.filter-price-min, .filter-price-max', 'focus', function (e) { 181 old = e.target.value; 182 }); 183 184 $(document).delegate('.filter-price-min, .filter-price-max', 'blur keydown', function (e) { 185 if ((e.type === 'keydown' && e.keyCode === 13) || (e.type === 'focusout')) { 186 var value = e.target.value.trim(); 187 188 if ($.isNumeric(value) && (old !== value)) { 189 journal_filter(journal_filter_url()); 190 191 return false; 192 } 193 } 194 }); 195 196 // handle filters changes 197 $(document).delegate('[data-filter-trigger]', 'change', function () { 198 journal_filter(journal_filter_url()); 199 200 return false; 201 }); 202 203 // handle pagination changes 204 $(document).delegate('.pagination a', 'click', function () { 205 journal_filter($(this).attr('href'), { source: 'pagination' }); 206 207 return false; 208 }); 209 210 // handle sort and limit changes 211 $('#input-sort, #input-limit').removeAttr('onchange'); 212 213 $(document).delegate('#input-sort, #input-limit', 'change', function () { 214 journal_filter($(this).val()); 215 216 return false; 217 }); 218 219 // handle back button 220 $(window).on('popstate', function (e) { 221 // journal_filter(window.location.href, { updateHistory: false }); 222 window.location.reload(); 223 }); 224 225 // handle reset button 226 $(document).delegate('.reset-filter', 'click', function () { 227 journal_filter(Journal['filterBase']); 228 }); 229});
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.