PageSourceSearch

https://bs24.com.ua/bitrix/templates/bs.24.com.ua_copy/components/bitrix/catalog/main/script.js

js bs24.com.ua collected 2026-10-09 21:39:20 UTC 18,416 bytes, 460 lines download raw bytes

1function setNewHeader(obOffer) {
2  var ratingHtml = (priceHtml = imgHtml = skuHtml = buttonHtml = "");
3
4  if (arMaxOptions["THEME"]["SHOW_HEADER_GOODS"] != "Y" || !$(".main-catalog-wrapper.details").length) return;
5
6  $("#headerfixed").addClass("with-product");
7
8  if ($(".product-info-headnote .rating").length) {
9    //show rating
10    ratingHtml =
11      '<div class="votes_block nstar' +
12      (arAsproOptions["THEME"]["REVIEWS_VIEW"] == "EXTENDED" ? " pointer" : "") +
13      '"><div class="ratings"><div class="inner_rating"';
14    var inner = $(".product-info-headnote .rating .inner_rating");
15    if (inner.length && inner.attr("title") !== undefined) {
16      ratingHtml += 'title="' + inner.attr("title");
17    }
18    ratingHtml += '">';
19
20    $(".product-info-headnote .rating .inner_rating > div").each(function (index) {
21      var index_title = index + 1;
22      ratingHtml += '<div class="item-rating ' + ($(this).hasClass("filed") ? "filed" : "");
23      if (inner.attr("title") === undefined) {
24        ratingHtml += '" title="' + index_title;
25      }
26      ratingHtml += '">' + $(this).html() + "</div>";
27    });
28
29    ratingHtml += "</div></div></div>";
30
31    if ($(".product-info-headnote .rating span").length) {
32      ratingHtml += $(".product-info-headnote .rating span")[0].outerHTML;
33    }
34  }
35  if ($('div *[itemprop="offers"]').length) {
36    //show price
37    /*if($('.cost.detail .js_price_wrapper').length)
38		{
39			priceHtml = $('.cost.detail .js_price_wrapper .price_matrix_wrapper').html();
40		}
41		else
42		{
43			if($('.cost.detail .price_group.min').length)
44				priceHtml = $('.cost.detail .price_group.min').html();
45			else if($('.cost.detail .price_matrix_wrapper').length)
46				priceHtml = $('.cost.detail .price_matrix_wrapper').html();
47		}*/
48
49    if (
50      BX.util.object_search_key("ASPRO_ITEM_POPUP_PRICE", BX.message) &&
51      BX.message("ASPRO_ITEM_POPUP_PRICE") == "Y"
52    ) {
53      var obOffer = {
54        SHOW_POPUP_PRICE: false,
55        PRICES_COUNT: BX.message("ASPRO_ITEM_PRICES"),
56      };
57      if (BX.util.object_search_key("ASPRO_ITEM_PRICE_MATRIX", BX.message)) {
58        obOffer.USE_PRICE_COUNT = true;
59        obOffer.PRICE_MATRIX = BX.message("ASPRO_ITEM_PRICE_MATRIX");
60      } else if (BX.util.object_search_key("ASPRO_ITEM_PRICE", BX.message)) {
61        obOffer.PRICES_HTML = BX.message("ASPRO_ITEM_PRICE");
62      }
63    }
64
65    if (typeof obOffer !== "undefined") {
66      if (
67        !obOffer.SHOW_POPUP_PRICE &&
68        (("PRICES_COUNT" in obOffer && obOffer.PRICES_COUNT > 1) ||
69          ("PRICES" in obOffer && Object.keys(obOffer.PRICES).length > 1) ||
70          ("ITEM_PRICES" in obOffer && Object.keys(obOffer.ITEM_PRICES).length > 1))
71      ) {
72        var bPriceCount = obOffer.USE_PRICE_COUNT && obOffer.PRICE_MATRIX,
73          topPrice = "";
74
75        if (bPriceCount) {
76          if ($(".cost.detail .with_matrix").length) {
77            topPrice = $(".cost.detail .with_matrix").html();
78          } else {
79            topPrice = '<div class="prices-wrapper">' + $(".cost.detail").html() + "</div>";
80          }
81        } else {
82          topPrice = '<div class="prices-wrapper">' + obOffer.PRICES_HTML + "</div>";
83        }
84
85        priceHtml = '<div class="with_matrix pl with_old price_matrix_wrapper">' + topPrice + "</div>";
86        priceHtml += '<div class="js_price_wrapper">';
87        priceHtml +=
88          '<div class="js-info-block rounded3">' +
89          '<div class="block_title text-upper font_xs font-bold">' +
90          BX.message("PRICES_TYPE") +
91          '<i class="svg inline  svg-inline-close" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path data-name="Rounded Rectangle 114 copy 3" class="cccls-1" d="M334.411,138l6.3,6.3a1,1,0,0,1,0,1.414,0.992,0.992,0,0,1-1.408,0l-6.3-6.306-6.3,6.306a1,1,0,0,1-1.409-1.414l6.3-6.3-6.293-6.3a1,1,0,0,1,1.409-1.414l6.3,6.3,6.3-6.3A1,1,0,0,1,340.7,131.7Z" transform="translate(-325 -130)"></path></svg></i>' +
92          "</div>" +
93          '<div class="block_wrap">' +
94          '<div class="block_wrap_inner prices srollbar-custom">';
95
96        if (bPriceCount) {
97          priceHtml += obOffer.PRICE_MATRIX;
98        } else if (obOffer.PRICES_HTML) {
99          priceHtml += obOffer.PRICES_HTML;
100        }
101
102        priceHtml += '<div class="more-btn text-center"></div>';
103        priceHtml += "</div></div></div>";
104        priceHtml +=
105          '<div class="js-show-info-block more-item-info rounded3 bordered-block text-center"><i class="svg inline  svg-inline-fw" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" width="8" height="2" viewBox="0 0 8 2"><path id="Ellipse_292_copy_3" data-name="Ellipse 292 copy 3" class="cls-1" d="M320,4558a1,1,0,1,1-1,1A1,1,0,0,1,320,4558Zm-3,0a1,1,0,1,1-1,1A1,1,0,0,1,317,4558Zm6,0a1,1,0,1,1-1,1A1,1,0,0,1,323,4558Z" transform="translate(-316 -4558)"></path></svg></i></div>';
106        priceHtml += "</div>";
107      } else {
108        priceHtml = $(".cost.detail").html();
109      }
110    } else {
111      priceHtml = $(".cost.detail").html();
112    }
113  }
114
115  if ($(".product-info .complect_prices_block").length) {
116    //show price complect
117    priceHtml = $(".cost.detail").html();
118  }
119
120  if ($("#photo-sku").length) {
121    //show img
122    imgSrc = $("#photo-sku .product-detail-gallery__picture.one").attr("src")
123      ? $("#photo-sku .product-detail-gallery__picture.one").attr("src")
124      : $("#photo-sku .product-detail-gallery__picture").data("src")
125      ? $("#photo-sku .product-detail-gallery__picture").data("src")
126      : $("#photo-sku .product-detail-gallery__picture").attr("src");
127  } else if ($(".product-detail-gallery__slider #photo-0").length) {
128    imgSrc = $(".product-detail-gallery__slider #photo-0 .product-detail-gallery__picture").data("src")
129      ? $(".product-detail-gallery__slider #photo-0 .product-detail-gallery__picture").data("src")
130      : $(".product-detail-gallery__slider #photo-0 .product-detail-gallery__picture").attr("src");
131  }
132  //show button
133  if ($(".slide_offer").length) {
134    buttonHtml =
135      '<span class="buy_block"><span class="btn btn-default btn-sm slide_offer more stay_on_page type_block' +
136      ($(".product-container .buy_block .offer_buy_block .btn").hasClass("has_prediction") ? " has_prediction" : "") +
137      '">' +
138      ($(".product-container .buy_block .offer_buy_block .in-cart").is(":visible")
139        ? $(".product-container .buy_block .offer_buy_block .in-cart").html()
140        : BX.message("MORE_INFO_SKU")) +
141      "</span></span>";
142  } else if ($(".buy_block .sku_props").length) {
143    buttonHtml =
144      '<span class="buy_block"><span class="btn btn-default btn-sm more type_block' +
145      ($(".product-container .buy_block .offer_buy_block .btn").hasClass("has_prediction") ? " has_prediction" : "") +
146      '">' +
147      ($(".product-container .buy_block .offer_buy_block .in-cart").is(":visible")
148        ? $(".product-container .buy_block .offer_buy_block .in-cart").html()
149        : BX.message("MORE_INFO_SKU")) +
150      "</span></span>";
151    // buttonHtml = $('.buy_block .button_block').html().replace(/btn-lg/g, 'btn-sm more ww');
152  } else if ($(".buy_block .button_block").length) {
153    buttonHtml = $(".buy_block .button_block")
154      .html()
155      .replace(/btn-lg/g, "btn-sm");
156  }
157
158  if ($(".product-info .complect_prices_block").length) {
159    //show price complect
160    buttonHtml = $(".buy_complect_wrap").html();
161  }
162
163  if ($(".sku_props .bx_catalog_item_scu > div").length) {
164    var skuHtmlTmp = "";
165    $(".product-container .sku_props .bx_catalog_item_scu > div").each(function () {
166      var _this = $(this),
167        li_block = _this.find("li.active"),
168        select_block = _this.find("select");
169      if (li_block.length) {
170        skuHtmlTmp +=
171          '<div class="bx_catalog_item_scu"><div class="bx_scu"><div class="' +
172          _this.attr("class") +
173          '"><ul><li class="active" title="' +
174          li_block.attr("title") +
175          '">' +
176          li_block.html() +
177          "</li></ul></div></div></div>";
178      } else if (select_block.length) {
179        if (select_block.find("option:selected").data("img_src") !== undefined) {
180          skuHtmlTmp +=
181            '<div class="bx_catalog_item_scu"><div class="bx_scu"><div class="bx_item_detail_scu"><ul><li class="active" title="' +
182            select_block.val() +
183            '"><span class="cnt1"><span class="cnt_item" style="background-image:url(' +
184            select_block.find("option:selected").data("img_src") +
185            ')"></span></span></li></ul></div></div></div>';
186        } else {
187          skuHtmlTmp +=
188            '<div class="bx_catalog_item_scu"><div class="bx_scu"><div class="' +
189            _this.attr("class") +
190            '"><ul><li class="active"><span class="cnt">' +
191            select_block.val() +
192            "</span></li></ul></div></div></div>";
193        }
194      }
195    });
196    skuHtml = skuHtmlTmp.replace(/mCustomScrollbar/g, "");
197  }
198  // setTimeout(function(){
199  $("#headerfixed .logo-row").html(
200    '<div class="ajax_load">' +
201      '<div class="table-view flexbox flexbox--row">' +
202      '<div class="table-view__item item main_item_wrapper">' +
203      '<div class="table-view__item-wrapper item_info catalog-adaptive flexbox flexbox--row">' +
204      '<div class="item-foto">' +
205      '<div class="item-foto__picture">' +
206      '<img src="' +
207      imgSrc +
208      '" />' +
209      "</div>" +
210      "</div>" +
211      '<div class="item-info">' +
212      '<div class="item-title">' +
213      "<span>" +
214      $("#pagetitle").text() +
215      "</span>" +
216      "</div>" +
217      '<div class="wrapp_stockers sa_block">' +
218      ($(".product-info-headnote .rating").length ? '<div class="rating sm-stars">' + ratingHtml + "</div>" : "") +
219      ($(".quantity_block_wrapper .item-stock").length
220        ? '<div class="item-stock">' + $(".quantity_block_wrapper .item-stock").html() + "</div>"
221        : "") +
222      "</div>" +
223      "</div>" +
224      '<div class="item-actions flexbox flexbox--row">' +
225      '<div class="item-price">' +
226      '<div class="cost prices ' +
227      ($(".cost.detail.sku_matrix").length ? "sku_matrix" : "") +
228      '">' +
229      priceHtml +
230      "</div>" +
231      "</div>" +
232      '<div class="item-sku">' +
233      '<div class="but-cell flexbox flexbox--row sku_props">' +
234      skuHtml +
235      "</div>" +
236      "</div>" +
237      '<div class="item-buttons">' +
238      '<div class="but-cell">' +
239      buttonHtml +
240      "</div>" +
241      "</div>" +
242      ($(".product-info .like_icons").length
243        ? '<div class="item-icons s_' +
244          $(".product-info .like_icons").data("size") +
245          '"><div class="like_icons list static icons long">' +
246          $(".product-info .like_icons").html() +
247          "</div></div>"
248        : "") +
249      "</div>" +
250      "</div>" +
251      "</div>" +
252      "</div>" +
253      "</div>"
254  );
255  // },5000)
256
257  InitLazyLoad();
258  InitScrollBar();
259
260  if (typeof obMaxPredictions === "object") {
261    obMaxPredictions.showAll();
262  }
263}
264
265BX.addCustomEvent("onWindowResize", function (eventdata) {
266  if (window.predictionWindow && typeof window.predictionWindow.close === "function") {
267    window.predictionWindow.close();
268  }
269});
270
271$(document).on("click", ".ordered-block.goods .tabs li", function () {
272  setTimeout(sliceItemBlockSlide, 5);
273});
274
275$(document).on("click", ".item-stock .store_view", function () {
276  scroll_block($(".js-store-scroll"), $("a[href=#stores]"));
277});
278
279$(document).on(
280  "click",
281  ".blog-info__rating--top-info, #headerfixed .wproducts .wrapp_stockers .rating .votes_block",
282  function () {
283    var reviews = $(".reviews.EXTENDED");
284    if (reviews.length) {
285      //scroll_block($('.js-store-scroll'), $('.ordered-block .nav-tabs a[href="#reviews"]'));
286      var tabsBlock = $(".ordered-block.tabs-block");
287      var blockToScroll = tabsBlock.length ? tabsBlock : reviews;
288      scroll_block(blockToScroll, $('.ordered-block .nav-tabs a[href="#reviews"]'));
289    }
290  }
291);
292
293$(document).on("click", ".table-view__item--has-stores .item-stock .value", function () {
294  $(this).closest(".table-view__item-wrapper").find(".stores-icons .btn").trigger("click");
295});
296
297$(document).on("click", "#headerfixed .item-buttons .more:not(.stay_on_page)", function () {
298  if ($(".product-container .buy_block .offer_buy_block .to-cart").is(":visible")) {
299    $(".product-container .buy_block .offer_buy_block .to-cart").trigger("click");
300  } else if ($(".middle-info-wrapper .to-cart").is(":visible")) {
301    $(".middle-info-wrapper .to-cart").trigger("click");
302  } else if ($(".product-side .to-cart").is(":visible")) {
303    $(".product-side .to-cart").trigger("click");
304  } else {
305    location.href = arAsproOptions["PAGES"]["BASKET_PAGE_URL"];
306  }
307});
308
309$(document).on("click", "#headerfixed .item-actions .bx_catalog_item_scu", function () {
310  var offset = 0;
311  offset = $(".product-container .sku_props .bx_catalog_item_scu").offset().top;
312
313  $("body, html").animate({ scrollTop: offset - 150 }, 500);
314});
315
316$(document).on("click", ".stores-title .stores-title__list", function () {
317  var _this = $(this);
318  _this.siblings().removeClass("stores-title--active");
319  _this.addClass("stores-title--active");
320
321  $(".stores_block_wrap .stores-amount-list").hide(100).removeClass("stores-amount-list--active");
322  $(".stores_block_wrap .stores-amount-list:eq(" + _this.index() + ")")
323    .show(100, function () {
324      if (_this.hasClass("stores-title--map")) {
325        if (typeof map !== "undefined") {
326          map.container.fitToViewport();
327          if (typeof clusterer !== "undefined" && !$(this).find(".detail_items").is(":visible")) {
328            map.setBounds(clusterer.getBounds(), {
329              zoomMargin: 40,
330              // checkZoomRange: true
331            });
332          }
333        }
334      }
335    })
336    .addClass("stores-amount-list--active");
337});
338
339$(document).on("click", ".info_ext_block .title", function () {
340  var _this = $(this);
341  _this.toggleClass("opened");
342  _this.next().slideToggle();
343});
344
345$(document).on("click", ".stores-icons .btn", function () {
346  var _this = $(this),
347    block = _this.closest(".table-view__item-wrapper").next(),
348    bVisibleblock = block.is(":visible"),
349    animate = bVisibleblock ? "slideUp" : "slideDown";
350
351  if (!_this.hasClass("clicked")) {
352    _this.addClass("clicked");
353
354    block.velocity("stop").velocity(animate, {
355      duration: 400,
356      // delay: 250,
357      begin: function () {
358        _this.toggleClass("closed");
359      },
360      complete: function () {
361        _this.removeClass("clicked");
362        // InitLazyLoad();
363      },
364    });
365  }
366});
367
368var checkFilterLandgings = function () {
369  if ($(".top-content-block .with-filter .with-filter-wrapper").length) {
370    var bActiveClass = false;
371    if ($("#mobilefilter .with-filter-wrapper").length) {
372      if ($("#mobilefilter .with-filter-wrapper .bx_filter_parameters_box").hasClass("active")) {
373        bActiveClass = true;
374      }
375      $("#mobilefilter .with-filter-wrapper").empty();
376      $(".top-content-block .with-filter .with-filter-wrapper").prependTo($("#mobilefilter .with-filter-wrapper"));
377    } else {
378      $(".top-content-block .with-filter .with-filter-wrapper").prependTo($("#mobilefilter .bx_filter_parameters"));
379    }
380    if ($("#mobilefilter .bx_filter_parameters .landings-list__item--active").length || bActiveClass) {
381      $("#mobilefilter .with-filter-wrapper .bx_filter_parameters_box").addClass("active");
382    }
383    $("#mobilefilter .scrollbar").scrollTop(0);
384    if ($("#mobilefilter .bx_filter_parameters.scroll-init").length) {
385      $("#mobilefilter .bx_filter_parameters.scroll-init").mCustomScrollbar("scrollTo", 0);
386    }
387  }
388};
389
390function setFixedBuyBlock() {
391  try {
392    var fixedMobile = arAsproOptions.THEME["FIXED_BUY_MOBILE"] == "Y";
393
394    if (fixedMobile) {
395      var buyBlock = $(".product-action .buy_block");
396      var counterWrapp = $(".product-action .counter_wrapp:not(.services_counter)");
397
398      if (buyBlock.length && counterWrapp.length && !$(".list-offers.ajax_load").length) {
399        if (window.matchMedia("(max-width: 767px)").matches) {
400          if (buyBlock.data("hasCatalog") === undefined) {
401            var hasCatalog = buyBlock.hasClass("catalog_block");
402            buyBlock.data("hasCatalog", hasCatalog);
403          }
404          buyBlock.addClass("catalog_block");
405
406          if (counterWrapp.data("hasList") === undefined) {
407            var hasList = counterWrapp.hasClass("list");
408            counterWrapp.data("hasList", hasList);
409          }
410          counterWrapp.removeClass("list").addClass("fixed");
411        } else {
412          if (buyBlock.data("hasCatalog") !== undefined && !buyBlock.data("hasCatalog")) {
413            buyBlock.removeClass("catalog_block");
414          }
415
416          if (counterWrapp.data("hasList") !== undefined && counterWrapp.data("hasList")) {
417            counterWrapp.addClass("list");
418          }
419          counterWrapp.removeClass("fixed");
420        }
421      }
422    }
423  } catch (e) {}
424}
425
426$(document).ready(function () {
427  lazyLoadPagenBlock();
428  BX.addCustomEvent("onWindowResize", function () {
429    setFixedBuyBlock()
430  });
431  setFixedBuyBlock();
432
433  $(document)
434    .find(".catalog_detail [class^=bx_item_detail] [class*=_scroller_container]")
435    .mCustomScrollbar({
436      mouseWheel: {
437        scrollAmount: 150,
438        preventDefault: true,
439      },
440    });
441});
442
443$(document).on("change", "input.complect_checkbox_item", function () {
444  setNewPriceComplect();
445});
446
447function setNewPriceComplect() {
448  var allCheckbox = $(".complect_main_wrap .complect_checkbox_item:checked");
449  var newPrice = 0;
450  allCheckbox.each(function () {
451    var th = $(this).closest(".catalog-block-view__item").find(".button_block .to-cart");
452    var thPrice = th.attr("data-value");
453    var thQuantity = th.attr("data-quantity");
454    if (thPrice > 0 && thQuantity > 0) {
455      newPrice += thPrice * thQuantity;
456    }
457  });
458  $(".complect_price_value").html(newPrice.toLocaleString("ru"));
459  //console.log(newPrice);
460}

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.