PageSourceSearch

http://malyar.kz/local/templates/aspro_max/components/bitrix/catalog/main/script.js?171144583819831

js malyar.kz collected 2026-09-28 22:58:07 UTC 19,831 bytes, 485 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:first > 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      typeof obOffer == "undefined" &&
51      BX.util.object_search_key("ASPRO_ITEM_POPUP_PRICE", BX.message) &&
52      BX.message("ASPRO_ITEM_POPUP_PRICE") == "Y"
53    ) {
54      var obOffer = {
55        SHOW_POPUP_PRICE: false,
56        PRICES_COUNT: BX.message("ASPRO_ITEM_PRICES"),
57      };
58      if (BX.util.object_search_key("ASPRO_ITEM_PRICE_MATRIX", BX.message)) {
59        obOffer.USE_PRICE_COUNT = true;
60        obOffer.PRICE_MATRIX_HTML = BX.message("ASPRO_ITEM_PRICE_MATRIX");
61      } else if (BX.util.object_search_key("ASPRO_ITEM_PRICE", BX.message)) {
62        obOffer.PRICES_HTML = BX.message("ASPRO_ITEM_PRICE");
63      }
64    }
65
66    if (typeof obOffer !== "undefined") {
67      if (
68        !obOffer.SHOW_POPUP_PRICE &&
69        (("PRICES_COUNT" in obOffer && obOffer.PRICES_COUNT > 1) ||
70          ("PRICES" in obOffer && Object.keys(obOffer.PRICES).length > 1) ||
71          ("ITEM_PRICES" in obOffer && Object.keys(obOffer.ITEM_PRICES).length > 1))
72      ) {
73        var bPriceCount = obOffer.USE_PRICE_COUNT && obOffer.PRICE_MATRIX_HTML,
74          topPrice = "";
75
76        if (bPriceCount) {
77          if ($("div:not(.adaptive-block)>.cost.detail .with_matrix:visible").length) {
78            topPrice = $("div:not(.adaptive-block)>.cost.detail .with_matrix:visible").html();
79          } else {
80            topPrice = '<div class="prices-wrapper">' + $("div:not(.adaptive-block)>.cost.detail").html() + "</div>";
81          }
82        } else {
83          topPrice = '<div class="prices-wrapper">' + obOffer.PRICES_HTML + "</div>";
84        }
85
86        priceHtml = '<div class="with_matrix pl with_old price_matrix_wrapper">' + topPrice + "</div>";
87        priceHtml += '<div class="js_price_wrapper">';
88        priceHtml +=
89          '<div class="js-info-block rounded3">' +
90          '<div class="block_title text-upper font_xs font-bold">' +
91          BX.message("PRICES_TYPE") +
92          '<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>' +
93          "</div>" +
94          '<div class="block_wrap">' +
95          '<div class="block_wrap_inner prices scrollblock">';
96
97        if (bPriceCount) {
98          priceHtml += obOffer.PRICE_MATRIX_HTML;
99        } else if (obOffer.PRICES_HTML) {
100          priceHtml += obOffer.PRICES_HTML;
101        }
102
103        priceHtml += '<div class="more-btn text-center"></div>';
104        priceHtml += "</div></div></div>";
105        priceHtml +=
106          '<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>';
107        priceHtml += "</div>";
108      } else {
109        priceHtml = $("div:not(.adaptive-block)>.cost.detail").html();
110      }
111    } else {
112      priceHtml = $("div:not(.adaptive-block)>.cost.detail").html();
113    }
114  }
115
116  if ($(".product-info .complect_prices_block").length) {
117    //show price complect
118    priceHtml = $(".cost.detail").html();
119  }
120
121  let bonusHtml = '';
122  let bonusBlockDetail = $("div:not(.adaptive-block)>.cost.detail ~ .bonus-system-block");
123  if (bonusBlockDetail.length) { 
124    bonusHtml = bonusBlockDetail[0].outerHTML;
125  }
126
127  if ($("#photo-sku").length) {
128    //show img
129    imgSrc = $("#photo-sku .detail-gallery-big__picture.one").attr("src")
130      ? $("#photo-sku .detail-gallery-big__picture.one").attr("src")
131      : $("#photo-sku .detail-gallery-big__picture").data("src")
132      ? $("#photo-sku .detail-gallery-big__picture").data("src")
133      : $("#photo-sku .detail-gallery-big__picture").attr("src");
134  } else if ($(".detail-gallery-big #photo-0").length) {
135    imgSrc = $(".detail-gallery-big #photo-0 .detail-gallery-big__picture").data("src")
136      ? $(".detail-gallery-big #photo-0 .detail-gallery-big__picture").data("src")
137      : $(".detail-gallery-big #photo-0 .detail-gallery-big__picture").attr("src");
138  }
139  //show button
140  if ($(".slide_offer").length) {
141    if($('.product-container .buy_block .to-order').length) {
142      buttonHtml = '<span class="buy_block">' + 
143        $('.product-container .buy_block .to-order').clone().wrap('<div/>').parent().html().replace('btn-lg', 'btn-sm') +
144      '</span>';
145    }else if($('.product-container .buy_block .to-subscribe').length){
146      buttonHtml = '<span class="buy_block">' + 
147        $('.product-container .buy_block .to-subscribe').clone().wrap('<div/>').parent().html().replace('btn-lg', 'btn-sm') +
148        $('.product-container .buy_block .in-subscribe').clone().wrap('<div/>').parent().html().replace('btn-lg', 'btn-sm') +
149      '</span>';
150    }else if ($('.product-container .buy_block .btn').length) {
151      buttonHtml =
152        '<span class="buy_block"><span class="btn btn-default btn-sm slide_offer more stay_on_page type_block' +
153        ($(".product-container .buy_block .offer_buy_block .btn").hasClass("has_prediction") ? " has_prediction" : "") +
154        '">' +
155        ($(".product-container .buy_block .offer_buy_block .in-cart").is(":visible")
156          ? $(".product-container .buy_block .offer_buy_block .in-cart").html()
157          : BX.message("MORE_INFO_SKU")) +
158        "</span></span>";
159    }
160  } else if ($(".buy_block .sku_props").length) {
161    if ($('.product-container .buy_block .btn--out-of-production').length) {
162      buttonHtml = '<span class="buy_block">' + 
163        $('.product-container .buy_block .btn--out-of-production').clone().wrap('<div/>').parent().html().replace('btn-lg', 'btn-sm') +
164      '</span>';
165    } else if($('.product-container .buy_block .to-order').length) {
166      buttonHtml = '<span class="buy_block">' + 
167        $('.product-container .buy_block .to-order').clone().wrap('<div/>').parent().html().replace('btn-lg', 'btn-sm') +
168      '</span>';
169    }else if($('.product-container .buy_block .to-subscribe').length){
170      buttonHtml = '<span class="buy_block">' + 
171        $('.product-container .buy_block .to-subscribe').clone().wrap('<div/>').parent().html().replace('btn-lg', 'btn-sm') +
172        $('.product-container .buy_block .in-subscribe').clone().wrap('<div/>').parent().html().replace('btn-lg', 'btn-sm') +
173      '</span>';
174    }else if ($('.product-container .buy_block .btn').length) {
175      buttonHtml =
176        '<span class="buy_block"><span class="btn btn-default btn-sm more type_block' +
177        ($(".product-container .buy_block .offer_buy_block .btn").hasClass("has_prediction") ? " has_prediction" : "") +
178        '">' +
179        ($(".product-container .buy_block .offer_buy_block .in-cart").is(":visible")
180          ? $(".product-container .buy_block .offer_buy_block .in-cart").html()
181          : BX.message("MORE_INFO_SKU")) +
182        "</span></span>";
183    }
184    // buttonHtml = $('.buy_block .button_block').html().replace(/btn-lg/g, 'btn-sm more ww');
185  } else if ($(".buy_block .button_block").length) {
186    buttonHtml = $(".buy_block .button_block")
187      .html()
188      .replace(/btn-lg/g, "btn-sm");
189  }
190
191  if ($(".product-info .complect_prices_block").length) {
192    //show price complect
193    buttonHtml = $(".buy_complect_wrap").html();
194  }
195
196  if ($(".sku_props .bx_catalog_item_scu > div").length) {
197    var skuHtmlTmp = "";
198    $(".product-container .sku_props .bx_catalog_item_scu > .item_wrapper > div").each(function () {
199      var _this = $(this),
200        li_block = _this.find("li.active"),
201        select_block = _this.find("select");
202      if (li_block.length) {
203        skuHtmlTmp +=
204          '<div class="bx_catalog_item_scu"><div class="bx_scu"><div class="' +
205          _this.attr("class") +
206          '"><ul><li class="active" title="' +
207          li_block.attr("title") +
208          '">' +
209          li_block.html() +
210          "</li></ul></div></div></div>";
211      } else if (select_block.length) {
212        if (select_block.find("option:selected").data("img_src") !== undefined) {
213          skuHtmlTmp +=
214            '<div class="bx_catalog_item_scu"><div class="bx_scu"><div class="bx_item_detail_scu"><ul><li class="active" title="' +
215            select_block.val() +
216            '"><span class="cnt1"><span class="cnt_item" style="background-image:url(' +
217            select_block.find("option:selected").data("img_src") +
218            ')"></span></span></li></ul></div></div></div>';
219        } else {
220          skuHtmlTmp +=
221            '<div class="bx_catalog_item_scu"><div class="bx_scu"><div class="' +
222            _this.attr("class") +
223            '"><ul><li class="active"><span class="cnt">' +
224            select_block.val() +
225            "</span></li></ul></div></div></div>";
226        }
227      }
228    });
229    skuHtml = skuHtmlTmp.replace(/mCustomScrollbar/g, "");
230  }
231  // setTimeout(function(){
232  $("#headerfixed .logo-row").html(
233    '<div class="ajax_load">' +
234      '<div class="table-view flexbox flexbox--row">' +
235      '<div class="table-view__item item main_item_wrapper">' +
236      '<div class="table-view__item-wrapper item_info catalog-adaptive flexbox flexbox--row">' +
237      '<div class="item-foto">' +
238      '<div class="item-foto__picture">' +
239      '<img src="' +
240      imgSrc +
241      '" />' +
242      "</div>" +
243      "</div>" +
244      '<div class="item-info">' +
245      '<div class="item-title">' +
246      "<span>" +
247      $("#pagetitle").text() +
248      "</span>" +
249      "</div>" +
250      '<div class="wrapp_stockers sa_block">' +
251      ($(".product-info-headnote .rating").length ? '<div class="rating sm-stars">' + ratingHtml + "</div>" : "") +
252      ($(".product-main .quantity_block_wrapper .item-stock:visible").length
253        ? '<div class="item-stock">' + $(".product-main .quantity_block_wrapper .item-stock:visible").html() + "</div>"
254        : "") +
255      "</div>" +
256      "</div>" +
257      '<div class="item-actions flexbox flexbox--row">' +
258      '<div class="item-price">' +
259      '<div class="cost prices ' +
260      ($(".cost.detail.sku_matrix").length ? "sku_matrix" : "") +
261      '">' +
262      priceHtml +
263      "</div>" +
264      bonusHtml +
265      "</div>" +
266      '<div class="item-sku">' +
267      '<div class="but-cell flexbox flexbox--row sku_props">' +
268      skuHtml +
269      "</div>" +
270      "</div>" +
271      '<div class="item-buttons">' +
272      '<div class="but-cell">' +
273      buttonHtml +
274      "</div>" +
275      "</div>" +
276      ($(".product-info .like_icons").length
277        ? '<div class="item-icons s_' +
278          $(".product-info .like_icons").data("size") +
279          '"><div class="like_icons list static icons long">' +
280          $(".product-info .like_icons").html() +
281          "</div></div>"
282        : "") +
283      "</div>" +
284      "</div>" +
285      "</div>" +
286      "</div>" +
287      "</div>"
288  );
289  // },5000)
290
291  InitLazyLoad();
292
293  if (typeof obMaxPredictions === "object") {
294    obMaxPredictions.showAll();
295  }
296}
297
298BX.addCustomEvent("onWindowResize", function (eventdata) {
299  if (window.predictionWindow && typeof window.predictionWindow.close === "function") {
300    window.predictionWindow.close();
301  }
302});
303
304$(document).on("click", ".ordered-block.goods .tabs li", function () {
305  setTimeout(sliceItemBlockSlide, 5);
306});
307
308$(document).on("click", ".item-stock .store_view", function () {
309  scroll_block($(".js-store-scroll"), $("a[href='#stores']"));
310});
311
312$(document).on(
313  "click",
314  ".blog-info__rating--top-info, #headerfixed .wproducts .wrapp_stockers .rating .votes_block",
315  function () {
316    var reviews = $(".reviews.EXTENDED");
317    if (reviews.length) {
318      //scroll_block($('.js-store-scroll'), $('.ordered-block .nav-tabs a[href="#reviews"]'));
319      var tabsBlock = $(".ordered-block.tabs-block");
320      var blockToScroll = tabsBlock.length ? tabsBlock : reviews;
321      scroll_block(blockToScroll, $('.ordered-block .nav-tabs a[href="#reviews"]'));
322    }
323  }
324);
325
326$(document).on("click", ".table-view__item--has-stores .item-stock .value", function () {
327  $(this).closest(".table-view__item-wrapper").find(".stores-icons .btn").trigger("click");
328});
329
330$(document).on("click", "#headerfixed .item-buttons .more:not(.stay_on_page)", function () {
331  if ($(".product-container .buy_block .offer_buy_block .to-cart").is(":visible")) {
332    $(".product-container .buy_block .offer_buy_block .to-cart").trigger("click");
333  } else if ($(".middle-info-wrapper .to-cart").is(":visible")) {
334    $(".middle-info-wrapper .to-cart").trigger("click");
335  } else if ($(".product-side .to-cart").is(":visible")) {
336    $(".product-side .to-cart").trigger("click");
337  } else {
338    location.href = arAsproOptions["PAGES"]["BASKET_PAGE_URL"];
339  }
340});
341
342$(document).on("click", "#headerfixed .item-actions .bx_catalog_item_scu", function () {
343  var offset = 0;
344  offset = $(".product-container .sku_props .bx_catalog_item_scu").offset().top;
345
346  $("body, html").animate({ scrollTop: offset - 150 }, 500);
347});
348
349$(document).on("click", ".stores-title .stores-title__list", function () {
350  var _this = $(this);
351  _this.siblings().removeClass("stores-title--active");
352  _this.addClass("stores-title--active");
353
354  $(".stores_block_wrap .stores-amount-list").removeClass("stores-amount-list--active");
355  $(".stores_block_wrap .stores-amount-list:eq(" + _this.index() + ")").addClass("stores-amount-list--active").queue(function(){
356    if (_this.hasClass("stores-title--map")) {
357      if (typeof map !== "undefined") {
358        map.container.fitToViewport();
359        if (typeof clusterer !== "undefined" && !$(this).find(".detail_items").is(":visible")) {
360          map.setBounds(clusterer.getBounds(), {
361            zoomMargin: 40,
362            // checkZoomRange: true
363          });
364        }
365      }
366    }
367  });
368});
369
370$(document).on("click", ".info_ext_block .title", function () {
371  var _this = $(this);
372  _this.toggleClass("opened");
373  _this.next().slideToggle();
374});
375
376$(document).on("click", ".stores-icons .btn", function () {
377  var _this = $(this),
378    block = _this.closest(".table-view__item-wrapper").next(),
379    bVisibleblock = block.is(":visible"),
380    animate = bVisibleblock ? "slideUp" : "slideDown";
381
382  if (!_this.hasClass("clicked")) {
383    _this.addClass("clicked");
384
385    block.stop().slideToggle({
386      start: () => {
387        _this.toggleClass("closed");
388      },
389      duration: 400,
390      done: () => {
391      _this.removeClass("clicked");
392    }
393  })
394  }
395});
396
397var checkFilterLandgings = function () {
398  if ($(".top-content-block .with-filter .with-filter-wrapper").length) {
399    var bActiveClass = false;
400    if ($("#mobilefilter .with-filter-wrapper").length) {
401      if ($("#mobilefilter .with-filter-wrapper .bx_filter_parameters_box").hasClass("active")) {
402        bActiveClass = true;
403      }
404      $("#mobilefilter .with-filter-wrapper").empty();
405      $(".top-content-block .with-filter .with-filter-wrapper").prependTo($("#mobilefilter .with-filter-wrapper"));
406    } else {
407      $(".top-content-block .with-filter .with-filter-wrapper").prependTo($("#mobilefilter .bx_filter_parameters"));
408    }
409    if ($("#mobilefilter .bx_filter_parameters .landings-list__item--active").length || bActiveClass) {
410      $("#mobilefilter .with-filter-wrapper .bx_filter_parameters_box").addClass("active");
411    }
412    $("#mobilefilter .scrollbar").scrollTop(0);
413  }
414};
415
416function setFixedBuyBlock() {
417  try {
418    var fixedMobile = arAsproOptions.THEME["FIXED_BUY_MOBILE"] == "Y";
419
420    if (fixedMobile) {
421      var buyBlock = $(".product-action .buy_block");
422      var counterWrapp = $(".product-action .counter_wrapp:not(.services_counter)");
423
424      if (buyBlock.length && counterWrapp.length && !$(".list-offers.ajax_load").length) {
425        if (window.matchMedia("(max-width: 767px)").matches) {
426          if (buyBlock.data("hasCatalog") === undefined) {
427            var hasCatalog = buyBlock.hasClass("catalog_block");
428            buyBlock.data("hasCatalog", hasCatalog);
429          }
430          buyBlock.addClass("catalog_block");
431
432          if (counterWrapp.data("hasList") === undefined) {
433            var hasList = counterWrapp.hasClass("list");
434            counterWrapp.data("hasList", hasList);
435          }
436          counterWrapp.removeClass("list").addClass("fixed");
437        } else {
438          if (buyBlock.data("hasCatalog") !== undefined && !buyBlock.data("hasCatalog")) {
439            buyBlock.removeClass("catalog_block");
440          }
441
442          if (counterWrapp.data("hasList") !== undefined && counterWrapp.data("hasList")) {
443            counterWrapp.addClass("list");
444          }
445          counterWrapp.removeClass("fixed");
446        }
447      }
448    }
449  } catch (e) {}
450}
451
452$(document).ready(function () {
453  lazyLoadPagenBlock();
454  BX.addCustomEvent("onWindowResize", function () {
455    setFixedBuyBlock();
456  });
457  setFixedBuyBlock();
458});
459
460$(document).on("change", "input.complect_checkbox_item", function () {
461  setNewPriceComplect();
462});
463
464function setNewPriceComplect() {
465  var allCheckbox = $(".complect_main_wrap .complect_checkbox_item:checked");
466  var newPrice = 0;
467  allCheckbox.each(function () {
468    var th = $(this).closest(".catalog-block-view__item").find(".button_block .to-cart");
469    var thPrice = th.attr("data-value");
470    var thQuantity = th.attr("data-quantity");
471    if (thPrice > 0 && thQuantity > 0) {
472      newPrice += thPrice * thQuantity;
473    }
474  });
475  $(".complect_price_value").html(newPrice.toLocaleString("ru"));
476  //console.log(newPrice);
477}
478
479BX.addCustomEvent("onCompleteAction", function (eventdata) {
480  if (eventdata.action === "ajaxContentLoaded" || eventdata.action === "jsLoadBlock") {
481    if (typeof window.tableScrollerOb === "object" && window.tableScrollerOb) {
482      window.tableScrollerOb.toggle();
483    }
484  }
485});

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.