PageSourceSearch

https://a-spt.ru/bitrix/cache/js/s1/main/page_df7fd9bdfb1b742a4763…b742a4763c31622696ccd_v1.js?179025630929496

js a-spt.ru collected 2026-09-30 05:32:24 UTC 29,496 bytes, 811 lines download raw bytes

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

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.