PageSourceSearch

https://kari-san.ua/catalog/view/javascript/common.js?v=1

js kari-san.ua collected 2026-10-06 12:52:59 UTC 18,884 bytes, 453 lines download raw bytes

1function getURLVar(t) {
2    var e = []
3        , o = String(document.location).split("?");
4    if (o[1]) {
5        var a = o[1].split("&");
6        for (i = 0; i < a.length; i++) {
7            var n = a[i].split("=");
8            n[0] && n[1] && (e[n[0]] = n[1])
9        }
10        return e[t] ? e[t] : ""
11    }
12}
13function PushViewProducts(t) {
14    window.dataLayer = window.dataLayer || [],
15        dataLayer.push({
16            ecommerce: {
17                currencyCode: "UAH",
18                add: t
19            },
20            event: "gtm-ee-event",
21            "gtm-ee-event-category": "Enhanced Ecommerce",
22            "gtm-ee-event-action": "Product Impressions",
23            "gtm-ee-event-non-interaction": "True"
24        }),
25        console.log("send-view-ecommerc" + t)
26}
27function PushDelProductsInCart(t) {
28    window.dataLayer = window.dataLayer || [],
29        dataLayer.push({
30            ecommerce: {
31                currencyCode: "UAH",
32                remove: {
33                    products: t
34                }
35            },
36            event: "gtm-ee-event",
37            "gtm-ee-event-category": "Enhanced Ecommerce",
38            "gtm-ee-event-action": "Removing a Product from a Shopping Cart",
39            "gtm-ee-event-non-interaction": "False"
40        }),
41        console.log("send-view-ecommerc PushDelProductsInCart " + t)
42}
43function PushAddProductsInCart(t) {
44    window.dataLayer = window.dataLayer || [],
45        dataLayer.push({
46            ecommerce: {
47                currencyCode: "UAH",
48                add: t
49            },
50            event: "gtm-ee-event",
51            "gtm-ee-event-category": "Enhanced Ecommerce",
52            "gtm-ee-event-action": "Adding a Product to a Shopping Cart",
53            "gtm-ee-event-non-interaction": "False"
54        }),
55        console.log("send-view-ecommerc" + t)
56}
57function PushClickProducts(t, e) {
58    window.dataLayer = window.dataLayer || [],
59        dataLayer.push({
60            ecommerce: {
61                currencyCode: "UAH",
62                click: {
63                    actionField: {
64                        list: "" + e
65                    },
66                    products: t
67                }
68            },
69            event: "gtm-ee-event",
70            "gtm-ee-event-category": "Enhanced Ecommerce",
71            "gtm-ee-event-action": "Product Clicks",
72            "gtm-ee-event-non-interaction": "False"
73        })
74}
75function PushViewProduct(t) {
76    var e = $(".js-product-page").data("referrer")
77        , o = [];
78    o.push({
79        name: t.data("name"),
80        id: t.data("id") + "",
81        price: t.data("price_value").toFixed(2),
82        category: t.data("category"),
83        brand: t.data("brand"),
84        position: t.data("position")
85    }),
86        window.dataLayer = window.dataLayer || [],
87        dataLayer.push({
88            ecommerce: {
89                currencyCode: "UAH",
90                detail: {
91                    actionField: {
92                        list: e
93                    },
94                    products: o
95                }
96            },
97            event: "gtm-ee-event",
98            "gtm-ee-event-category": "Enhanced Ecommerce",
99            "gtm-ee-event-action": "Product Details",
100            "gtm-ee-event-non-interaction": "True"
101        })
102}
103function addQtyToCart(t) {
104    var e = $(".item-" + t).prop("value");
105    (parseFloat(e) != parseInt(e) || isNaN(e)) && (e = 1),
106        cart.add(t, e)
107}
108function EditMinQuant(t) {
109    var e = $(".item-" + t).val()
110        , o = $(".item-" + t).prop("min");
111    parseFloat(e) != parseInt(e) || isNaN(e) ? e = 1 : (qty2 = Number(e) - Number(o),
112        e = qty2 < o ? e : qty2),
113        $(".item-" + t).val(e)
114}
115function EditMaxQuant(t) {
116    var e = $(".item-" + t).val();
117    var max=$(".item-" + t).prop("max");
118
119    e = parseFloat(e) != parseInt(e) || isNaN(e) ? 1 : Number(e) + 1;
120    if(e<=max)
121    {
122        $(".item-" + t).val(e)
123    }
124    else {
125        showAlert('Максимум доступно - '+max);
126    }
127
128}
129function get_popup_purchase(t) {
130    var e = "index.php?route=module/popup_purchase&product_id=" + t;
131    0 == e.indexOf("#") ? $(e).modal("open") : $.get(e, function(t) {
132        $("" + t).modal()
133    }).success(function() {})
134}
135$(document).ready(function() {
136    $(".text-danger").each(function() {
137        var t = $(this).parent().parent();
138        t.hasClass("form-group") && t.addClass("has-error")
139    }),
140        $("#currency .currency-select").on("click", function(t) {
141            t.preventDefault(),
142                $("#currency input[name='code']").attr("value", $(this).attr("name")),
143                $("#currency").submit()
144        }),
145        $("#language a").on("click", function(t) {
146            t.preventDefault(),
147                $("#language input[name='code']").attr("value", $(this).attr("href")),
148                $("#language").submit()
149        }),
150        $("#search input[name='search']").parent().find("button").on("click", function() {
151            url = $("base").attr("href") + "index.php?route=product/search";
152            var t = $("header input[name='search']").val();
153            t && (url += "&search=" + encodeURIComponent(t)),
154                location = url
155        }),
156        $("#search input[name='search']").on("keydown", function(t) {
157            13 == t.keyCode && $("header input[name='search']").parent().find("button").trigger("click")
158        }),
159        $("#menu .dropdown-menu").each(function() {
160            var t = $("#menu").offset()
161                , e = $(this).parent().offset().left + $(this).outerWidth() - (t.left + $("#menu").outerWidth());
162            e >
162 0 && $(this).css("margin-left", "-" + (e + 5) + "px")
163        }),
164        $("#list-view").click(function() {
165            $("#content .product-grid > .clearfix").remove(),
166                $("#content .row > .product-grid").attr("class", "product-layout product-list col-xs-12"),
167                localStorage.setItem("display", "list")
168        }),
169        $("#grid-view").click(function() {
170            cols = $("#column-right, #column-left").length,
171                2 == cols ? $("#content .product-list").attr("class", "product-layout product-grid col-lg-6 col-md-6 col-sm-12 col-xs-12") : 1 == cols ? $("#content .product-list").attr("class", "product-layout product-grid col-lg-4 col-md-4 col-sm-6 col-xs-12") : $("#content .product-list").attr("class", "product-layout product-grid col-lg-3 col-md-3 col-sm-6 col-xs-12"),
172                localStorage.setItem("display", "grid")
173        }),
174        "list" == localStorage.getItem("display") ? $("#list-view").trigger("click") : $("#grid-view").trigger("click"),
175        $(document).on("keydown", "#collapse-checkout-option input[name='email'], #collapse-checkout-option input[name='password']", function(t) {
176            13 == t.keyCode && $("#collapse-checkout-option #button-login").trigger("click")
177        }),
178        $("[data-toggle='tooltip']").tooltip({
179            container: "body",
180            trigger: "hover"
181        }),
182        $(document).ajaxStop(function() {
183            $("[data-toggle='tooltip']").tooltip({
184                container: "body"
185            })
186        })
187});
188var cart = {
189    add: function(t, e) {
190        $.ajax({
191            url: "index.php?route=checkout/cart/add",
192            type: "post",
193            data: "product_id=" + t + "&quantity=" + (void 0 !== e ? e : 1),
194            dataType: "json",
195            beforeSend: function() {
196                $("#cart > a").button("loading")
197            },
198            complete: function() {
199                $("#cart > a").button("reset")
200            },
201            success: function(t) {
202                if ($(".alert, .text-danger").remove(),
203                t.redirect && (location = t.redirect),
204                    t.success) {
205                    var e = $('<div class="alert_add_cart">' + t.success + '<span class="rem_alert"></span></div>');
206                    $(e).appendTo(".special_block_info .block_info"),
207                        setTimeout(function() {
208                            $(e).fadeOut(400, function() {})
209                        }, 2500),
210                        setTimeout(function() {
211                            $("#cart > a").html('<i class="icon-shopping-cart-1"></i><span id="cart-total" class="count_item"> ' + t.total + "</span>")
212                        }, 100),
213                        $(".btn-primary").blur(),
214                        localStorage.removeItem("show_customer_info"),
215                        $("body").append(t.datalayer),
216                        sendAddToCartFbAnalytic(t.dataForAddToCartFbAnalytic)
217                }
218            },
219            error: function(t, e, o) {
220                alert(o + "\r\n" + t.statusText + "\r\n" + t.responseText)
221            }
222        })
223    },
224    update: function(t, e) {
225        $.ajax({
226            url: "index.php?route=checkout/cart/edit",
227            type: "post",
228            data: "key=" + t + "&quantity=" + (void 0 !== e ? e : 1),
229            dataType: "json",
230            beforeSend: function() {
231                $("#cart > a").button("loading")
232            },
233            complete: function() {
234                $("#cart > a").button("reset")
235            },
236            success: function(t) {
237                setTimeout(function() {
238                    $("#cart > a").html('<i class="icon-shopping-cart-1"></i><span id="cart-total" class="count_item"> ' + t.total + "</span>")
239                }, 100),
240                    "checkout/cart" == getURLVar("route") || "checkout/checkout" == getURLVar("route") ? location = "index.php?route=checkout/cart" : $("#cart > ul").load("index.php?route=common/cart/info ul li")
241            },
242            error: function(t, e, o) {
243                alert(o + "\r\n" + t.statusText + "\r\n" + t.responseText)
244            }
245        })
246    },
247    remove: function(t) {
248        $.ajax({
249            url: "index.php?route=checkout/cart/remove",
250            type: "post",
251            data: "key=" + t,
252            dataType: "json",
253            beforeSend: function() {
254                $("#cart > a").button("loading")
255            },
256            complete: function() {
257                $("#cart > a").button("reset")
258            },
259            success: function(t) {
260                setTimeout(function() {
261                    $("#cart > a").html('<i class="icon-shopping-cart-1"></i><span id="cart-total" class="count_item">' + t.total + "</span>")
262                }, 100),
263                    "checkout/cart" == getURLVar("route") || "checkout/checkout" == getURLVar("route") ? location = "index.php?route=checkout/cart" : $("#cart > ul").load("index.php?route=common/cart/info ul li")
264            },
265            error: function(t, e, o) {
266                alert(o + "\r\n" + t.statusText + "\r\n" + t.responseText)
267            }
268        })
269    }
270}
271    , voucher = {
272    add: function() {},
273    remove: function(t) {
274        $.ajax({
275            url: "index.php?route=checkout/cart/remove",
276            type: "post",
277            data: "key=" + t,
278            dataType: "json",
279            beforeSend: function() {
280                $("#cart > a").button("loading")
281            },
282            complete: function() {
283                $("#cart > a").button("reset")
284            },
285            success: function(t) {
286                setTimeout(function() {
287                    $("#cart > a").html('<i class="icon-shopping-cart-1"></i><span id="cart-total" class="count_item"> ' + t.total + "</span>")
288                }, 100),
289                    "checkout/cart" == getURLVar("route") || "checkout/checkout" == getURLVar("route") ? location = "index.php?route=checkout/cart" : $("#cart > ul").load("index.php?route=common/cart/info ul li")
290            },
291            error: function(t, e, o) {
292                alert(o + "\r\n" + t.statusText + "\r\n" + t.responseText)
293            }
294        })
295    }
296}
297    , wishlist = {
298    add: function(t) {
299        $.ajax({
300            url: "index.php?route=account/wishlist/add",
301            type: "post",
302            data: "product_id=" + t,
303            dataType: "json",
304            success: function(t) {
305                if ($(".alert").remove(),
306                t.redirect && (location = t.redirect),
307                    t.success) {
308                    var e = $('<div class="alert_add_wishlist">' + t.success + '<span class="rem_alert"></span></div>');
309                    $(e).appendTo(".special_block_info .block_info"),
310                        setTimeout(function() {
311                            $(e).fadeOut(400, function() {
312                                $(e).remove()
313                            })
314                        }, 2500),
315                    t.dataForAddToWishlistFbAnalytic && addProductToWishlistFbAnalytic(t.dataForAddToWishlistFbAnalytic)
316                }
317                $("#wishlist-total span").html(t.total),
318                    $("#wishlist-total").attr("title", t.total),
319                    $("html, body").animate({
320                        scrollTop: 0
321                    }, "slow")
322            },
323            error: function(t, e, o) {
324                alert(o + "\r\n" + t.statusText + "\r\n" + t.responseText)
325            }
326        })
327    },
328    remove: function() {}
329}
330    , compare = {
331    add: function(t) {
332        $.ajax({
333            url: "index.php?route=product/compare/add",
334            type: "post",
335            data: "product_id=" + t,
336            dataType: "json",
337            success: function(t) {
338                $(".alert").remove(),
339                t.success && ($("#content").parent().before('<div class="alert alert-success"> ' + t.success + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>'),
340                    $("#compare-total").html(t.total),
341                    $("html, body").animate({
342                        scrollTop: 0
343                    }, "slow"))
344            },
345            error: function(t, e, o) {
346                alert(o + "\r\n" + t.statusText + "\r\n" + t.responseText)
347            }
348        })
349    },
350    remove: function() {}
351};
352$(document).delegate(".agree", "click", function(t) {
353    t.preventDefault(),
354        $("#modal-agree").remove();
355    var e = this;
356    $.ajax({
357        url: $(e).attr("href"),
358        type: "get",
359        dataType: "html",
360        success: function(t) {
361            html = '<div id="modal-agree" class="modal">',
362                html += '  <div class="modal-dialog">',
363                html += '    <div class="modal-content">',
364                html += '      <div class="modal-header">',
365                html += '        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>',
366                html += '        <h4 class="modal-title">' + $(e).text() + "</h4>",
367                html += "      </div>",
368                html += '      <div class="modal-body">' + t + "</div>",
369                html += "    </div",
370                html += "  </div>",
371                html += "</div>",
372                $("body").append(html),
373                $("#modal-agree").modal("show")
374        }
375    })
376}),
377    function(t) {
378        t.fn.autocomplete = function(e) {
379            return this.each(function() {
380                this.timer = null,
381                    this.items = new Array,
382                    t.extend(this, e),
383                    t(this).attr("autocomplete", "off"),
384                    t(this).on("focus", function() {
385                        this.request()
386                    }),
387                    t(this).on("blur", function() {
388                        setTimeout(function(t) {
389                            t.hide()
390                        }, 200, this)
391                    }),
392                    t(this).on("keydown", function(t) {
393                        switch (t.keyCode) {
394                            case 27:
395                                this.hide();
396                                break;
397                            default:
398                                this.request()
399                        }
400                    }),
401                    this.click = function(e) {
402                        e.preventDefault(),
403                            value = t(e.target).parent().attr("data-value"),
404                        value && this.items[value] && this.select(this.items[value])
405                    }
406                    ,
407                    this.show = function() {
408                        var e = t(this).position();
409                        t(this).siblings("ul.dropdown-menu").css({
410                            top: e.top + t(this).outerHeight(),
411                            left: e.left
412                        }),
413                            t(this).siblings("ul.dropdown-menu").show()
414                    }
415                    ,
416                    this.hide = function() {
417                        t(this).siblings("ul.dropdown-menu").hide()
418                    }
419                    ,
420                    this.request = function() {
421                        clearTimeout(this.timer),
422                            this.timer = setTimeout(function(e) {
423                                e.source(t(e).val(), t.proxy(e.response, e))
424                            }, 200, this)
425                    }
426                    ,
427                    this.response = function(e) {
428                        if (html = "",
429                            e.length) {
430                            for (i = 0; i < e.length; i++)
431                                this.items[e[i].value] = e[i];
432                            for (i = 0; i < e.length; i++)
433                                e[i].category || (html += '<li data-value="' + e[i].value + '"><a href="#">' + e[i].label + "</a></li>");
434                            var o = new Array;
435                            for (i = 0; i < e.length; i++)
436                                e[i].category && (o[e[i].category] || (o[e[i].category] = new Array,
437                                    o[e[i].category].name = e[i].category,
438                                    o[e[i].category].item = new Array),
439                                    o[e[i].category].item.push(e[i]));
440                            for (i in o)
441                                for (html += '<li class="dropdown-header">' + o[i].name + "</li>",
442                                         j = 0; j < o[i].item.length; j++)
443                                    html += '<li data-value="' + o[i].item[j].value + '"><a href="#">&nbsp;&nbsp;&nbsp;' + o[i].item[j].label + "</a></li>"
444                        }
445                        html ? this.show() : this.hide(),
446                            t(this).siblings("ul.dropdown-menu").html(html)
447                    }
448                    ,
449                    t(this).after('<ul class="dropdown-menu"></ul>'),
450                    t(this).siblings("ul.dropdown-menu").delegate("a", "click", t.proxy(this.click, this))
451            })
452        }
453    }(window.jQuery);

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.