1/* NM: Add-to-cart script */ 2(function(c) { 3 c.extend(c.nmTheme, { 4 atc_init: function() { 5 this.atcBind() 6 }, 7 atcBind: function() { 8 var d = this; 9 d.$body.on("click", ".single_add_to_cart_button", function(a) { 10 var b = c(this); 11 if (b.is(".disabled")) console.log("NM: Add-to-cart button disabled"); 12 else if (b.hasClass("nm-simple-add-to-cart-button") || b.hasClass("nm-variable-add-to-cart-button")) a.preventDefault(), d.quickviewOpen = d.quickviewIsOpen(), d.quickviewOpen && b.addClass("nm-loader nm-loader-light"), b.attr("disabled", "disabled"), a = b.closest("form"), a.length && 13 (a = { 14 product_id: a.find("[name*='add-to-cart']").val(), 15 product_variation_data: a.serialize() 16 }, d.$body.trigger("adding_to_cart", [b, a]), d.atcAjaxSubmitForm(b, a)) 17 }) 18 d.$body.on("click", ".add_to_cart_button", function(a) { 19 var b = c(this); 20 if (b.is(".disabled")) console.log("NM: Add-to-cart button disabled"); 21 else if (b.hasClass("product_type_simple")) a.preventDefault(), b.attr("disabled", "disabled"), 22 (a = { 23 product_id: b.data("product_id"), 24 product_variation_data: "quantity=1" 25 }, d.$body.trigger("adding_to_cart", [b, a]), d.atcAjaxSubmitForm(b, a)) 26 }) 27 }, 28 atcAjaxSubmitForm: function(d, a) { 29 var b = this; 30 if (a.product_id) { 31 if ("undefined" !== typeof wc_add_to_cart_params) var e = wc_add_to_cart_params.wc_ajax_url; 32 else console.log('NM: "wc_add_to_cart_params" undefined - WooCommerce AJAX atc disabled'), e = nm_wp_vars.woocommerceAjaxUrl; 33 e = e.toString().replace("wc-ajax=%%endpoint%%", "add-to-cart=" + a.product_id + 34 "&nm-ajax-add-to-cart=1"); 35 c.ajax({ 36 type: "POST", 37 url: e, 38 data: a.product_variation_data, 39 dataType: "html", 40 cache: !1, 41 headers: { 42 "cache-control": "no-cache" 43 }, 44 error: function(b, a, c) { 45 console.log("NM: AJAX error - atcAjaxSubmitForm() - " + c) 46 }, 47 success: function(a) { 48 a = c("<div>" + a + "</div>"); 49 var f = a.find("#nm-shop-notices-wrap"), 50 e = f.find(".woocommerce-error").length ? !0 : !1; 51 f = { 52 ".nm-menu-cart-count": a.find(".nm-menu-cart-count").prop("outerHTML"), 53 "#nm-shop-notices-wrap": f.prop("outerHTML"), 54 "#nm-cart-panel": a.find("#nm-cart-panel").prop("outerHTML") 55 }; 56 b.shopReplaceFragments(f); 57 b.$body.trigger("added_to_cart", [f, ""]); 58 b.quickviewOpen ? (c.magnificPopup.close(), e ? b.isShop && b.shopScrollToTop() : b.$widgetPanel.length && setTimeout(function() { 59 b.widgetPanelShow(!1, !0) 60 }, 350)) : (d.removeAttr("disabled"), e && setTimeout(function() { 61 c("#nm-widget-panel-overlay").trigger("click"); 62 b.isShop && b.shopScrollToTop() 63 }, 500)); 64 a.empty() 65 } 66 }) 67 } else console.log("NM (Error): No product id found") 68 } 69 }); 70 c.nmThemeExtensions.add_to_cart = c.nmTheme.atc_init 71})(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.