PageSourceSearch

https://tribulant.net/bundle/wp-content/plugins/wp-checkout/views/bootstrap/js/functions.js?v=1.1&ver=2.2

js tribulant.net collected 2026-09-25 22:49:51 UTC 10,005 bytes, 277 lines download raw bytes

1function checkout_cart_removeproduct(item_id) {
2	jQuery('.checkout_cart .checkout_loading_overlay_wrapper').fadeIn();
3	jQuery.post(checkout_ajaxurl + "action=checkout_cart_removeproduct", {item_id:item_id}, function(response) {		
4		jQuery('.checkout_cart .checkout_loading_overlay_wrapper').fadeOut();
5		if (response.length > 0) {
6			jQuery('#checkout_cart').html(response);
7		}
8	});
9}
10
11function checkout_cart_widget_removeproduct(item_id) {
12	jQuery('.widget_checkout_cart .checkout_loading_overlay_wrapper').fadeIn();
13	checkout_cart_removeproduct(item_id);
14	jQuery.post(checkout_ajaxurl + "action=checkout_cart_widget_removeproduct", {item_id:item_id}, function(response) {	
15		jQuery('.widget_checkout_cart .checkout_loading_overlay_wrapper').fadeOut();	
16		if (response.length > 0) {			
17			if (jQuery('.widget_checkout_cart').length != 0) {
18				jQuery('.widget_checkout_cart').show().html(response);
19			}
20		}
21	});
22}
23
24function checkout_frontend_notice(message, type) {
25	if (type == "notice") {
26		var notice_html = '<div id="checkout_frontend_notices" class="checkout checkout_frontend_notice_wrapper checkout_highlight"><div class="checkout_frontend_notices_inside alert alert-success text-center"><div class="checkout_frontend_notice"><i class="fa fa-check"></i> ' + message + '</div></div></div>';
27		jQuery('body').prepend(notice_html);
28		jQuery('#checkout_frontend_notices').slideDown().delay(5000).slideUp(function() { /*jQuery(this).remove();*/ });
29	} else {
30		var error_html = '<div id="checkout_frontend_errors" class="checkout checkout_frontend_notice_wrapper checkout_alert"><div class="checkout_frontend_errors_inside alert alert-danger text-center"><div class="checkout_frontend_error"><i class="fa fa-exclamation-triangle"></i> ' + message + '</div></div></div>';
31		jQuery('body').prepend(error_html);
32		jQuery('#checkout_frontend_errors').slideDown().delay(5000).slideUp(function() { /*jQuery(this).remove();*/ });
33	}
34}
35
36function checkout_cart_summary(summary) {	
37	if (summary) {
38		jQuery('body').append(summary);
39	} else {
40		jQuery.ajax({
41			url: checkout_ajaxurl + 'action=checkout_cart_summary',
42			method: "POST",
43		}).done(function(response) {
44			jQuery('body').append(response);
45		});
46	}
47	
48}
49
50function checkout_modal(content) {
51	jQuery.ajax({
52		url: checkout_ajaxurl + 'action=checkout_modal',
53		method: "POST",
54		data: {content:content},
55		
56	}).done(function(response) {
57		jQuery('body').prepend(response);
58	}).fail(function(response) {
59		//failed...
60	});
61}
62
63function checkout_cart_addproduct(form, productid, number, showloading) {			
64	var formvalues = form.serialize();
65	var mytime = new Date().getTime();
66	jQuery('ul.wpcoerrors').remove();
67	jQuery('#message' + productid).hide();
68	var oldattr = jQuery('#submitbuttontext' + productid).attr('value');
69	var button = jQuery('#submit' + productid + ' button');
70	var button_text = button.find('.checkout_button_text').html();
71	button.prop('disabled', true).find('.checkout_button_loading').show();
72	button.find('.checkout_button_text').html(jQuery(button).data('loading-text'));
73	jQuery('#added' + productid).hide();
74	jQuery('#widget-cart-errors').hide();
75	jQuery('#wpcoloadingwrap' + productid).css('display', "inline");
76	jQuery('.checkout_loading_overlay_wrapper').fadeIn();
77	
78	$progress = jQuery(form).find('.checkout-progress');
79	$progressbar = jQuery(form).find('.checkout-progress .progress-bar');
80	$progresspercent = jQuery(form).find('.checkout-progress .sr-only');
81
82	$filefields = jQuery(form).find(':file');
83		
84	if (typeof $filefields !== 'undefined' && $filefields.length > 0) {
85		$progress.show();
86	}
87				
88	jQuery(form).ajaxSubmit({
89		url: checkout_ajaxurl + 'action=checkout_addtocart',
90		data: (function() {	
91			var formvalues = form.serialize();							
92			return formvalues;
93		})(),
94		type: 'POST',
95		dataType: 'json',
96		cache: false,
97		beforeSubmit: function() {																		
98			//do something before form submit
99		},
100		beforeSend: function() {
101	        var percentVal = '0%';
102	        $progressbar.width(percentVal);
103	        $progresspercent.html(percentVal);
104	    },
105	    uploadProgress: function(event, position, total, percentComplete) {
106	        var percentVal = percentComplete + '%';
107	        $progressbar.width(percentVal);
108	        $progresspercent.html(percentVal);
109	    },
110		success: function(response) {							
111			var success = response.success;
112			var message = response.message;
113			var html = response.html;	
114			var summary = response.summary;
115			var notice = response.notice;
116			
117			if (wpcoScrollAjax == true) {
118				if (jQuery('#' + number).length > 0) {
119					wpco_scroll(jQuery('#' + number).parent());		
120				} else {
121					wpco_scroll('.widget_checkout_cart');
122				}
123			}
124			
125			if (cart_frontend_notice == true) {
126				if (success == true) {
127					checkout_frontend_notice(notice, 'notice');
128				} else {
129					checkout_frontend_notice(notice, 'error');
130				}
131			}
132			
133			if (typeof summary !== 'undefined' && summary.length != 0) {
134				checkout_cart_summary(summary);
135			}
136			
137			if (jQuery('.widget_checkout_wrapper_cart').length != 0) {
138				jQuery('.widget_checkout_wrapper_cart').show();
139			}
140			
141			if (jQuery('.widget_checkout_cart').length != 0) {
142				jQuery('.widget_checkout_cart').show().html(html);
143			}
144																													
145			if (jQuery("#" + number).length != 0) {
146				if (success == true) {
147					jQuery("#" + number).show().html(html);
148				} else {
149					jQuery('#widget-cart-success').hide();
150					jQuery("#widget-cart-errors").html(html).show();
151				}
152			}
153		},
154		error: function(request, textStatus, errorThrown) {
155			// An Ajax error occurred
156			alert('An error occurred, please try again.');
157		},
158		complete: function(request, textStatus) {
159			var percentVal = '100%';
160	        $progressbar.width(percentVal);
161	        $progresspercent.html(percentVal);
162	        $progress.fadeOut();
163			
164			jQuery('.checkout_loading_overlay_wrapper').fadeOut();
165			jQuery('#wpcoloadingwrap' + productid).hide();
166			jQuery(button).prop('disabled', false);
167			jQuery(button).find('.checkout_button_loading').hide();
168			jQuery(button).find('.checkout_button_text').html(button_text);
169		}
170	});
171	
172	/*jQuery.post(checkout_ajaxurl + 'action=checkout_addtocart', formvalues, function(data) {
173		jQuery('.checkout_loading_overlay_wrapper').fadeOut();
174		var success = jQuery(data).find('success').text();
175		var message = jQuery("message", data).text();
176		var html = jQuery("html", data).text();			
177		var summary = jQuery("summary", data).text();
178		var newmessage = message;
179		var notice = jQuery("notice", data).text();
180		
181		if (wpcoScrollAjax == true) {
182			if (jQuery('#' + number).length > 0) {
183				wpco_scroll(jQuery('#' + number).parent());		
184			} else {
185				wpco_scroll('.widget_checkout_cart');
186			}
187		}
188		
189		if (cart_frontend_notice == true) {
190			if (success == "Y") {
191				checkout_frontend_notice(notice, 'notice');
192			} else {
193				checkout_frontend_notice(notice, 'error');
194			}
195		}
196		
197		if (summary.length != 0) {
198			checkout_cart_summary(summary);
199		}
200		
201		if (jQuery('.widget_checkout_wrapper_cart').length != 0) {
202			jQuery('.widget_checkout_wrapper_cart').show();
203		}
204		
205		if (jQuery('.widget_checkout_cart').length != 0) {
206			jQuery('.widget_checkout_cart').show().html(html);
207		}
208																												
209		if (jQuery("#" + number).length != 0) {
210			if (success == "Y") {
211				jQuery("#" + number).show().html(html);
212			} else {
213				jQuery('#widget-cart-success').hide();
214				jQuery("#widget-cart-errors").html(html).show();
215			}
216		}
217		
218		jQuery('#wpcoloadingwrap' + productid).hide();
219		jQuery(button).prop('disabled', false);
220		jQuery(button).find('.checkout_button_loading').hide();
221		jQuery(button).find('.checkout_button_text').html(button_text);
222	}, 'xml');*/
223}
224
225function checkout_scroll(selector) {
226	if (jQuery(selector).length > 0) {
227		var targetOffset = (jQuery(selector).offset().top - 40);
228		jQuery('html,body').animate({scrollTop: targetOffset}, 500);
229	}
230}
231
232function checkout_favorite(product) {
233	var mytime = new Date().getTime();
234	var oldhtml = jQuery('#favoritesubmit' + product).html();
235
236	jQuery.post(wpcoAjax + "?cmd=add_favorite&product=" + product + "&mytime=" + mytime, "", function(response) {
237		jQuery('#favoritesubmit' + product + ' .checkout_favorite_link').html('<i class="fa fa-lg fa-star"></i>').addClass('active').prop('href', checkout_favorites_url);
238	}); 
239}
240
241var checkout_product_price_requests = {};
242
243jQuery(document).ready(function() {
244	if (parseInt(auto_calculate_donation)) {
245		jQuery('.checkout_product_quantity input').on('keyup', function(event) {
246			checkout_product_update_price(jQuery(this).data('product-id'));
247		});
248	}
249});
250
251function checkout_product_update_price(productid) {	
252	if (typeof checkout_product_price_requests.productid != 'undefined') { checkout_product_price_requests.productid.abort(); }
253	
254	var mytime = new Date().getTime();
255	var formValues = jQuery('#addtocart' + productid).serialize();
256	//jQuery('input[name="Item[donate_price]"]').attr('disabled', true);
257	var product_button = jQuery('#submit' + productid + ' button, #submit' + productid + ' input');
258	//jQuery(product_button).prop('disabled', true);
259	var product_price = jQuery('#productprice' + productid);
260	jQuery(product_price).html(jQuery(product_button).data('update-text'));
261	
262	jQuery('input[name="wpcomethod"]').attr("name", "wpcomethodold");
263	
264	var request = jQuery.post(checkout_ajaxurl + "action=updateproductprice&cmd=updateproductprice&mytime=" + mytime, formValues, function(response) {		
265		if (response != "") {
266			jQuery('.recurringinfo_price').html("<span id=\"productRecurringPrice\" class=\"priceinside pricecurrency\">
266"+response+"</span>");
267			//jQuery(product_button).prop('disabled', false);
268			jQuery(product_price).html(response);
269			//jQuery('input[name="Item[donate_price]"]').prop('disabled', false);
270			jQuery('input[name="wpcomethodold"]').attr("name", "wpcomethod");
271			jQuery('.checkout_product_form').trigger('checkout_update_product_price', [response]);
272		}
273	});
274	
275	checkout_product_price_requests.productid = request;
276	return false;
277}

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.