PageSourceSearch

https://bashinkom.ru/bitrix/cache/js/s1/bashinkom_library/page_aa0…d942cceac14485de21e2a_v1.js?178963499327120

js bashinkom.ru collected 2026-09-29 18:18:57 UTC 27,120 bytes, 752 lines download raw bytes

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

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.