1"use strict"; 2var productList = { 3 _parent: $(".product-list"), ajaxUrl: BX.message("SITE_DIR")+"ajax/add2basket.php", sendAjax: function (t, a, e, s) { 4 $.ajax({ 5 type: "POST", url: s ? s : this.ajaxUrl, data: t, success: function (t) { 6 switch (a) { 7 case"add": 8 e.bs_id = parseInt(t), e.self.find(".btn-cart").removeClass("active"), "undefined" != typeof e.bs_id && e.bs_id ? (bs.updateBasket($(".basket"), e), BX.onCustomEvent('OnBasketChange')) : showModalMess({ 9 type: "danger", 10 message: "ÐÑоизоÑла оÑибка пÑи добавлении ÑоваÑа, попÑобÑйÑе позднее или обÑаÑиÑеÑÑ Ðº админиÑÑÑаÑии." 11 }); 12 break; 13 case"compare": 14 compare.updateCompare($(".compare"), e) 15 } 16 } 17 }) 18 }, setSelectors: function (t) { 19 productList._parent = t, productList._products = productList._parent.find(".product"), productList.setEvents(productList._products) 20 }, setEvents: function (t) { 21 t.each(function (t, a) { 22 var e = { 23 id: $(a).data("id"), 24 self: $(a), 25 section: $(a).data("section"), 26 name: $(a).data("name"), 27 preview: $(a).data("preview"), 28 url: $(a).data("url"), 29 price: $(a).data("price"), 30 quantity: $(a).find(".product-item-amount-field").val() ? $(a).find(".product-item-amount-field").val() : "0" 31 }, s = {id: $(a).data("id"), preview: $(a).data("preview"), quantity: $(a).find(".product-item-amount-field").val() ? $(a).find(".product-item-amount-field").val() : "0"}; 32 $(a).find(".btn-cart").on("click", function (t) { 33 s = {id: $(a).data("id"), preview: $(a).data("preview"), quantity: $(a).find(".product-item-amount-field").val()}; 34 t.preventDefault(), $(this).hasClass("active") || (productList.sendAjax(s, "add", e), $(this).addClass("active")) 35 }), $(a).find(".btn-small.btn-compare").on("click", function (t) { 36 t.preventDefault(), $(this).hasClass("active") ? (s.type = "remove", productList.sendAjax(s, "compare", e, BX.message("SITE_DIR")+"ajax/add2compare.php"), $(this).removeClass("active")) : (s.type = "add", productList.sendAjax(s, "compare", e, BX.message("SITE_DIR")+"ajax/add2compare.php"), $(this).addClass("active")) 37 }) 38 }) 39 }, init: function (t) { 40 var a = t ? t : this._parent = $(".product-list"); 41 a.length > 0 && productList.setSelectors(a) 42 } 43}; 44$(function () { 45 productList.init() 46});
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.