PageSourceSearch

https://amici-london.com/wp-content/plugins/add-to-cart-direct-che…/public/js/pi-dcw-public.js?ver=1.3.9.11

js amici-london.com collected 2026-09-27 03:55:52 UTC 3,694 bytes, 129 lines download raw bytes

1(function ($) {
2	'use strict';
3
4	/**
5	 * All of the code for your public-facing JavaScript source
6	 * should reside in this file.
7	 *
8	 * Note: It has been assumed you will write jQuery code here, so the
9	 * $ function reference has been prepared for usage within the scope
10	 * of this function.
11	 *
12	 * This enables you to define handlers, for when the DOM is ready:
13	 *
14	 * $(function() {
15	 *
16	 * });
17	 *
18	 * When the window is loaded:
19	 *
20	 * $( window ).load(function() {
21	 *
22	 * });
23	 *
24	 * ...and/or other possibilities.
25	 *
26	 * Ideally, it is not considered best practise to attach more than a
27	 * single DOM-ready or window-load handler for a particular page.
28	 * Although scripts in the WordPress core, Plugins and Themes may be
29	 * practising this, we should strive to set a better example in our own work.
30	 */
31
32	jQuery(document).ready(function ($) {
33
34		function pisol_prefetchRedirectUrl() {
35			var product = [];
36			var count = 0;
37			$(".ajax_add_to_cart").each(function () {
38				product[count] = $(this).data("product_id");
39				count++;
40			});
41			$.ajax({
42				url: pisol_dcw_setting.ajax_url,
43				method: 'POST',
44				dataType: 'json',
45				data: {
46					product_ids: product,
47					action: "pisol_ajax_bulk_fetch_add_to_cart_redirect_url"
48				}
49			}).done(function (res) {
50				window['bulk_redirect'] = res;
51			});
52		}
53		if (pisol_dcw_setting != undefined && pisol_dcw_setting.ajax_url != undefined && pisol_dcw_setting.pre_fetch) {
54			pisol_prefetchRedirectUrl();
55		}
56
57		var variation_obj = new variation()
58		variation_obj.init();
59		function variation() {
60			this.is_variable = false;
61
62			this.init = function () {
63				this.variationChange();
64				this.variationReset();
65				this.addHidden();
66				this.addLoadingIcon();
67			}
68
69			this.variationReset = function () {
70				var parent = this;
71				$(document).on('reset_data', "form.variations_form", function (event, data) {
72					var button = jQuery(".pisol_single_buy_now", this);
73					parent.statusBuyNow(button, false);
74				});
75			}
76
77			this.variationChange = function () {
78				var parent = this;
79				$(document).on('show_variation', "form.variations_form", function (event, data) {
80					var button = jQuery(".pisol_single_buy_now", this);
81					if (data != undefined) {
82						if (data.is_in_stock) {
83							parent.statusBuyNow(button, true);
84						} else {
85							parent.statusBuyNow(button, false);
86						}
87					} else {
88						parent.statusBuyNow(button, false);
89					}
90				});
91			}
92
93			this.statusBuyNow = function (button, status) {
94				var $ = jQuery;
95				if (status) {
96					button.attr("disabled", false);
97					button.removeClass('disabled');
98				} else {
99					button.attr("disabled", true);
100					button.addClass('disabled');
101				}
102			}
103
104			this.addHidden = function () {
105				var $ = jQuery;
106				$(document).on("click", ".pisol_single_buy_now", function (e) {
107					$(this).after('<input type="hidden" name="pi_quick_checkout" value="true"/>');
108					$(document).trigger('pisol_dtt_buy_now_clicked', [this]);
109					$(this).off('click', function () { //was unbind()
110						$(this).trigger('click');
111					});
112					/** this prevents ajax add to cart added by other plugins */
113					jQuery(document.body).off('submit', 'form.cart');
114				});
115			}
116
117			this.addLoadingIcon = function () {
118				$(document).on('pisol_dtt_buy_now_clicked', function (e, element) {
119					jQuery(element).addClass(pisol_dcw_setting.buy_now_clicked_class);
120				});
121
122				$(document).on('click', '.pisol_buy_now_button', function (e) {
123					jQuery(this).addClass(pisol_dcw_setting.buy_now_clicked_class);
124				});
125			}
126		}
127	});
128
129})(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.