PageSourceSearch

https://labarca-ristorante.com/wp-content/plugins/woocommerce-food/js/ajax-add-to-cart.js?ver=2.0

js labarca-ristorante.com collected 2026-10-10 01:28:42 UTC 5,631 bytes, 164 lines download raw bytes

1;(function($){
2	'use strict';
3	function exfd_flytocart(imgtodrag){
4		var cart = jQuery('.exfd-shopping-cart');
5		if (cart.length == 0) {return;}
6	    if (imgtodrag.length) {
7	        var imgclone = imgtodrag.clone().offset({
8	            top: imgtodrag.offset().top,
9	            left: imgtodrag.offset().left
10	        }).css({
11	            'opacity': '0.5',
12	                'position': 'absolute',
13	                'height': '150px',
14	                'width': '150px',
15	                'z-index': '1001'
16	        }).appendTo(jQuery('body'))
17	            .animate({
18	            'top': cart.offset().top + 10,
19	                'left': cart.offset().left,
20	                'width': 40,
21	                'height': 40
22	        }, 800);
23	        imgclone.animate({
24	            'width': 0,
25	                'height': 0
26	        }, function () {
27	            jQuery(this).detach()
28	        });
29	    }
30	}
31	function exf_refresh_cart(){
32		var data = {
33			action: 'exwoofood_refresh_cart',
34		};
35		$('.exfd-cart-mini').css('opacity','.6');
36		$.ajax({
37			type: 'post',
38			url: wc_add_to_cart_params.ajax_url,
39			data: data,
40			success: function(res){
41				$('div.exfd-cart-mini').remove();
42				$(res.fragments['div.exfd-cart-mini']).insertAfter('.exfd-cart-content .exfd-close-cart');
43			}
44		});
45	}
46	$(document).on('submit', '.exwoofood-woocommerce form', function (e) {
47		$("#food_modal .exwoofood-woocommerce > div .exfd-out-notice").remove();
48		var $button = $(this).find('.single_add_to_cart_button');
49		var $form = $(this);
50		var product_id = $form.find('input[name=add-to-cart]').val() || $button.val();
51		if (!product_id){ return;}
52		if ($button.is('.disabled')){ return;}
53		e.preventDefault();
54		var data = {
55			action: 'exwoofood_add_to_cart',
56			'add-to-cart': product_id,
57		};
58		$form.serializeArray().forEach(function (element) {
59			data[element.name] = element.value;
60		});
61		$(document.body).trigger('adding_to_cart', [$button, data]);
62		if($(this).find(".exrow-group.ex-checkbox").length){
63			$(this).find(".exrow-group.ex-checkbox").each(function() {
64				var $name = $(this).find('.ex-options').attr('name');
65				var dt_cb =[];
66				$(this).find('input[name="'+$name+'"]:checked').each(function() {
67					dt_cb.push($(this).val());
68				});
69				data[$name] = dt_cb;
70			});
71		}
72		if($(".wc-pao-addon-checkbox").length){
73			$(".wc-pao-addon-checkbox").each(function() {
74				var $name = $(this).attr('name');
75				var dt_cb =[];
76				$('input[name="'+$name+'"]:checked').each(function() {
77				  dt_cb.push($(this).val());
78				});
79				data[$name] = dt_cb;
80			});
81		}
82		if($(".ppom-check-input").length){
83			$(".ppom-check-input").each(function() {
84				if($(this).attr('type')=='checkbox'){
85					var $name = $(this).attr('name');
86					var dt_cb =[];
87					$('input[name="'+$name+'"]:checked').each(function() {
88					  dt_cb.push($(this).val());
89					});
90					data[$name] = dt_cb;
91				}
92			});
93		}
94		if($(".wccf_product_field_checkbox").length){
95			$(".wccf_product_field_checkbox").each(function() {
96				var $name = $(this).attr('name');
97				var dt_cb =[];
98				$('input[name="'+$name+'"]:checked').each(function() {
99				  dt_cb.push($(this).val());
100				});
101				data[$name] = dt_cb;
102			});
103		}
104		var old_dtcart = $('.exfd-cart-mini').html();
105		$.ajax({
106			type: 'post',
107			url: wc_add_to_cart_params.ajax_url,
108			data: data,
109			beforeSend: function (response) {
110				$button.removeClass('added').addClass('ex-loading');
111			},
112			complete: function (response) {
113				$button.removeClass('ex-loading');
114				var new_dtcart = $('.exfd-cart-mini');
115				if(old_dtcart == new_dtcart){ return;}
116				if (!response.error) {
117					$button.addClass('added');
118				}
119			},
120			success: function (response) {
121				if (response.error) {
122					$("#food_modal .exwoofood-woocommerce > div").append(response.message);
123					return;
124				} else {
125					$(document.body).trigger('added_to_cart', [response.fragments, response.cart_hash, $button]);
126					$('.woocommerce-notices-wrapper').empty().append(response.notices);
127					if($('.ex-fdlist.ex-food-plug .exfd-choice').length){
128						$('.ex-fdlist.ex-food-plug .exfd-choice').removeClass('ex-loading');
129					}
130					var new_dtcart = $('.exfd-cart-mini').html();
131					if(old_dtcart == new_dtcart){ 
132						$button.removeClass('added');
133						if($("#food_modal .modal-content").data('close-popup') == 'yes'){
134		                	$("#food_modal .ex_close").trigger('click');
135		                }
136						return;
137					}
138					
139	                var imgtodrag;
140	                var id_parent =$button.closest(".ex-fdlist ").attr('id');
141	                var layout = $('#'+id_parent).hasClass('table-layout') ? 'table' : '';
142	                imgtodrag = $button.closest("#food_modal").find("img").eq(0);
143	                if (imgtodrag.length == 0) {
144	                	if (layout!='table') {
145		                	imgtodrag = $button.closest(".item-grid").find("img").eq(0);
146		                	if (imgtodrag.length == 0) {
147		                		imgtodrag = $button.closest(".item-grid").find(".ex-fly-cart").eq(0);
148		                	}
149		                }else{
150		                	imgtodrag = $button.closest("tr").find("img").eq(0);
151		                }
152	                }
153	                exfd_flytocart(imgtodrag);
154	                exf_refresh_cart();
155	                if($("#food_modal .modal-content").data('close-popup') == 'yes'){
156	                	$("#food_modal .ex_close").trigger('click');
157	                }
158				}
159			},
160		});
161		return false;
162	});
163    
164}(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.