PageSourceSearch

https://helenshop.ru/local/templates/aspro_max/components/bitrix/c…/main_compact_ajax/script.js

js helenshop.ru collected 2026-10-07 17:44:46 UTC 41,406 bytes, 1,266 lines download raw bytes

1// fix double add event handler (composite + google PSI module)
2if (!window.JCSmartFilterBinds) {
3  $(document).ready(function () {
4    $(document).on("click", ".bx_filter.compact .bx_filter_parameters_box_title .delete_filter", function () {
5      var _this = $(this);
6      _this.closest(".bx_filter_parameters_box").find("input[type=text]").val("");
7      _this.closest(".bx_filter_parameters_box").removeClass("set");
8      _this.closest(".bx_filter_parameters_box").find(".pict label").removeClass("active");
9      _this.closest(".bx_filter_parameters_box").find(".bx_filter_parameters_box_title .count_selected").text("");
10
11      var t = false;
12      _this
13        .closest(".bx_filter_parameters_box")
14        .find("input")
15        .each(function () {
16          var __this = this;
17          $(__this).prop("checked", false);
18          if (t) {
19            clearTimeout(t);
20          }
21
22          t = setTimeout(function () {
23            smartFilter.reload(__this);
24          }, 100);
25        });
26    });
27
28    $(document).on("click", ".bx_filter.compact .bx_filter_block", function (e) {
29      e.stopPropagation();
30    });
31
32    $(document).on("click", ".bx_filter_button_box .bx_filter_search_reset", function (e) {
33      $(this).addClass("hidden");
34      $(".bx_filter_search_reset.btn-link-text").click();
35    });
36
37    $(document).on("click", "#mobilefilter .bx_filter_parameters_box_title:not(.prices)", function (e) {
38      $(this).closest(".bx_filter_parameters_box").toggleClass("active");
39    });
40
41    $(document).on("click", ".filter-compact-block .bx_filter_parameters_box_title.prices.title", function (e) {
42      if (BX.PopupWindowManager.getCurrentPopup()) BX.PopupWindowManager.getCurrentPopup().close();
43      $(".bx_filter_parameters_box").removeClass("active");
44    });
45
46    $(document).on("click", ".filter-compact-block .bx_filter_parameters_box_title:not(.prices)", function (e) {
47      var target = e.target;
48      if (
49        !$(e.target).hasClass("tooltip") &&
50        !$(e.target).hasClass("delete_filter") &&
51        !$(e.target).closest(".delete_filter").length
52      ) {
53        e.stopPropagation();
54
55        var $box = $(this).closest(".bx_filter_parameters_box");
56        if ($box.hasClass("active")) {
57          $(this).next(".bx_filter_block").stop().slideUp(100);
58        } else {
59          $(".bx_filter_block:not(.limited_block)").slideUp(100);
60          $(".bx_filter_parameters_box").removeClass("active");
61
62          var _this = $(this);
63          setTimeout(function () {
64            var boxOffsetLeft = _this.offset().left,
65              boxWidth = _this.next(".bx_filter_block").outerWidth(),
66              windowWidth = $(window).width();
67
68            if (boxOffsetLeft + boxWidth > windowWidth) {
69              _this.next(".bx_filter_block").addClass("right");
70            } else {
71              _this.next(".bx_filter_block").removeClass("right");
72            }
73          }, 0);
74
75          _this.next(".bx_filter_block").stop().slideDown(300);
76        }
77        $box.toggleClass("active");
78      }
79    });
80
81    $(document).on("click", ".bx_filter_block .bx_filter_button_box .btn", function () {
82      $(this).closest("form").find(".bx_filter_search_button").click();
83    });
84
85    $(document).on("click", function (e) {
86      $(".filter-compact-block .bx_filter_block:not(.limited_block)").stop().slideUp(100);
87      $(".filter-compact-block .bx_filter_parameters_box").removeClass("active");
88    });
89    $(document).click(function (e) {
90      if (!$(e.target).hasClass("tooltip")) {
91        $(".bx_filter .hint.active").removeClass("active").find(".tooltip").slideUp(200);
92      }
93    });
94    window.JCSmartFilterBinds = true;
95  });
96}
97function JCSmartFilter(ajaxURL, viewMode, params) {
98  this.ajaxURL = ajaxURL;
99  this.form = null;
100  this.timer = null;
101  this.cacheKey = "";
102  this.cache = [];
103  this.viewMode = viewMode;
104  this.normal_url = false;
105  this.reset = false;
106  this.SEF_SET_FILTER_URL = params.SEF_SET_FILTER_URL;
107  this.SEF_DEL_FILTER_URL = params.SEF_DEL_FILTER_URL;
108  /*if (params && params.SEF_SET_FILTER_URL)
109		{*/
110  this.bindUrlToButton("set_filter", params.SEF_SET_FILTER_URL);
111  this.sef = true;
112  /*}
113		if (params && params.SEF_DEL_FILTER_URL)
114		{*/
115  this.bindUrlToButton("del_filter", params.SEF_DEL_FILTER_URL);
116  //}
117  if (!params.SEF_DEL_FILTER_URL) {
118    this.normal_url = true;
119  }
120}
121
122JCSmartFilter.prototype.keyup = function (input) {
123  if (!!this.timer) {
124    clearTimeout(this.timer);
125  }
126  if (!$(input).hasClass("disabled")) {
127    this.timer = setTimeout(
128      BX.delegate(function () {
129        this.reload(input);
130      }, this),
131      500
132    );
133  }
134};
135
136JCSmartFilter.prototype.click = function (checkbox) {
137  if (!!this.timer) {
138    clearTimeout(this.timer);
139  }
140
141  this.timer = setTimeout(
142    BX.delegate(function () {
143      this.reload(checkbox);
144    }, this),
145    500
146  );
147};
148
149JCSmartFilter.prototype.reload = function (input) {
150  if (this.cacheKey !== "") {
151    //Postprone backend query
152    if (!!this.timer) {
153      clearTimeout(this.timer);
154    }
155    this.timer = setTimeout(
156      BX.delegate(function () {
157        this.reload(input);
158      }, this),
159      1000
160    );
161    return;
162  }
163  this.cacheKey = "|";
164
165  this.position = BX.pos(input, true);
166  this.form = BX.findParent(input, { tag: "form" });
167
168  if (this.form) {
169    if ($(".middle > .container .ajax_load").length) $(".middle > .container .ajax_load").addClass("loading-state");
170
171    var values = [];
172    values[0] = { name: "ajax", value: "y" };
173    this.gatherInputsValues(values, BX.findChildren(this.form, { tag: new RegExp("^(input|select)$", "i") }, true));
174
175    $(".bx_filter_parameters_box").removeClass("set");
176
177    for (var i = 0; i < values.length; i++) {
178      this.cacheKey += values[i].name + ":" + values[i].value + "|";
179      $("input[name=" + values[i].name + "]")
180        .closest(".bx_filter_parameters_box")
181        .addClass("set");
182    }
183
184    if (this.cache[this.cacheKey]) {
185      this.curFilterinput = input;
186      this.postHandler(this.cache[this.cacheKey], true);
187    } else {
188      if (this.sef) {
189        var set_filter = BX("set_filter"),
190          reset_filter = BX("del_filter");
191
192        if (set_filter) set_filter.disabled = true;
193        if (reset_filter) reset_filter.disabled = true;
194      }
195
196      this.curFilterinput = input;
197
198      BX.ajax.loadJSON(this.ajaxURL, this.values2post(values), BX.delegate(this.postHandler, this));
199    }
200  }
201
202  var i = 0;
203  $(input)
204    .closest(".bx_filter_block")
205    .find("input[type=checkbox], input[type=radio]")
206    .each(function () {
207      if ($(this).prop("checked") === true) {
208        ++i;
209      }
210    })
211    .promise()
212    .done(function () {
213      if (i != 0) {
214        $(input)
215          .closest(".bx_filter_parameters_box")
216          .find(".bx_filter_parameters_box_title .count_selected")
217          .text(": " + i);
218      } else {
219        $(input).closest(".bx_filter_parameters_box").find(".bx_filter_parameters_box_title .count_selected").text("");
220      }
221    });
222};
223
224JCSmartFilter.prototype.updateItem = function (PID, arItem, reset) {
225  if (arItem.PROPERTY_TYPE === "N" || arItem.PRICE) {
226    var trackBar = window["trackBar" + PID];
227    if (!trackBar && arItem.ENCODED_ID) trackBar = window["trackBar" + arItem.ENCODED_ID];
228
229    if (trackBar && arItem.VALUES) {
230      if (arItem.VALUES.MIN) {
231        if (arItem.VALUES.MIN.FILTERED_VALUE) trackBar.setMinFilteredValue(arItem.VALUES.MIN.FILTERED_VALUE);
232        else trackBar.setMinFilteredValue(arItem.VALUES.MIN.VALUE);
233      }
234
235      if (arItem.VALUES.MAX) {
236        if (arItem.VALUES.MAX.FILTERED_VALUE) trackBar.setMaxFilteredValue(arItem.VALUES.MAX.FILTERED_VALUE);
237        else trackBar.setMaxFilteredValue(arItem.VALUES.MAX.VALUE);
238      }
239      if (reset == "Y") {
240        trackBar.leftPercent = trackBar.rightPercent = 0;
241        $("#" + arItem.VALUES.MIN.CONTROL_ID).val("");
242        $("#" + arItem.VALUES.MAX.CONTROL_ID).val("");
243        $("#left_slider_" + arItem.ENCODED_ID).css({ left: "0%" });
244        $("#colorUnavailableActive_" + arItem.ENCODED_ID).css({ left: "0%", r
244ight: "0%" });
245        $("#colorAvailableInactive_" + arItem.ENCODED_ID).css({ left: "0%", right: "0%" });
246        $("#colorAvailableActive_" + arItem.ENCODED_ID).css({ left: "0%", right: "0%" });
247        $("#right_slider_" + arItem.ENCODED_ID).css({ right: "0%" });
248      }
249    }
250  } else if (arItem.VALUES) {
251    for (var i in arItem.VALUES) {
252      if (arItem.VALUES.hasOwnProperty(i)) {
253        var value = arItem.VALUES[i];
254        var control = BX(value.CONTROL_ID);
255        if (!!control) {
256          var label = document.querySelector('[data-role="label_' + value.CONTROL_ID + '"]');
257          input = document.querySelector('[id="' + value.CONTROL_ID + '"]');
258
259          if (value.DISABLED) {
260            if (label) {
261              BX.addClass(label, "disabled");
262              if (input) {
263                input.setAttribute("disabled", "disabled");
264                BX.addClass(input, "disabled");
265              }
266            } else {
267              BX.addClass(control.parentNode, "disabled");
268            }
269          } else {
270            if (label) {
271              BX.removeClass(label, "disabled");
272              if (input) {
273                input.removeAttribute("disabled");
274                BX.removeClass(input, "disabled");
275              }
276              // if(reset=="Y"){
277              if ($(control)) {
278                $(control).prop("disabled", false);
279                $(control).removeClass("disabled");
280              }
281              $(label).find("span").removeClass("disabled");
282              // }
283            } else BX.removeClass(control.parentNode, "disabled");
284          }
285
286          if (reset == "Y") {
287            if ($(control).attr("type") == "checkbox" || $(control).attr("type") == "radio") {
288              if ($(control).attr("checked")) {
289                $(control).prop("checked", false);
290                // input.removeAttribute('checked');
291              }
292            }
293          }
294
295          if (value.hasOwnProperty("ELEMENT_COUNT")) {
296            label = document.querySelector('[data-role="count_' + value.CONTROL_ID + '"]');
297            if (label) label.innerHTML = value.ELEMENT_COUNT;
298          }
299        }
300      }
301    }
302  }
303};
304
305JCSmartFilter.prototype.postHandlerAjax = function (result, fromCache) {
306  $("#content").html(result);
307};
308
309JCSmartFilter.prototype.setUrlSortDisplay = function (url) {
310  var arReplace_url = "",
311    strReplace_url = "";
312
313  $(".sort_btn").each(function () {
314    arReplace_url = $(this).attr("href").split("?");
315    arReplace_url[0] = url;
316    strReplace_url = arReplace_url.join("?");
317
318    $(this).attr("href", strReplace_url);
319  });
320};
321
322JCSmartFilter.prototype.filterCatalog = function (url, set_disabled, reset, count) {
323  if (window.History.enabled || window.history.pushState != null) {
324    window.history.pushState(null, document.title, url);
325  }
326  else {
327    location.href = url;
328  }
329
330  // this.setUrlSortDisplay(url);
331
332  if ($(".middle > .container .ajax_load").length) $(".middle > .container .ajax_load").addClass("loading-state");
333
334  $.ajax({
335    url: url,
336    type: "GET",
337    data: { ajax_get: "Y", ajax_get_filter: "Y" },
338    success: function (html) {
339      if (reset && (!$("#wrapInlineFilter").length || !$("#wrapInlineFilter").is(":empty"))) {
340        $(".js-load-wrapper").html($(html).find(".js-load-wrapper").html());
341        $(".top-content-block").html($(html).find(".top-content-block").html());
342
343        if ("checkFilterLandgings" in window && typeof checkFilterLandgings == "function") {
344          checkFilterLandgings();
345        }
346      } else {
347        var itemsHtml = $(html).find(".inner_wrapper").html();
348        $(".middle > .container .inner_wrapper").html(itemsHtml);
349
350        //ajax sort-block
351        $(".sort_header").html($(html).find(".sort_header").html());
352
353        //ajax top-block
354        $(".top-content-block").html($(html).find(".top-content-block").html());
355
356        if ($(html).find(".filter_title").hasClass("active-filter")) {
357          $(".filter_title").addClass("active-filter");
358          $(".bx_filter_search_reset ").removeClass("hidden");
359        } else {
360          $(".filter_title").removeClass("active-filter");
361          $(".bx_filter_search_reset ").addClass("hidden");
362        }
363
364        if (reset && $("#mobilefilter .bx_filter").length) {
365          $("#mobilefilter").html("");
366          $(html).find(".bx_filter").appendTo($("#mobilefilter"));
367          $("#mobilefilter .bx_filter_parameters").addClass("scrollbar");
368
369          $("#mobilefilter .bx_filter_parameters .bx_filter_parameters_box_title").addClass(
370            "colored_theme_hover_bg-block"
371          );
372
373          smartFilter.bindUrlToButton("set_filter", smartFilter.SEF_SET_FILTER_URL);
374          smartFilter.bindUrlToButton("del_filter", smartFilter.SEF_DEL_FILTER_URL);
375
376          mobileFilterNum(count);
377
378          if (window.sortFilterPopup !== undefined && typeof window.sortFilterPopup.destroy == "function") {
379            window.sortFilterPopup.destroy();
380          }
381        }
382
383        if ("checkFilterLandgings" in window && typeof checkFilterLandgings == "function") {
384          checkFilterLandgings();
385        }
386      }
387
388      $(".fast_view_frame").remove();
389
390      BX.onCustomEvent("onAjaxSuccessFilter");
391
392      if (set_disabled == "Y") {
393        var set_filter = BX("set_filter"),
394          reset_filter = BX("del_filter");
395
396        if (set_filter) set_filter.disabled = false;
397        if (reset_filter) reset_filter.disabled = false;
398      }
399
400      var eventdata = { action: "jsLoadBlock" };
401      BX.onCustomEvent("onCompleteAction", [eventdata, this]);
402
403      if ($(".middle > .container .ajax_load").length)
404        $(".middle > .container .ajax_load").removeClass("loading-state");
405        
406      if(typeof Ya !== 'undefined' && typeof Ya.share2 === 'function'){
407        let myShare = document.querySelector('.ya-share2');
408        if (myShare) { 
409          Ya.share2(myShare, {
410            content: {
411              url: location.href    
412            }
413          });
414        }
415      }
416    },
417  });
418};
419
420JCSmartFilter.prototype.postHandler = function (result, fromCache) {
421  var hrefFILTER, url, curProp;
422  var modef = BX("modef");
423  var modef_mobile = BX("modef_mobile");
424  var modef_num = BX("modef_num");
425  var modef_num_mobile = BX("modef_num_mobile");
426  var reset = "N";
427
428  if ("RESET_FORM" in result) {
429    document.getElementsByClassName("smartfilter")[0].reset();
430    reset = "Y";
431  }
432
433  if (!!result && !!result.ITEMS) {
434    for (var PID in result.ITEMS) {
435      if (result.ITEMS.hasOwnProperty(PID)) {
436        this.updateItem(PID, result.ITEMS[PID], reset);
437      }
438    }
439
440    if (reset == "Y") {
441      if ($(".bx_filter_select_block").length) {
442        $(".bx_filter_select_block").each(function () {
443          var id = $(this).closest(".bx_filter_parameters_box").attr("property_id"),
444            all_text = $(this).find(".input_wr_all input:first-child").data("title");
445          $(this).find(".bx_filter_select_text").text(all_text);
446          $(this).find(".bx_filter_select_popup li label").removeClass("selected");
447        });
448      }
449    }
450    if (!!modef && !!modef_num) {
451      //modef_num.innerHTML = result.ELEMENT_COUNT;
452      $(".bx_filter.compact .bx_filter_button_box .bx_filter_container_modef").html(
453        BX.message("SELECTED") + result.ELEMENT_COUNT
454      );
455      $(".bx_filter.compact .bx_filter_button_box").show();
456      //modef_num_mobile.innerHTML = result.ELEMENT_COUNT;
457      if (typeof mobileFilterNum === "function") {
458        mobileFilterNum(result.ELEMENT_COUNT);
459      }
460      hrefFILTER = BX.findChildren(modef, { tag: "A" }, true);
461      hrefFILTER_mobile = BX.findChildren(modef_mobile, { tag: "A" }, true);
462
463      if (result.FILTER_URL && hrefFILTER) {
464        hrefFILTER[0].href = BX.util.htmlspecialcharsback(result.FILTER_URL.replace("/filter/clear/apply/", "/"));
465        hrefFILTER_mobile[0].href = BX.util.htmlspecialcharsback(
466          result.FILTER_URL.replace("/filter/clear/apply/", "/")
467        );
468      }
469
470      if (result.FILTER_AJAX_URL && result.COMPONENT_CONTAINER_ID) {
471        BX.unbindAll(hrefFILTER[0]);
472        BX.unbindAll(hrefFILTER_mobile[0]);
473        BX.bind(hrefFILTER[0], "click", function (e) {
474          url = BX.util.htmlspecialcharsback(result.FILTER_AJAX_URL);
475          BX.ajax.insertToNode(url, result.COMPONENT_CONTAINER_ID);
476          return BX.PreventDefault(e);
477        });
478      }
479
480      if (result.INSTANT_RELOAD && result.COMPONENT_CONTAINER_ID) {
481        url = BX.util.htmlspecialcharsback(result.FILTER_AJAX_URL);
482        BX.ajax.insertToNode(url, result.COMPONENT_CONTAINER_ID);
483      } else {
484        /*ajax update filter catalog items start*/
485        url = BX.util.htmlspecialcharsback(result.FILTER_AJAX_URL);
486        // BX.ajax.insertToNode(url+'?ajax_get=Y', "right_block_ajax");
487
488        this.filterCatalog(url, "N", this.reset, result.ELEMENT_COUNT);
489
490        /*ajax update filter catalog items end*/
491
492        /*if (modef.style.display === 'none')
493					{
494						modef.style.display = 'inline-block';
495						modef_mobile.style.display = 'inline-block';
496					}
497					if (this.viewMode == "vertical")
498					{
499						curProp = BX.findChild(BX.findParent(this.curFilterinput, {'class':'bx_filter_parameters_box'}), {'class':'bx_filter_container_modef'}, true, false);
500						curProp.appendChild(modef);
501					}*/
502
503        if (result.SEF_SET_FILTER_URL) {
504          this.bindUrlToButton("set_filter", result.SEF_SET_FILTER_URL);
505        } else {
506          this.bindUrlToButton("set_filter", url);
507        }
508      }
509    }
510  }
511
512  if (this.sef) {
513    var set_filter = BX("set_filter"),
514      reset_filter = BX("del_filter");
515
516    if (set_filter) set_filter.disabled = false;
517    if (reset_filter) reset_filter.disabled = false;
518  }
519
520  if (!fromCache && this.cacheKey !== "") {
521    this.cache[this.cacheKey] = result;
522  }
523  this.cacheKey = "";
524};
525
526JCSmartFilter.prototype.bindUrlToButton = function (buttonId, url) {
527  var button = BX(buttonId);
528  if (button) {
529    var proxy = function (j, func) {
530      return function () {
531        return func(j);
532      };
533    };
534
535    if (button.type == "submit") button.type = "button";
536
537    $(button).data("href", url);
538    BX.unbindAll(button);
539
540    BX.bind(
541      button,
542      "click",
543      BX.proxy(function () {
544        var url_filter = $(button).data("href"),
545          id = $(button).attr("id");
546
547        if ($(".middle > .container .ajax_load").length) $(".middle > .container .ajax_load").addClass("loading-state");
548
549        if (id == "del_filter") {
550          var values = [],
551            url_form = this.normal_url ? $("form.smartfilter").attr("action") : this.ajaxURL;
552          values[0] = { name: "ajax", value: "y" };
553
554          if (!this.normal_url) {
555            this.gatherInputsValues(
556              values,
557              BX.findChildren(document.getElementById("smartfilter"), { attribute: "hidden" }, true)
558            );
559          }
560          values[1] = { name: "reset_form", value: "y" };
561          if (this.sef) {
562            var set_filter = BX("set_filter"),
563              reset_filter = BX("del_filter");
564
565            if (set_filter) set_filter.disabled = true;
566            if (reset_filter) reset_filter.disabled = true;
567          }
568          this.reset = true;
569          BX.ajax.loadJSON(url_form, this.values2post(values), BX.delegate(this.postHandler, this));
570        } else {
571          if (url_filter) {
572            if (this.sef) {
573              var set_filter = BX("set_filter"),
574                reset_filter = BX("del_filter");
575
576              if (set_filter) set_filter.disabled = true;
577              if (reset_filter) reset_filter.disabled = true;
578            }
579
580            this.filterCatalog(url_filter, "Y");
581          }
582        }
583      }, this)
584    );
585  }
586};
587
588JCSmartFilter.prototype.gatherInputsValues = function (values, elements) {
589  if (elements) {
590    for (var i = 0; i < elements.length; i++) {
591      var el = elements[i];
592      if (!el.type) continue;
593
594      switch (el.type.toLowerCase()) {
595        case "text":
596        case "textarea":
597        case "password":
598        case "hidden":
599        case "select-one":
600          if (el.value.length) values[values.length] = { name: el.name, value: el.value };
601          break;
602        case "radio":
603        case "checkbox":
604          if (el.checked) values[values.length] = { name: el.name, value: el.value };
605          break;
606        case "select-multiple":
607          for (var j = 0; j < el.options.length; j++) {
608            if (el.options[j].selected) values[values.length] = { name: el.name, value: el.options[j].value };
609          }
610          break;
611        default:
612          break;
613      }
614    }
615  }
616};
617
618JCSmartFilter.prototype.values2post = function (values) {
619  var post = [];
620  var current = post;
621  var i = 0;
622
623  while (i < values.length) {
624    var p = values[i].name.indexOf("[");
625    if (p == -1) {
626      current[values[i].name] = values[i].value;
627      current = post;
628      i++;
629    } else {
630      var name = values[i].name.substring(0, p);
631      var rest = values[i].name.substring(p + 1);
632      if (!current[name]) current[name] = [];
633
634      var pp = rest.indexOf("]");
635      if (pp == -1) {
636        //Error - not balanced brackets
637        current = post;
638        i++;
639      } else if (pp == 0) {
640        //No index specified - so take the next integer
641        current = current[name];
642        values[i].name = "" + current.length;
643      } else {
644        //Now index name becomes and name and we go deeper into the array
645        current = current[name];
646        values[i].name = rest.substring(0, pp) + rest.substring(pp + 1);
647      }
648    }
649  }
650  return post;
651};
652
653JCSmartFilter.prototype.hideFilterProps = function (element) {
654  var obj = element.parentNode,
655    filterBlock = obj.querySelector("[data-role='bx_filter_block']"),
656    propAngle = obj.querySelector("[data-role='prop_angle']");
657
658  if (BX.hasClass(obj, "bx-active")) {
659    new BX.easing({
660      duration: 300,
661      start: { opacity: 1, height: filterBlock.offsetHeight },
662      finish: { opacity: 0, height: 0 },
663      transition: BX.easing.transitions.quart,
664      step: function (state) {
665        filterBlock.style.opacity = state.opacity;
666        filterBlock.style.height = state.height + "px";
667      },
668      complete: function () {
669        filterBlock.setAttribute("style", "");
670        BX.removeClass(obj, "bx-active");
671      },
672    }).animate();
673
674    BX.addClass(propAngle, "fa-angle-down");
675    BX.removeClass(propAngle, "fa-angle-up");
676  } else {
677    filterBlock.style.display = "block";
678    filterBlock.style.opacity = 0;
679    filterBlock.style.height = "auto";
680
681    var obj_children_height = filterBlock.offsetHeight;
682    filterBlock.style.height = 0;
683
684    new BX.easing({
685      duration: 300,
686      start: { opacity: 0, height: 0 },
687      finish: { opacity: 1, height: obj_children_height },
688      transition: BX.easing.transitions.quart,
689      step: function (state) {
690        filterBlock.style.opacity = state.opacity;
691        filterBlock.style.height = state.height + "px";
692      },
693      complete: function () {},
694    }).animate();
695
696    BX.addClass(obj, "bx-active");
697    BX.removeClass(propAngle, "fa-angle-down");
698    BX.addClass(propAngle, "fa-angle-up");
699  }
700};
701
702JCSmartFilter.prototype.showDropDownPopup = function (element, popupId) {
703  const dropDownID = "smartFilterDropDown" + popupId;
704  var contentNode = element.querySelector('[data-role="dropdownContent"]'),
705    offset = $(element).offset();
706  var el = BX.PopupWindowManager.create(dropDownID, element, {
707    autoHide: true,
708    offsetLeft: 0,
709    offsetTop: 0,
710    overlay: false,
711    draggable: { restrict: true },
712    closeByEsc: true,
713    content: contentNode,
714  });
715
716  if( 
717    typeof BX.PopupWindowManager._popups !== 'undefined' && 
718    BX.PopupWindowManager._popups.length && 
719    el.bindElement !== element
720  ){
721    BX.PopupWindowManager._popups = BX.PopupWindowManager._popups.filter(function(popup){
722      if (popup.uniquePopupId !== dropDownID) return;
723    });
724
725    el = BX.PopupWindowManager.create(dropDownID, element, {
726      autoHide: true,
727      offsetLeft: 0,
728      offsetTop: 0,
729      overlay: false,
730      draggable: { restrict: true },
731      closeByEsc: true,
732      content: contentNode,
733    });
734  }
735
736  if (popupId == "ASPRO_FILTER_SORT") {
737    window.sortFilterPopup = el;
738  }
739
740  el.show();
741
742  if (
743    !$(element)
744      .closest(".bx_filter_parameters_box_container")
745      .find("#smartFilterDropDown" + popupId).length
746  )
747    $("#smartFilterDropDown" + popupId).insertAfter($(element).closest(".bx_filter_parameters_box_container"));
748
749  $("#smartFilterDropDown" + popupId)
750    .addClass("scrollblock")
751    .css({ top: "auto", left: "auto" /*, 'width':$(element).css('width')*/ });
752  InitScrollBar();
753};
754
755JCSmartFilter.prototype.selectDropDownItem = function (element, controlId) {
756  if (!BX.hasClass(element, "disabled")) {
757    this.keyup(BX(controlId));
758
759    var wrapContainer = BX.findParent(BX(controlId), { className: "bx_filter_select_container" }, false);
760
761    var currentOption = wrapContainer.querySelector('[data-role="currentOption"]');
762
763    currentOption.innerHTML = element.innerHTML;
764    $(element).closest(".bx_filter_select_popup").find("label").removeClass("selected");
765    BX.addClass(element, "selected");
766
767    if (BX.PopupWindowManager.getCurrentPopup()) BX.PopupWindowManager.getCurrentPopup().close();
768  }
769};
770
771BX.namespace("BX.Iblock.SmartFilter");
772BX.Iblock.SmartFilter = (function () {
773  var SmartFilter = function (arParams) {
774    if (typeof arParams === "object") {
775      this.leftSlider = BX(arParams.leftSlider);
776      this.rightSlider = BX(arParams.rightSlider);
777      this.tracker = BX(arParams.tracker);
778      this.trackerWrap = BX(arParams.trackerWrap);
779
780      this.minInput = BX(arParams.minInputId);
781      this.maxInput = BX(arParams.maxInputId);
782
783      this.minPrice = parseFloat(arParams.minPrice);
784      this.maxPrice = parseFloat(arParams.maxPrice);
785
786      this.curMinPrice = parseFloat(arParams.curMinPrice);
787      this.curMaxPrice = parseFloat(arParams.curMaxPrice);
788
789      this.fltMinPrice = arParams.fltMinPrice ? parseFloat(arParams.fltMinPrice) : parseFloat(arParams.curMinPrice);
790      this.fltMaxPrice = arParams.fltMaxPrice ? parseFloat(arParams.fltMaxPrice) : parseFloat(arParams.curMaxPrice);
791
792      this.precision = arParams.precision || 0;
793
794      this.priceDiff = this.maxPrice - this.minPrice;
795
796      this.leftPercent = arParams.leftPercent ? parseFloat(arParams.leftPercent) : 0;
797      this.rightPercent = arParams.rightPercent ? parseFloat(arParams.rightPercent) : 0;
798
799      this.fltMinPercent = 0;
800      this.fltMaxPercent = 0;
801
802      this.colorUnavailableActive = BX(arParams.colorUnavailableActive); //gray
803      this.colorAvailableActive = BX(arParams.colorAvailableActive); //blue
804      this.colorAvailableInactive = BX(arParams.colorAvailableInactive); //light blue
805
806      this.isTouch = false;
807
808      this.init();
809
810      if ("ontouchstart" in document.documentElement || "ontouchstart" in window) {
811        this.isTouch = true;
812
813        BX.bind(
814          this.leftSlider,
815          "touchstart",
816          BX.proxy(function (event) {
817            this.onMoveLeftSlider(event);
818          }, this)
819        );
820
821        BX.bind(
822          this.rightSlider,
823          "touchstart",
824          BX.proxy(function (event) {
825            this.onMoveRightSlider(event);
826          }, this)
827        );
828
829        BX.bind(
830          this.colorAvailableActive,
831          "touchstart",
832          BX.proxy(function (event) {
833            this.onChangeLeftSlider(event);
834          }, this)
835        );
836
837        BX.bind(
838          this.colorUnavailableActive,
839          "touchstart",
840          BX.proxy(function (event) {
841            this.onChangeLeftSlider(event);
842          }, this)
843        );
844
845        BX.bind(
846          this.colorAvailableInactive,
847          "touchstart",
848          BX.proxy(function (event) {
849            this.onChangeLeftSlider(event);
850          }, this)
851        );
852      } else {
853        BX.bind(
854          this.leftSlider,
855          "mousedown",
856          BX.proxy(function (event) {
857            this.onMoveLeftSlider(event);
858          }, this)
859        );
860
861        BX.bind(
862          this.rightSlider,
863          "mousedown",
864          BX.proxy(function (event) {
865            this.onMoveRightSlider(event);
866          }, this)
867        );
868
869        BX.bind(
870          this.colorAvailableActive,
871          "mousedown",
872          BX.proxy(function (event) {
873            this.onChangeLeftSlider(event);
874          }, this)
875        );
876
877        BX.bind(
878          this.colorUnavailableActive,
879          "mousedown",
880          BX.proxy(function (event) {
881            this.onChangeLeftSlider(event);
882          }, this)
883        );
884
885        BX.bind(
886          this.colorAvailableInactive,
887          "mousedown",
888          BX.proxy(function (event) {
889            this.onChangeLeftSlider(event);
890          }, this)
891        );
892      }
893
894      BX.bind(
895        this.minInput,
896        "keyup",
897        BX.proxy(function (event) {
898          this.onInputChange();
899        }, this)
900      );
901
902      BX.bind(
903        this.maxInput,
904        "keyup",
905        BX.proxy(function (event) {
906          this.onInputChange();
907        }, this)
908      );
909    }
910  };
911
912  SmartFilter.prototype.init = function () {
913    var priceDiff;
914
915    if (this.curMinPrice > this.minPrice) {
916      priceDiff = this.curMinPrice - this.minPrice;
917      this.leftPercent = (priceDiff * 100) / this.priceDiff;
918
919      this.leftSlider.style.left = this.leftPercent + "%";
920      this.colorUnavailableActive.style.left = this.leftPercent + "%";
921    }
922
923    this.setMinFilteredValue(this.fltMinPrice);
924
925    if (this.curMaxPrice < this.maxPrice) {
926      priceDiff = this.maxPrice - this.curMaxPrice;
927      this.rightPercent = (priceDiff * 100) / this.priceDiff;
928
929      this.rightSlider.style.right = this.rightPercent + "%";
930      this.colorUnavailableActive.style.right = this.rightPercent + "%";
931    }
932
933    this.setMaxFilteredValue(this.fltMaxPrice);
934  };
935
936  SmartFilter.prototype.setMinFilteredValue = function (fltMinPrice) {
937    this.fltMinPrice = parseFloat(fltMinPrice);
938    if (this.fltMinPrice >= this.minPrice) {
939      var priceDiff = this.fltMinPrice - this.minPrice;
940      this.fltMinPercent = (priceDiff * 100) / this.priceDiff;
941
942      if (this.leftPercent > this.fltMinPercent) this.colorAvailableActive.style.left = this.leftPercent + "%";
943      else this.colorAvailableActive.style.left = this.fltMinPercent + "%";
944
945      this.colorAvailableInactive.style.left = this.fltMinPercent + "%";
946    } else {
947      this.colorAvailableActive.style.left = "0%";
948      this.colorAvailableInactive.style.left = "0%";
949    }
950  };
951
952  SmartFilter.prototype.setMaxFilteredValue = function (fltMaxPrice) {
953    this.fltMaxPrice = parseFloat(fltMaxPrice);
954    if (this.fltMaxPrice <= this.maxPrice) {
955      var priceDiff = this.maxPrice - this.fltMaxPrice;
956      this.fltMaxPercent = (priceDiff * 100) / this.priceDiff;
957
958      if (this.rightPercent > this.fltMaxPercent) this.colorAvailableActive.style.right = this.rightPercent + "%";
959      else this.colorAvailableActive.style.right = this.fltMaxPercent + "%";
960
961      this.colorAvailableInactive.style.right = this.fltMaxPercent + "%";
962    } else {
963      this.colorAvailableActive.style.right = "0%";
964      this.colorAvailableInactive.style.right = "0%";
965    }
966  };
967
968  SmartFilter.prototype.getXCoord = function (elem) {
969    var box = elem.getBoundingClientRect();
970    var body = document.body;
971    var docElem = document.documentElement;
972
973    var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft;
974    var clientLeft = docElem.clientLeft || body.clientLeft || 0;
975    var left = box.left + scrollLeft - clientLeft;
976
977    return Math.round(left);
978  };
979
980  SmartFilter.prototype.getPageX = function (e) {
981    e = e || window.event;
982    var pageX = null;
983
984    if (this.isTouch && e.targetTouches[0] != null) {
985      pageX = e.targetTouches[0].pageX;
986    } else if (e.pageX != null) {
987      pageX = e.pageX;
988    } else if (e.clientX != null) {
989      var html = document.documentElement;
990      var body = document.body;
991
992      pageX = e.clientX + (html.scrollLeft || (body && body.scrollLeft) || 0);
993      pageX -= html.clientLeft || 0;
994    }
995
996    return pageX;
997  };
998
999  SmartFilter.prototype.recountMinPrice = function () {
1000    var newMinPrice = (this.priceDiff * this.leftPercent) / 100;
1001    newMinPrice = (this.minPrice + newMinPrice).toFixed(this.precision);
1002
1003    if (newMinPrice != this.minPrice) this.minInput.value = newMinPrice;
1004    else this.minInput.value = "";
1005    smartFilter.keyup(this.minInput);
1006  };
1007
1008  SmartFilter.prototype.recountMaxPrice = function () {
1009    var newMaxPrice = (this.priceDiff * this.rightPercent) / 100;
1010    newMaxPrice = (this.maxPrice - newMaxPrice).toFixed(this.precision);
1011
1012    if (newMaxPrice != this.maxPrice) this.maxInput.value = newMaxPrice;
1013    else this.maxInput.value = "";
1014    smartFilter.keyup(this.maxInput);
1015  };
1016
1017  SmartFilter.prototype.onInputChange = function () {
1018    var priceDiff;
1019    if (this.minInput.value) {
1020      var leftInputValue = this.minInput.value;
1021      if (leftInputValue < this.minPrice) leftInputValue = this.minPrice;
1022
1023      if (leftInputValue > this.maxPrice) leftInputValue = this.maxPrice;
1024
1025      priceDiff = leftInputValue - this.minPrice;
1026      this.leftPercent = (priceDiff * 100) / this.priceDiff;
1027
1028      this.makeLeftSliderMove(false);
1029    }
1030
1031    if (this.maxInput.value) {
1032      var rightInputValue = this.maxInput.value;
1033      if (rightInputValue < this.minPrice) rightInputValue = this.minPrice;
1034
1035      if (rightInputValue > this.maxPrice) rightInputValue = this.maxPrice;
1036
1037      priceDiff = this.maxPrice - rightInputValue;
1038      this.rightPercent = (priceDiff * 100) / this.priceDiff;
1039
1040      this.makeRightSliderMove(false);
1041    }
1042  };
1043
1044  SmartFilter.prototype.makeLeftSliderMove = function (recountPrice) {
1045    recountPrice = recountPrice !== false;
1046
1047    this.leftSlider.style.left = this.leftPercent + "%";
1048    this.colorUnavailableActive.style.left = this.leftPercent + "%";
1049
1050    var areBothSlidersMoving = false;
1051    if (this.leftPercent + this.rightPercent >= 100) {
1052      areBothSlidersMoving = true;
1053      this.rightPercent = 100 - this.leftPercent;
1054      this.rightSlider.style.right = this.rightPercent + "%";
1055      this.colorUnavailableActive.style.right = this.rightPercent + "%";
1056    }
1057
1058    if (this.leftPercent >= this.fltMinPercent && this.leftPercent <= 100 - this.fltMaxPercent) {
1059      this.colorAvailableActive.style.left = this.leftPercent + "%";
1060      if (areBothSlidersMoving) {
1061        this.colorAvailableActive.style.right = 100 - this.leftPercent + "%";
1062      }
1063    } else if (this.leftPercent <= this.fltMinPercent) {
1064      this.colorAvailableActive.style.left = this.fltMinPercent + "%";
1065      if (areBothSlidersMoving) {
1066        this.colorAvailableActive.style.right = 100 - this.fltMinPercent + "%";
1067      }
1068    } else if (this.leftPercent >= this.fltMaxPercent) {
1069      this.colorAvailableActive.style.left = 100 - this.fltMaxPercent + "%";
1070      if (areBothSlidersMoving) {
1071        this.colorAvailableActive.style.right = this.fltMaxPercent + "%";
1072      }
1073    }
1074
1075    if (recountPrice) {
1076      this.recountMinPrice();
1077      if (areBothSlidersMoving) this.recountMaxPrice();
1078    }
1079  };
1080
1081  SmartFilter.prototype.countNewLeft = function (event) {
1082    var pageX = this.getPageX(event);
1083
1084    var trackerXCoord = this.getXCoord(this.trackerWrap);
1085    var rightEdge = this.trackerWrap.offsetWidth;
1086
1087    var newLeft = pageX - trackerXCoord;
1088
1089    if (newLeft < 0) newLeft = 0;
1090    else if (newLeft > rightEdge) newLeft = rightEdge;
1091
1092    return newLeft;
1093  };
1094
1095  SmartFilter.prototype.onMoveLeftSlider = function (e) {
1096    if (!this.isTouch) {
1097      this.leftSlider.ondragstart = function () {
1098        return false;
1099      };
1100    }
1101
1102    $(".bx_filter .bx_filter_parameters_box_container input").prop("disabled", false);
1103
1104    if (!this.isTouch) {
1105      document.onmousemove = BX.proxy(function (event) {
1106        this.leftPercent = (this.countNewLeft(event) * 100) / this.trackerWrap.offsetWidth;
1107        this.makeLeftSliderMove();
1108      }, this);
1109
1110      document.onmouseup = function () {
1111        document.onmousemove = document.onmouseup = null;
1112      };
1113    } else {
1114      var onMoveFunction = BX.proxy(function (event) {
1115        this.leftPercent = (this.countNewLeft(event) * 100) / this.trackerWrap.offsetWidth;
1116        this.makeLeftSliderMove();
1117      }, this);
1118
1119      var onEndFunction = BX.proxy(function (event) {
1120        window.removeEventListener("touchmove", onMoveFunction, false);
1121        window.removeEventListener("touchend", onEndFunction, false);
1122        onMoveFunction = onEndFunction = null;
1123      }, this);
1124
1125      window.addEventListener("touchmove", onMoveFunction, false);
1126      window.addEventListener("touchend", onEndFunction, false);
1127
1128      /*document.ontouchmove = BX.proxy(function(event) {
1129					this.leftPercent = ((this.countNewLeft(event)*100)/this.trackerWrap.offsetWidth);
1130					this.makeLeftSliderMove();
1131				}, this);
1132
1133				document.ontouchend = function() {
1134					document.ontouchmove = document.touchend = null;
1135				};*/
1136    }
1137
1138    return false;
1139  };
1140
1141  SmartFilter.prototype.makeRightSliderMove = function (recountPrice) {
1142    recountPrice = recountPrice !== false;
1143
1144    this.rightSlider.style.right = this.rightPercent + "%";
1145    this.colorUnavailableActive.style.right = this.rightPercent + "%";
1146
1147    var areBothSlidersMoving = false;
1148    if (this.leftPercent + this.rightPercent >= 100) {
1149      areBothSlidersMoving = true;
1150      this.leftPercent = 100 - this.rightPercent;
1151      this.leftSlider.style.left = this.leftPercent + "%";
1152      this.colorUnavailableActive.style.left = this.leftPercent + "%";
1153    }
1154
1155    if (100 - this.rightPercent >= this.fltMinPercent && this.rightPercent >= this.fltMaxPercent) {
1156      this.colorAvailableActive.style.right = this.rightPercent + "%";
1157      if (areBothSlidersMoving) {
1158        this.colorAvailableActive.style.left = 100 - this.rightPercent + "%";
1159      }
1160    } else if (this.rightPercent <= this.fltMaxPercent) {
1161      this.colorAvailableActive.style.right = this.fltMaxPercent + "%";
1162      if (areBothSlidersMoving) {
1163        this.colorAvailableActive.style.left = 100 - this.fltMaxPercent + "%";
1164      }
1165    } else if (100 - this.rightPercent <= this.fltMinPercent) {
1166      this.colorAvailableActive.style.right = 100 - this.fltMinPercent + "%";
1167      if (areBothSlidersMoving) {
1168        this.colorAvailableActive.style.left = this.fltMinPercent + "%";
1169      }
1170    }
1171
1172    if (recountPrice) {
1173      this.recountMaxPrice();
1174      if (areBothSlidersMoving) this.recountMinPrice();
1175    }
1176  };
1177
1178  SmartFilter.prototype.onMoveRightSlider = function (e) {
1179    if (!this.isTouch) {
1180      this.rightSlider.ondragstart = function () {
1181        return false;
1182      };
1183    }
1184
1185    $(".bx_filter .bx_filter_parameters_box_container input").prop("disabled", false);
1186
1187    if (!this.isTouch) {
1188      document.onmousemove = BX.proxy(function (event) {
1189        this.rightPercent = 100 - (this.countNewLeft(event) * 100) / this.trackerWrap.offsetWidth;
1190        this.makeRightSliderMove();
1191      }, this);
1192
1193      document.onmouseup = function () {
1194        document.onmousemove = document.onmouseup = null;
1195      };
1196    } else {
1197      document.ontouchmove = BX.proxy(function (event) {
1198        this.rightPercent = 100 - (this.countNewLeft(event) * 100) / this.trackerWrap.offsetWidth;
1199        this.makeRightSliderMove();
1200      }, this);
1201
1202      document.ontouchend = function () {
1203        document.ontouchmove = document.ontouchend = null;
1204      };
1205    }
1206
1207    return false;
1208  };
1209
1210  SmartFilter.prototype.onChangeLeftSlider = function (e) {
1211    if (!this.isTouch) {
1212      this.leftSlider.ondragstart = function () {
1213        //return false;
1214      };
1215    }
1216
1217    if (!this.isTouch) {
1218      // document.onmousedown = BX.proxy(function(event) {
1219      var percent = (this.countNewLeft(event) * 100) / this.trackerWrap.offsetWidth;
1220      if ($(event.target).is(".bx_ui_slider_handle") || !$(event.target).is("[class^=bx_ui_slider]")) return;
1221      if (percent < 50) {
1222        this.leftPercent = percent + 1;
1223        this.makeLeftSliderMove();
1224      } else {
1225        this.rightPercent = 100 - percent;
1226        this.makeRightSliderMove();
1227      }
1228      // }, this);
1229
1230      document.onmouseup = function () {
1231        document.onmousemove = document.onmouseup = null;
1232      };
1233    } else {
1234      var percent = (this.countNewLeft(e) * 100) / this.trackerWrap.offsetWidth;
1235      if ($(e.target).is(".bx_ui_slider_handle")) return;
1236      if (percent < 50) {
1237        this.leftPercent = percent;
1238        this.makeLeftSliderMove();
1239      } else {
1240        this.rightPercent = 100 - percent;
1241        this.makeRightSliderMove();
1242      }
1243
1244      /*document.ontouchend = BX.proxy(function(event) {
1245					var percent=((this.countNewLeft(event)*100)/this.trackerWrap.offsetWidth);
1246					if($(event.target).is(".bx_ui_slider_handle"))
1247						return;
1248					if(percent<50){
1249						this.leftPercent = percent;
1250						this.makeLeftSliderMove();
1251					}else{
1252						this.rightPercent = 100-percent;
1253						this.makeRightSliderMove();
1254					}
1255				}, this);
1256
1257				document.ontouchend = function() {
1258					document.ontouchmove = document.touchend = null;
1259				};*/
1260    }
1261
1262    return false;
1263  };
1264
1265  return SmartFilter;
1266})();

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.