PageSourceSearch

https://tts-kazan.ru/bitrix/templates/aspro-allcorp2/components/bi…/catalog_custom/script.js

js tts-kazan.ru collected 2026-10-07 04:10:48 UTC 26,814 bytes, 1,044 lines download raw bytes

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

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.