PageSourceSearch

https://dana96.ru/bitrix/templates/aspro-allcorp2/components/bitri…/main_compact/script.js

js dana96.ru collected 2026-10-07 16:38:21 UTC 32,592 bytes, 1,157 lines download raw bytes

1$(document).ready(function(){
2	$(document).on('click', '.bx_filter.compact .bx_filter_parameters_box_title .delete_filter', function(){
3		var _this = $(this);
4		_this.closest('.bx_filter_parameters_box').find('input[type=text]').val('');
5		_this.closest('.bx_filter_parameters_box').removeClass('set');
6		_this.closest('.bx_filter_parameters_box').find('.pict label').removeClass('active');
7
8		var t = false;
9		_this.closest('.bx_filter_parameters_box').find('input').each(function(){
10			var __this = this;
11			$(__this).prop('checked', false);
12			if(t){
13				clearTimeout(t);
14			}
15			
16			t = setTimeout(function(){
17				smartFilter.reload(__this);
18			}, 100);
19		}).promise().done(function(){
20			setTimeout(function(){
21				_this.closest('form').find('.bx_filter_button_box.hidden .bx_filter_search_button').click();
22			}, 800);
23		});
24	});
25	
26	$(document).on('click', '.bx_filter.compact .bx_filter_block', function(e){
27		e.stopPropagation();
28	});
29				
30	$(".bx_filter_parameters_box_title:not(.prices)").click( function(e){
31		var target = e.target;
32		if(!$(e.target).hasClass('tooltip') && !$(e.target).hasClass('delete_filter') && !$(e.target).closest('.delete_filter').length){
33			e.stopPropagation();
34			if(!$(this).closest(".bx_filter_parameters_box").hasClass('active')){
35				$(".bx_filter_block:not(.limited_block)").slideUp(100);
36				$('.bx_filter_parameters_box').removeClass('active');
37			}
38			if ($(this).closest(".bx_filter_parameters_box").hasClass("active")) {
39				$(this).next(".bx_filter_block").slideUp(100);
40			}
41			else {
42				var _this = $(this);
43				setTimeout(function(){
44					var boxOffsetLeft =_this.next(".bx_filter_block").offset().left,
45						boxWidth = _this.next(".bx_filter_block").outerWidth(),
46						windowWidth = $(window).width();
47					
48					if(boxOffsetLeft + boxWidth > windowWidth){
49						_this.next(".bx_filter_block").addClass('right');
50					}
51					else{
52						_this.next(".bx_filter_block").removeClass('right');
53					}
54				}, 0);
55				_this.next(".bx_filter_block").slideDown(200);
56			}
57			$(this).closest(".bx_filter_parameters_box").toggleClass("active");
58		}
59	});
60	
61	$(document).on('click', '.bx_filter_block .bx_filter_button_box .btn', function(){
62		$(this).closest('form').find('.bx_filter_search_button').click();
63	});
64	
65	$(document).on('click', function(){
66		$(".bx_filter_block:not(.limited_block)").slideUp(100);
67		$('.bx_filter_parameters_box').removeClass('active');
68	});
69	/*$('.bx_filter_parameters_box').each(function(){
70		if($.cookie("NEXT_filter_prop_"+$(this).data('prop_code'))==2){
71			$(this).removeClass('active');
72			$(this).find('.bx_filter_block').hide();
73		}else if($.cookie("NEXT_filter_prop_"+$(this).data('prop_code'))==3){
74			$(this).addClass('active');
75			$(this).find('.bx_filter_block').show();
76		}
77	})*/
78	
79	$(".hint .icon").click(function(e){
80		e.stopPropagation();
81		var tooltipWrapp = $(this).parents(".hint");
82		var bActive = tooltipWrapp.is('.active');
83		$('.bx_filter .hint.active').removeClass("active").find(".tooltip").slideUp(200);
84		if(!bActive){
85			tooltipWrapp.addClass("active").find(".tooltip").slideDown(200);
86			tooltipWrapp.find(".tooltip_close").click(function(e) { e.stopPropagation(); tooltipWrapp.removeClass("active").find(".tooltip").slideUp(200);});
87		}
88	});
89	$(document).click(function(e) {
90		if(!$(e.target).hasClass('tooltip')){
91			$('.bx_filter .hint.active').removeClass("active").find(".tooltip").slideUp(200);
92		}
93	});
94	$(document).on('click', '.expand_block', function(){
95		$('.hidden_values').css({"display":"block"});
96		$('.expand_block').css({"display":"none"});
97	});
98})
99
100function JCSmartFilter(ajaxURL, viewMode, params)
101{
102	this.ajaxURL = ajaxURL;
103	this.form = null;
104	this.timer = null;
105	this.cacheKey = '';
106	this.cache = [];
107	this.viewMode = viewMode;
108
109	if (params && params.SEF_SET_FILTER_URL)
110	{
111		this.bindUrlToButton('set_filter', params.SEF_SET_FILTER_URL);
112		this.sef = true;
113	}
114	if (params && params.SEF_DEL_FILTER_URL)
115	{
116		this.bindUrlToButton('del_filter', params.SEF_DEL_FILTER_URL);
117	}
118}
119
120JCSmartFilter.prototype.keyup = function(input)
121{
122	if(!!this.timer)
123	{
124		clearTimeout(this.timer);
125	}
126	if(!$(input).hasClass('disabled')){
127		this.timer = setTimeout(BX.delegate(function(){
128			this.reload(input);
129		}, this), 500);
130	}
131};
132
133JCSmartFilter.prototype.click = function(checkbox)
134{
135	if(!!this.timer)
136	{
137		clearTimeout(this.timer);
138	}
139	this.timer = setTimeout(BX.delegate(function(){
140		this.reload(checkbox);
141	}, this), 500);
142};
143
144JCSmartFilter.prototype.deleteProperty = function(input){
145	
146}
147
148JCSmartFilter.prototype.reload = function(input)
149{
150	var inStockCheck = ($(input).closest('.bx_filter_parameters_box').data('prop_code') == 'in_stock' ? true : false);
151
152	if (typeof(this.cacheKey) !== 'undefined' && this.cacheKey !== '')
153	{
154		//Postprone backend query
155		if(!!this.timer)
156		{
157			clearTimeout(this.timer);
158		}
159		this.timer = setTimeout(BX.delegate(function(){
160			this.reload(input);
161		}, this), 1000);
162		return;
163	}
164	this.cacheKey = '|';
165
166	var isSelecBox  = false;
167	isSelecBox = $(input).closest('.bx_filter_select_container').length;
168
169	this.position_input = 0;
170
171	this.label_input = $('label[data-role=label_'+$(input).attr('id').replace("all_", "")+']');
172	if(isSelecBox)
173	{
174		this.label_input = $(input).closest('.bx_filter_select_container');
175	}
176	if(this.label_input.length)
177	{
178		this.position_input = this.label_input.offset().top - this.label_input.height() / 2;
179		if(this.label_input.hasClass('nab')){
180			this.position_input += 7;
181		}
182		if(isSelecBox)
183		{
184			this.position_input += 10;
185		}
186	}
187
188	this.position = BX.pos(input, true);
189	this.form = BX.findParent(input, {'tag':'form'});
190	
191	if (this.form)
192	{
193		var values = [];
194		values[0] = {name: 'ajax', value: 'y'};
195		this.gatherInputsValues(values, BX.findChildren(this.form, {'tag': new RegExp('^(input|select)$', 'i')}, true));
196		
197		$('.bx_filter_parameters_box').removeClass('set');
198
199		for (var i = 0; i < values.length; i++){
200			this.cacheKey += values[i].name + ':' + values[i].value + '|';
201			$('input[name='+values[i].name+']').closest('.bx_filter_parameters_box').addClass('set');
202		}
203		
204		if (this.cache && this.cache[this.cacheKey])
205		{
206			this.curFilterinput = input;
207			this.postHandler(this.cache[this.cacheKey], true);
208		}
209		else
210		{
211			if (this.sef)
212			{
213				var set_filter = BX('set_filter');
214				//set_filter.disabled = true;
215			}
216
217			this.curFilterinput = input;
218			BX.ajax.loadJSON(
219				this.ajaxURL,
220				this.values2post(values),
221				BX.delegate(this.postHandler, this)
222			);
223		}
224	}
225		
226	if(window.matchMedia('(min-width: 768px)').matches && inStockCheck){
227		setTimeout(function(){
228			$('.bx_filter .bx_filter_button_box.hidden .bx_filter_search_button').click();
229		}, 500);
230	}
231	
232	var i = 0;
233	$(input).closest('.bx_filter_block').find('input[type=checkbox], input[type=radio]').each(function(){
234		if($(this).prop('checked') === true){
235			++i;
236		}
237	}).promise().done(function(){
238		if(i != 0){
239			$(input).closest('.bx_filter_parameters_box').find('.bx_filter_parameters_box_title .count_selected').text(': '+i);
240		}
241		else{
242			$(input).closest('.bx_filter_parameters_box').find('.bx_filter_parameters_box_title .count_selected').text('');
243		}
244	});
245};
246
247JCSmartFilter.prototype.updateItem = function (PID, arItem)
248{
249	if (arItem.PROPERTY_TYPE === 'N' || arItem.PRICE)
250	{
251		var trackBar = window['trackBar' + PID];
252		if (!trackBar && arItem.ENCODED_ID)
253			trackBar = window['trackBar' + arItem.ENCODED_ID];
254
255		if (trackBar && arItem.VALUES)
256		{
257			if (arItem.VALUES.MIN)
258			{
259				if (arItem.VALUES.MIN.FILTERED_VALUE)
260					trackBar.setMinFilteredValue(arItem.VALUES.MIN.FILTERED_VALUE);
261				else
262					trackBar.setMinFilteredValue(arItem.VALUES.MIN.VALUE);
263			}
264
265			if (arItem.VALUES.MAX)
266			{
267				if (arItem.VALUES.MAX.FILTERED_VALUE)
268					trackBar.setMaxFilteredValue(arItem.VALUES.MAX.FILTERED_VALUE);
269				else
270					trackBar.setMaxFilteredValue(arItem.VALUES.MAX.VALUE);
271			}
272		}
273	}
274	else if (arItem.VALUES)
275	{
276		for (var i in arItem.VALUES)
277		{
278			if (arItem.VALUES.hasOwnProperty(i))
279			{
280				var value = arItem.VALUES[i];
281				var control = BX(value.CONTROL_ID);
282
283				if (!!control)
284				{
285					var label = document.querySelector('[data-role="label_'+value.CONTROL_ID+'"]');
286						input = document.querySelector('[id="'+value.CONTROL_ID+'"]');
287					if (value.DISABLED)
288					{
289						if (label){
290							BX.addClass(label, 'disabled');
291							if(input){
292								input.setAttribute('disabled','disabled');
293								BX.addClass(input, 'disabled');
294							}
295						}else{
296							BX.addClass(control.parentNode, 'disabled');
297						}
298
299
300					}
301					else
302					{
303						if (label){
304							BX.removeClass(label, 'disabled');
305							if(input){
306								input.removeAttribute('disabled');
307								BX.removeClass(input, 'disabled');
308							}
309						}else
310							BX.removeClass(control.parentNode, 'disabled');
311					}
312
313					if (value.hasOwnProperty('ELEMENT_COUNT'))
314					{
315						label = document.querySelector('[data-role="count_'+value.CONTROL_ID+'"]');
316						if (label)
317							label.innerHTML = value.ELEMENT_COUNT;
318					}
319				}
320			}
321		}
322	}
323};
324
325JCSmartFilter.prototype.postHandler = function (result, fromCache)
326{
327	var hrefFILTER, url, curProp;
328	var modef = BX('modef');
329	var modef_mobile = BX('modef_mobile');
330	var modef_num = BX('modef_num');
331	var modef_num_mobile = BX('modef_num_mobile');
332
333	if (!!result && !!result.ITEMS)
334	{
335		for(var PID in result.ITEMS)
336		{
337			if (result.ITEMS.hasOwnProperty(PID))
338			{
339				this.updateItem(PID, result.ITEMS[PID]);
340			}
341		}
342
343		if (!!modef && !!modef_num)
344		{
345			if(this.position_input)
346				$('#modef').css({'top':this.position_input - $(".smartfilter").offset().top})
347			else
348				$('#modef').css({'top':'auto'})
349
350			modef_num.innerHTML = result.ELEMENT_COUNT;
351			$('.bx_filter.compact .bx_filter_button_box .bx_filter_container_modef').html(BX.message('SELECTED')+result.ELEMENT_COUNT);
352			$('.bx_filter.compact .bx_filter_button_box').show();
353			modef_num_mobile.innerHTML = result.ELEMENT_COUNT;
354			hrefFILTER = BX.findChildren(modef, {tag: 'A'}, true);
355			hrefFILTER_mobile = BX.findChildren(modef_mobile, {tag: 'A'}, true);
356
357			if (result.FILTER_URL && hrefFILTER)
358			{
359				hrefFILTER[0].href = BX.util.htmlspecialcharsback(result.FILTER_URL.replace('/filter/clear/apply/', '/'));
360				hrefFILTER_mobile[0].href = BX.util.htmlspecialcharsback(result.FILTER_URL.replace('/filter/clear/apply/', '/'));
361			}
362
363			if (result.FILTER_AJAX_URL && result.COMPONENT_CONTAINER_ID)
364			{
365				BX.unbindAll(hrefFILTER[0]);
366				BX.unbindAll(hrefFILTER_mobile[0]);
367				BX.bind(hrefFILTER[0], 'click', function(e)
368				{
369					url = BX.util.htmlspecialcharsback(result.FILTER_AJAX_URL);
370					BX.ajax.insertToNode(url, result.COMPONENT_CONTAINER_ID);
371					return BX.PreventDefault(e);
372				});
373			}
374
375			if (result.INSTANT_RELOAD && result.COMPONENT_CONTAINER_ID)
376			{
377				url = BX.util.htmlspecialcharsback(result.FILTER_AJAX_URL);
378				BX.ajax.insertToNode(url, result.COMPONENT_CONTAINER_ID);
379			}
380			else
381			{
382				if (modef.style.display === 'none')
383				{
384					modef.style.display = 'inline-block';
385					modef_mobile.style.display = 'inline-block';
386				}
387				if (this.viewMode == "vertical")
388			{
389					curProp = BX.findChild(BX.findParent(this.curFilterinput, {'class':'bx_filter_parameters_box'}), {'class':'bx_filter_container_modef'}, true, false);
390					curProp.appendChild(modef);
391				}
392
393				if (result.SEF_SET_FILTER_URL)
394				{
395					this.bindUrlToButton('set_filter', result.SEF_SET_FILTER_URL);
396				}
397			}
398		}
399	}
400
401	if (this.sef)
402	{
403		var set_filter = BX('set_filter');
404		set_filter.disabled = false;
405	}
406
407	if (!fromCache && this.cacheKey !== '')
408	{
409		this.cache[this.cacheKey] = result;
410	}
411	this.cacheKey = '';
412};
413
414JCSmartFilter.prototype.bindUrlToButton = function (buttonId, url)
415{
416	var button = BX(buttonId);
417
418	if (button)
419	{
420		var proxy = function(j, func)
421		{
422			return function()
423			{
424				return func(j);
425			}
426		};
427
428		if (button.type == 'submit')
429			button.type = 'button';
430
431		BX.bind(button, 'click', proxy(url, function(url)
432		{
433			window.location.href = url;
434			return false;
435		}));
436	}
437};
438
439JCSmartFilter.prototype.gatherInputsValues = function (values, elements)
440{
441	if(elements)
442	{
443		for(var i = 0; i < elements.length; i++)
444		{
445			var el = elements[i];
446			if (!el.type)
447				continue;
448
449			switch(el.type.toLowerCase())
450			{
451				case 'text':
452				case 'textarea':
453				case 'password':
454				case 'hidden':
455				case 'select-one':
456					if(el.value.length)
457						values[values.length] = {name : el.name, value : el.value};
458					break;
459				case 'radio':
460				case 'checkbox':
461					if(el.checked)
462						values[values.length] = {name : el.name, value : el.value};
463					break;
464				case 'select-multiple':
465					for (var j = 0; j < el.options.length; j++)
466					{
467						if (el.options[j].selected)
468							values[values.length] = {name : el.name, value : el.options[j].value};
469					}
470					break;
471				default:
472					break;
473			}
474		}
475	}
476};
477
478JCSmartFilter.prototype.values2post = function (values)
479{
480	var post = [];
481	var current = post;
482	var i = 0;
483
484	while(i < values.length)
485	{
486		var p = values[i].name.indexOf('[');
487		if(p == -1)
488		{
489			current[values[i].name] = values[i].value;
490			current = post;
491			i++;
492		}
493		else
494		{
495			var name = values[i].name.substring(0, p);
496			var rest = values[i].name.substring(p+1);
497
498			if(!current[name])
499				current[name] = [];
500
501			var pp = rest.indexOf(']');
502			if(pp == -1)
503			{
504				//Error - not balanced brackets
505				current = post;
506				i++;
507			}
508			else if(pp == 0)
509			{
510				//No index specified - so take the next integer
511				current = current[name];
512				values[i].name = '' + current.length;
513			}
514			else
515			{
516				//Now index name becomes and name and we go deeper into the array
517				current = current[name];
518				values[i].name = rest.substring(0, pp) + rest.substring(pp+1);
519			}
520		}
521	}
522	
523	return post;
524};
525
526JCSmartFilter.prototype.hideFilterProps = function(element)
527{
528	var obj = element.parentNode,
529		filterBlock = obj.querySelector("[data-role='bx_filter_block']"),
530		propAngle = obj.querySelector("[data-role='prop_angle']");
531
532	if(BX.hasClass(obj, "bx-active"))
533	{
534		new BX.easing({
535			duration : 300,
536			start : { opacity: 1,  height: filterBlock.offsetHeight },
537			finish : { opacity: 0, height:0 },
538			transition : BX.easing.transitions.quart,
539			step : function(state){
540				filterBlock.style.opacity = state.opacity;
541				filterBlock.style.height = state.height + "px";
542			},
543			complete : function() {
544				filterBlock.setAttribute("style", "");
545				BX.removeClass(obj, "bx-active");
546			}
547		}).animate();
548
549		BX.addClass(propAngle, "fa-angle-down");
550		BX.removeClass(propAngle, "fa-angle-up");
551	}
552	else
553	{
554		filterBlock.style.display = "block";
555		filterBlock.style.opacity = 0;
556		filterBlock.style.height = "auto";
557
558		var obj_children_height = filterBlock.offsetHeight;
559		filterBlock.style.height = 0;
560
561		new BX.easing({
562			duration : 300,
563			start : { opacity: 0,  height: 0 },
564			finish : { opacity: 1, height: obj_children_height },
565			transition : BX.easing.transitions.quart,
566			step : function(state){
567				filterBlock.style.opacity = state.opacity;
568				filterBlock.style.height = state.height + "px";
569			},
570			complete : function() {
571			}
572		}).animate();
573
574		BX.addClass(obj, "bx-active");
575		BX.removeClass(propAngle, "fa-angle-down");
576		BX.addClass(propAngle, "fa-angle-up");
577	}
578};
579
580JCSmartFilter.prototype.showDropDownPopup = function(element, popupId)
581{
582	var contentNode = element.querySelector('[data-role="dropdownContent"]'),
583		offset=$(element).offset();
584	BX.PopupWindowManager.create("smartFilterDropDown"+popupId, element, {
585		autoHide: true,
586		offsetLeft: 0,
587		offsetTop: 0,
588		overlay : false,
589		draggable: {restrict:true},
590		closeByEsc: true,
591		content: contentNode
592	}).show();
593	$("#smartFilterDropDown"+popupId).css({'top':offset.top+30, 'left':offset.left});
594};
595
596JCSmartFilter.prototype.selectDropDownItem = function(element, controlId)
597{
598	if(!BX.hasClass(element,'disabled')){
599		this.keyup(BX(controlId));
600
601		var wrapContainer = BX.findParent(BX(controlId), {className:"bx_filter_select_container"}, false);
602
603		var currentOption = wrapContainer.querySelector('[data-role="currentOption"]');
604
605		currentOption.innerHTML = element.innerHTML;
606		$(element).closest('.bx_filter_select_popup').find('label').removeClass('selected');
607		BX.addClass(element, "selected");
608		BX.PopupWindowManager.getCurrentPopup().close();
609	}
610};
611
612BX.namespace("BX.Iblock.SmartFilter");
613BX.Iblock.SmartFilter = (function()
614{
615	var SmartFilter = function(arParams)
616	{
617		if (typeof arParams === 'object')
618		{
619			this.leftSlider = BX(arParams.leftSlider);
620			this.rightSlider = BX(arParams.rightSlider);
621			this.tracker = BX(arParams.tracker);
622			this.trackerWrap = BX(arParams.trackerWrap);
623
624			this.minInput = BX(arParams.minInputId);
625			this.maxInput = BX(arParams.maxInputId);
626
627			this.minPrice = parseFloat(arParams.minPrice);
628			this.maxPrice = parseFloat(arParams.maxPrice);
629
630			this.curMinPrice = parseFloat(arParams.curMinPrice);
631			this.curMaxPrice = parseFloat(arParams.curMaxPrice);
632
633			this.fltMinPrice = arParams.fltMinPrice ? parseFloat(arParams.fltMinPrice) : parseFloat(arParams.curMinPrice);
634			this.fltMaxPrice = arParams.fltMaxPrice ? parseFloat(arParams.fltMaxPrice) : parseFloat(arParams.curMaxPrice);
635
636			this.precision = arParams.precision || 0;
637
638			this.priceDiff = this.maxPrice - this.minPrice;
639
640			this.leftPercent = arParams.leftPercent ? parseFloat(arParams.leftPercent) : 0;
641			this.rightPercent = arParams.rightPercent ? parseFloat(arParams.rightPercent) : 0;
642
643			this.fltMinPercent = 0;
644			this.fltMaxPercent = 0;
645
646			this.colorUnavailableActive = BX(arParams.colorUnavailableActive);//gray
647			this.colorAvailableActive = BX(arParams.colorAvailableActive);//blue
648			this.colorAvailableInactive = BX(arParams.colorAvailableInactive);//light blue
649
650			this.isTouch = false;
651
652			this.init();
653
654			if ('ontouchstart' in document.documentElement || 'ontouchstart' in window)
655			{
656				this.isTouch = true;
657
658				BX.bind(this.leftSlider, "touchstart", BX.proxy(function(event){
659					this.onMoveLeftSlider(event)
660				}, this));
661
662				BX.bind(this.rightSlider, "touchstart", BX.proxy(function(event){
663					this.onMoveRightSlider(event)
664				}, this));
665
666				BX.bind(this.colorAvailableActive, "touchstart", BX.proxy(function(event){
667					this.onChangeLeftSlider(event);
668				}, this));
669
670				BX.bind(this.colorUnavailableActive, "touchstart", BX.proxy(function(event){
671					this.onChangeLeftSlider(event);
672				}, this));
673
674				BX.bind(this.colorAvailableInactive, "touchstart", BX.proxy(function(event){
675					this.onChangeLeftSlider(event);
676				}, this));
677			}
678			else
679			{
680				BX.bind(this.leftSlider, "mousedown", BX.proxy(function(event){
681					this.onMoveLeftSlider(event)
682				}, this));
683
684				BX.bind(this.rightSlider, "mousedown", BX.proxy(function(event){
685					this.onMoveRightSlider(event)
686				}, this));
687
688				BX.bind(this.colorAvailableActive, "mousedown", BX.proxy(function(event){
689					this.onChangeLeftSlider(event);
690				}, this));
691
692				BX.bind(this.colorUnavailableActive, "mousedown", BX.proxy(function(event){
693					this.onChangeLeftSlider(event);
694				}, this));
695
696				BX.bind(this.colorAvailableInactive, "mousedown", BX.proxy(function(event){
697					this.onChangeLeftSlider(event);
698				}, this));
699			}
700
701			BX.bind(this.minInput, "keyup", BX.proxy(function(event){
702				this.onInputChange();
703			}, this));
704
705			BX.bind(this.maxInput, "keyup", BX.proxy(function(event){
706				this.onInputChange();
707			}, this));
708		}
709	};
710
711	SmartFilter.prototype.init = function()
712	{
713		var priceDiff;
714
715		if (this.curMinPrice > this.minPrice)
716		{
717			priceDiff = this.curMinPrice - this.minPrice;
718			this.leftPercent = (priceDiff*100)/this.priceDiff;
719
720			this.leftSlider.style.left = this.leftPercent + "%";
721			this.colorUnavailableActive.style.left = this.leftPercent + "%";
722		}
723
724		this.setMinFilteredValue(this.fltMinPrice);
725
726		if (this.curMaxPrice < this.maxPrice)
727		{
728			priceDiff = this.maxPrice - this.curMaxPrice;
729			this.rightPercent = (priceDiff*100)/this.priceDiff;
730
731			this.rightSlider.style.right = this.rightPercent + "%";
732			this.colorUnavailableActive.style.right = this.rightPercent + "%";
733		}
734
735		this.setMaxFilteredValue(this.fltMaxPrice);
736	};
737
738	SmartFilter.prototype.setMinFilteredValue = function (fltMinPrice)
739	{
740		this.fltMinPrice = parseFloat(fltMinPrice);
741		if (this.fltMinPrice >= this.minPrice)
742		{
743			var priceDiff = this.fltMinPrice - this.minPrice;
744			this.fltMinPercent = (priceDiff*100)/this.priceDiff;
745
746			if (this.leftPercent > this.fltMinPercent)
747				this.colorAvailableActive.style.left = this.leftPercent + "%";
748			else
749				this.colorAvailableActive.style.left = this.fltMinPercent + "%";
750
751			this.colorAvailableInactive.style.left = this.fltMinPercent + "%";
752		}
753		else
754		{
755			this.colorAvailableActive.style.left = "0%";
756			this.colorAvailableInactive.style.left = "0%";
757		}
758	};
759
760	SmartFilter.prototype.setMaxFilteredValue = function (fltMaxPrice)
761	{
762		this.fltMaxPrice = parseFloat(fltMaxPrice);
763		if (this.fltMaxPrice <= this.maxPrice)
764		{
765			var priceDiff = this.maxPrice - this.fltMaxPrice;
766			this.fltMaxPercent = (priceDiff*100)/this.priceDiff;
767
768			if (this.rightPercent > this.fltMaxPercent)
769				this.colorAvailableActive.style.right = this.rightPercent + "%";
770			else
771				this.colorAvailableActive.style.right = this.fltMaxPercent + "%";
772
773			this.colorAvailableInactive.style.right = this.fltMaxPercent + "%";
774		}
775		else
776		{
777			this.colorAvailableActive.style.right = "0%";
778			this.colorAvailableInactive.style.right = "0%";
779		}
780	};
781
782	SmartFilter.prototype.getXCoord = function(elem)
783	{
784		var box = elem.getBoundingClientRect();
785		var body = document.body;
786		var docElem = document.documentElement;
787
788		var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft;
789		var clientLeft = docElem.clientLeft || body.clientLeft || 0;
790		var left = box.left + scrollLeft - clientLeft;
791
792		return Math.round(left);
793	};
794
795	SmartFilter.prototype.getPageX = function(e)
796	{
797		e = e || window.event;
798		var pageX = null;
799
800		if (this.isTouch && e.targetTouches[0] != null)
801		{
802			pageX = e.targetTouches[0].pageX;
803		}
804		else if (e.pageX != null)
805		{
806			pageX = e.pageX;
807		}
808		else if (e.clientX != null)
809		{
810			var html = document.documentElement;
811			var body = document.body;
812
813			pageX = e.clientX + (html.scrollLeft || body && body.scrollLeft || 0);
814			pageX -= html.clientLeft || 0;
815		}
816
817		return pageX;
818	};
819
820	SmartFilter.prototype.recountMinPrice = function()
821	{
822		var newMinPrice = (this.priceDiff*this.leftPercent)/100;
823		newMinPrice = (this.minPrice + newMinPrice).toFixed(this.precision);
824
825		if (newMinPrice != this.minPrice)
826			this.minInput.value = newMinPrice;
827		else
828			this.minInput.value = "";
829		smartFilter.keyup(this.minInput);
830	};
831
832	SmartFilter.prototype.recountMaxPrice = function()
833	{
834		var newMaxPrice = (this.priceDiff*this.rightPercent)/100;
835		newMaxPrice = (this.maxPrice - newMaxPrice).toFixed(this.precision);
836
837		if (newMaxPrice != this.maxPrice)
838			this.maxInput.value = newMaxPrice;
839		else
840			this.maxInput.value = "";
841		smartFilter.keyup(this.maxInput);
842	};
843
844	SmartFilter.prototype.onInputChange = function ()
845	{
846		var priceDiff;
847		if (this.minInput.value)
848		{
849			var leftInputValue = this.minInput.value;
850			if (leftInputValue < this.minPrice)
851				leftInputValue = this.minPrice;
852
853			if (leftInputValue > this.maxPrice)
854				leftInputValue = this.maxPrice;
855
856			priceDiff = leftInputValue - this.minPrice;
857			this.leftPercent = (priceDiff*100)/this.priceDiff;
858
859			this.makeLeftSliderMove(false);
860		}
861
862		if (this.maxInput.value)
863		{
864			var rightInputValue = this.maxInput.value;
865			if (rightInputValue < this.minPrice)
866				rightInputValue = this.minPrice;
867
868			if (rightInputValue > this.maxPrice)
869				rightInputValue = this.maxPrice;
870
871			priceDiff = this.maxPrice - rightInputValue;
872			this.rightPercent = (priceDiff*100)/this.priceDiff;
873
874			this.makeRightSliderMove(false);
875		}
876	};
877
878	SmartFilter.prototype.makeLeftSliderMove = function(recountPrice)
879	{
880		recountPrice = (recountPrice !== false);
881
882		this.leftSlider.style.left = this.leftPercent + "%";
883		this.colorUnavailableActive.style.left = this.leftPercent + "%";
884
885		var areBothSlidersMoving = false;
886		if (this.leftPercent + this.rightPercent >= 100)
887		{
888			areBothSlidersMoving = true;
889			this.rightPercent = 100 - this.leftPercent;
890			this.rightSlider.style.right = this.rightPercent + "%";
891			this.colorUnavailableActive.style.right = this.rightPercent + "%";
892		}
893
894		if (this.leftPercent >= this.fltMinPercent && this.leftPercent <= (100-this.fltMaxPercent))
895		{
896			this.colorAvailableActive.style.left = this.leftPercent + "%";
897			if (areBothSlidersMoving)
898			{
899				this.colorAvailableActive.style.right = 100 - this.leftPercent + "%";
900			}
901		}
902		else if(this.leftPercent <= this.fltMinPercent)
903		{
904			this.colorAvailableActive.style.left = this.fltMinPercent + "%";
905			if (areBothSlidersMoving)
906			{
907				this.colorAvailableActive.style.right = 100 - this.fltMinPercent + "%";
908			}
909		}
910		else if(this.leftPercent >= this.fltMaxPercent)
911		{
912			this.colorAvailableActive.style.left = 100-this.fltMaxPercent + "%";
913			if (areBothSlidersMoving)
914			{
915				this.colorAvailableActive.style.right = this.fltMaxPercent + "%";
916			}
917		}
918
919		if (recountPrice)
920		{
921			this.recountMinPrice();
922			if (areBothSlidersMoving)
923				this.recountMaxPrice();
924		}
925	};
926
927	SmartFilter.prototype.countNewLeft = function(event)
928	{
929		var pageX = this.getPageX(event);
930
931		var trackerXCoord = this.getXCoord(this.trackerWrap);
932		var rightEdge = this.trackerWrap.offsetWidth;
933
934		var newLeft = pageX - trackerXCoord;
935
936		if (newLeft < 0)
937			newLeft = 0;
938		else if (newLeft > rightEdge)
939			newLeft = rightEdge;
940
941		return newLeft;
942	};
943
944	SmartFilter.prototype.onMoveLeftSlider = function(e)
945	{
946		if (!this.isTouch)
947		{
948			this.leftSlider.ondragstart = function() {
949				return false;
950			};
951		}
952		
953		$('.bx_filter .bx_filter_parameters_box_container input').prop('disabled', false);
954
955		if (!this.isTouch)
956		{
957			document.onmousemove = BX.proxy(function(event) {
958				this.leftPercent = ((this.countNewLeft(event)*100)/this.trackerWrap.offsetWidth);
959				this.makeLeftSliderMove();
960			}, this);
961
962			document.onmouseup = function() {
963				document.onmousemove = document.onmouseup = null;
964			};
965		}
966		else
967		{
968			var onMoveFunction = BX.proxy(function(event) {
969				this.leftPercent = ((this.countNewLeft(event)*100)/this.trackerWrap.offsetWidth);
970				this.makeLeftSliderMove();
971			}, this);
972
973			var onEndFunction = BX.proxy(function(event) {
974				window.removeEventListener('touchmove', onMoveFunction, false);
975				window.removeEventListener('touchend', onEndFunction, false);
976				onMoveFunction = onEndFunction = null;
977			}, this);
978
979			window.addEventListener('touchmove', onMoveFunction, false);
980			window.addEventListener('touchend', onEndFunction, false);
981
982			/*document.ontouchmove = BX.proxy(function(event) {
983				this.leftPercent = ((this.countNewLeft(event)*100)/this.trackerWrap.offsetWidth);
984				this.makeLeftSliderMove();
985			}, this);
986
987			document.ontouchend = function() {
988				document.ontouchmove = document.touchend = null;
989			};*/
990		}
991
992		return false;
993	};
994
995	SmartFilter.prototype.makeRightSliderMove = function(recountPrice)
996	{
997		recountPrice = (recountPrice !== false);
998
999		this.rightSlider.style.right = this.rightPercent + "%";
1000		this.colorUnavailableActive.style.right = this.rightPercent + "%";
1001
1002		var areBothSlidersMoving = false;
1003		if (this.leftPercent + this.rightPercent >= 100)
1004		{
1005			areBothSlidersMoving = true;
1006			this.leftPercent = 100 - this.rightPercent;
1007			this.leftSlider.style.left = this.leftPercent + "%";
1008			this.colorUnavailableActive.style.left = this.leftPercent + "%";
1009		}
1010
1011		if ((100-this.rightPercent) >= this.fltMinPercent && this.rightPercent >= this.fltMaxPercent)
1012		{
1013			this.colorAvailableActive.style.right = this.rightPercent + "%";
1014			if (areBothSlidersMoving)
1015			{
1016				this.colorAvailableActive.style.left = 100 - this.rightPercent + "%";
1017			}
1018		}
1019		else if(this.rightPercent <= this.fltMaxPercent)
1020		{
1021			this.colorAvailableActive.style.right = this.fltMaxPercent + "%";
1022			if (areBothSlidersMoving)
1023			{
1024				this.colorAvailableActive.style.left = 100 - this.fltMaxPercent + "%";
1025			}
1026		}
1027		else if((100-this.rightPercent) <= this.fltMinPercent)
1028		{
1029			this.colorAvailableActive.style.right = 100-this.fltMinPercent + "%";
1030			if (areBothSlidersMoving)
1031			{
1032				this.colorAvailableActive.style.left = this.fltMinPercent + "%";
1033			}
1034		}
1035
1036		if (recountPrice)
1037		{
1038			this.recountMaxPrice();
1039			if (areBothSlidersMoving)
1040				this.recountMinPrice();
1041		}
1042	};
1043
1044	SmartFilter.prototype.onMoveRightSlider = function(e)
1045	{
1046		if (!this.isTouch)
1047		{
1048			this.rightSlider.ondragstart = function() {
1049				return false;
1050			};
1051		}
1052		
1053		$('.bx_filter .bx_filter_parameters_box_container input').prop('disabled', false);
1054
1055		if (!this.isTouch)
1056		{
1057			document.onmousemove = BX.proxy(function(event) {
1058				this.rightPercent = 100-(((this.countNewLeft(event))*100)/(this.trackerWrap.offsetWidth));
1059				this.makeRightSliderMove();
1060			}, this);
1061
1062			document.onmouseup = function() {
1063				document.onmousemove = document.onmouseup = null;
1064			};
1065		}
1066		else
1067		{
1068			var onMoveFunction = BX.proxy(function(event) {
1069				this.rightPercent = 100-(((this.countNewLeft(event))*100)/(this.trackerWrap.offsetWidth));
1070				this.makeRightSliderMove();
1071			}, this);
1072
1073			var onEndFunction = BX.proxy(function(event) {
1074				window.removeEventListener('touchmove', onMoveFunction, false);
1075				window.removeEventListener('touchend', onEndFunction, false);
1076				onMoveFunction = onEndFunction = null;
1077			}, this);
1078
1079			window.addEventListener('touchmove', onMoveFunction, false);
1080			window.addEventListener('touchend', onEndFunction, false);
1081
1082			/*document.ontouchmove = BX.proxy(function(event) {
1083				this.rightPercent = 100-(((this.countNewLeft(event))*100)/(this.trackerWrap.offsetWidth));
1084				this.makeRightSliderMove();
1085			}, this);
1086
1087			document.ontouchend = function() {
1088				document.ontouchmove = document.ontouchend = null;
1089			};*/
1090		}
1091
1092		return false;
1093	};
1094
1095	SmartFilter.prototype.onChangeLeftSlider = function(e)
1096	{
1097		if (!this.isTouch)
1098		{
1099			this.leftSlider.ondragstart = function() {
1100				//return false;
1101			};
1102		}
1103		if (!this.isTouch)
1104		{
1105			// document.onmousedown = BX.proxy(function(event) {
1106				var percent=((this.countNewLeft(event)*100)/this.trackerWrap.offsetWidth);
1107				if($(event.target).is(".bx_ui_slider_handle") || !$(event.target).is("[class^=bx_ui_slider]"))
1108					return;
1109				if(percent<50){
1110					this.leftPercent = percent+1;
1111					this.makeLeftSliderMove();
1112				}else{
1113					this.rightPercent = 100-percent;
1114					this.makeRightSliderMove();
1115				}
1116			// }, this);
1117
1118			document.onmouseup = function() {
1119				document.onmousemove = document.onmouseup = null;
1120			};
1121		}
1122		else
1123		{
1124			var percent=((this.countNewLeft(e)*100)/this.trackerWrap.offsetWidth);
1125			if($(e.target).is(".bx_ui_slider_handle"))
1126				return;
1127			if(percent<50){
1128				this.leftPercent = percent;
1129				this.makeLeftSliderMove();
1130			}else{
1131				this.rightPercent = 100-percent;
1132				this.makeRightSliderMove();
1133			}
1134
1135			/*document.ontouchend = BX.proxy(function(event) {
1136				var percent=((this.countNewLeft(event)*100)/this.trackerWrap.offsetWidth);
1137				if($(event.target).is(".bx_ui_slider_handle"))
1138					return;
1139				if(percent<50){
1140					this.leftPercent = percent;
1141					this.makeLeftSliderMove();
1142				}else{
1143					this.rightPercent = 100-percent;
1144					this.makeRightSliderMove();
1145				}
1146			}, this);
1147
1148			document.ontouchend = function() {
1149				document.ontouchmove = document.touchend = null;
1150			};*/
1151		}
1152
1153		return false;
1154	};
1155
1156	return SmartFilter;
1157})();

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.