PageSourceSearch

https://timeleasing.ru/local/templates/main/components/airws/news/…/bitrix/catalog.smart.filter/news/script.js

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

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.