PageSourceSearch

https://kaktus.ua/local/templates/kaktus/components/bitrix/catalog…/.default/script.js?163493462627973

js kaktus.ua collected 2026-10-02 12:25:31 UTC 27,973 bytes, 799 lines download raw bytes

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

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.