PageSourceSearch

https://surfdog.com/wp-content/plugins/extra-fees-for-woocommerce/…/frontend/frontend.js?ver=9.0.0.1790602247

js surfdog.com collected 2026-10-02 06:57:55 UTC 12,949 bytes, 361 lines download raw bytes

1jQuery( function ( $ ) {
2	'use strict';
3
4	var EFW_Frontend_Scripts = {
5		$order_review: $( '#order_review' ),
6		$checkout_form : $( 'form.checkout' ) ,
7		init : function ( ) {
8			EFW_Frontend_Scripts.trigger_on_page_load();
9			EFW_Frontend_Scripts.add_fee_for_gateway() ;
10			$( document ).on( 'payment_method_selected' , this.add_fee_for_gateway ) ;
11			$( document ).on( 'payment_method_selected' , this.add_fee_in_pay_for_order ) ;
12			$( document ).on( 'found_variation' , '.variations_form' , this.variation_notice ) ;
13			$( document ).on( 'reset_data' , '.variations_form' , this.variation_notice_reset ) ;
14			$( document ).on( 'click' , '.efw-fee-desc-popup' , this.fee_desc_popup ) ;
15			$( document ).on( 'click' , '.efw-fee-desc-rule-popup' , this.fee_desc_rule_popup ) ;
16			$( document ).on( 'click' , '.efw-gateway-fee-desc-popup' , this.fee_gateway_desc_popup ) ;
17			$( document ).on( 'click' , '.efw-order-fee-desc-popup' , this.fee_order_desc_popup ) ;
18			$( document ).on( 'click' , '.efw-additional-fee-desc-popup' , this.additional_fee_desc_popup ) ;
19			$( document ).on( 'click' , '.efw-shipping-fee-desc-popup' , this.fee_shipping_desc_popup ) ;
20			$( document ).on( 'click' , '.efw-combined-fee-desc-popup' , this.fee_combined_desc_popup ) ;
21			$( '#wc-bookings-booking-form' ).on( 'change' , 'input, select' , this.display_booking_cost ) ;
22			$(document).on('change', '.efw-apply-order-fee', this.trigger_order_fee);
23		} , trigger_on_page_load: function () {
24			$('.efw-apply-order-fee').attr('checked', true);
25			EFW_Frontend_Scripts.add_order_fee('.efw-apply-order-fee');
26		}, trigger_order_fee: function (event) {
27			event.preventDefault();
28			var $this = $(event.currentTarget);
29			EFW_Frontend_Scripts.add_order_fee($this);
30		}, add_order_fee: function ($this) {
31			if ( (efw_frontend_param.is_cart || efw_frontend_param.is_checkout) && ('yes' == efw_frontend_param.is_order_fee_enabled) && ('2' == efw_frontend_param.is_order_fee_optional) ) {
32				var apply_order_fee = $($this).is(':checked') ? 'yes' : 'no';
33
34				EFW_Frontend_Scripts.block($this);
35
36				var data = ({
37					action: 'efw_apply_order_fee',
38					apply_order_fee: apply_order_fee,
39					efw_security: efw_frontend_param.fee_nonce,
40				});
41				$.post(efw_frontend_param.ajaxurl, data, function (res) {
42					if (true === res.success) {
43						$(document.body).trigger('update_checkout');
44						$(document).trigger('wc_update_cart');
45					} else {
46						window.alert(res.data.error);
47					}
48
49					EFW_Frontend_Scripts.unblock($this);
50				}
51				);
52			}
53		},
54		add_fee_for_gateway : function (e) {
55			if ( (efw_frontend_param.is_checkout) && 'yes' == efw_frontend_param.is_gateway_fee_enabled ) {
56				EFW_Frontend_Scripts.block( EFW_Frontend_Scripts.$checkout_form ) ;
57
58				var gateway_id = $( '.payment_methods input[name="payment_method"]:checked' ).val();
59
60				var data = ( {
61					action : 'efw_automatic_subscription' ,
62					gatewayid : gateway_id ,
63					efw_security : efw_frontend_param.fee_nonce
64				} ) ;
65				
66				$.post( efw_frontend_param.ajaxurl , data , function ( response ) {
67					if ( true === response.success ) {
68						$(document.body).trigger('update_checkout');
69					} else {
70						window.alert( response.data.error ) ;
71					}
72					EFW_Frontend_Scripts.unblock( EFW_Frontend_Scripts.$checkout_form ) ;
73				} ) ;
74			}
75		} ,
76		add_fee_in_pay_for_order : function (e) {
77			if ( (efw_frontend_param.is_pay_for_order_page) && 'yes' == efw_frontend_param.is_gateway_fee_enabled ) {
78				EFW_Frontend_Scripts.block( EFW_Frontend_Scripts.$order_review ) ;
79
80				var gateway_id = $( '.payment_methods input[name="payment_method"]:checked' ).val();
81
82				var data = ( {
83					action : 'efw_fee_in_pay_for_order' ,
84					gatewayid : gateway_id ,
85					pay_for_order : efw_frontend_param.is_pay_for_order_page,
86					order_id : efw_frontend_param.order_id,
87					efw_security : efw_frontend_param.fee_nonce
88				} ) ;
89				
90				$.post( efw_frontend_param.ajaxurl , data , function ( response ) {
91					if ( true === response.success ) {
92						if( '' != response.data.pay_for_order){
93							$('.shop_table').replaceWith(response.data.pay_for_order);
94						}
95					} else {
96						window.alert( response.data.error ) ;
97					}
98					EFW_Frontend_Scripts.unblock( EFW_Frontend_Scripts.$order_review ) ;
99				} ) ;
100			}
101		} ,
102		variation_notice : function ( e, variation ) {
103			if ( ! ( efw_frontend_param.is_product && 'yes' == efw_frontend_param.is_enabled ) ) {
104				return ;
105			}
106
107			var $form = $( e.currentTarget ) ;
108			var $wrap = $form.find( 'div.single_variation_wrap' ) ;
109			var variationid = variation && variation.variation_id ? variation.variation_id : '' ;
110
111			if ( variationid === '' || variationid === 0 || variationid === undefined ) {
112				return false ;
113			}
114
115			// Avoid re-sending the AJAX request for a variation that was already fetched.
116			if ( EFW_Frontend_Scripts.last_variation_id === variationid ) {
117				return false ;
118			}
119			EFW_Frontend_Scripts.last_variation_id = variationid ;
120
121			// Cancel any request still in flight for a previous variation.
122			if ( EFW_Frontend_Scripts.variation_notice_xhr ) {
123				EFW_Frontend_Scripts.variation_notice_xhr.abort() ;
124			}
125
126			EFW_Frontend_Scripts.block( $wrap ) ;
127			var data = ( {
128				action : 'efw_variation_notice' ,
129				variationid : variationid ,
130				efw_security : efw_frontend_param.fee_nonce
131			} ) ;
132			EFW_Frontend_Scripts.variation_notice_xhr = $.post( efw_frontend_param.ajaxurl , data , function ( response ) {
133				if ( true === response.success ) {
134					if ( response.data.html ) {
135						$wrap.find( '.efw-variation-price-table' ).html( response.data.html ) ;
136					}
137				} else {
138					window.alert( response.data.error ) ;
139				}
140			} ).always( function () {
141				EFW_Frontend_Scripts.unblock( $wrap ) ;
142				EFW_Frontend_Scripts.variation_notice_xhr = null ;
143			} ) ;
144		} ,
145		variation_notice_reset : function ( e ) {
146			EFW_Frontend_Scripts.last_variation_id = null ;
147
148			if ( EFW_Frontend_Scripts.variation_notice_xhr ) {
149				EFW_Frontend_Scripts.variation_notice_xhr.abort() ;
150				EFW_Frontend_Scripts.variation_notice_xhr = null ;
151			}
152
153			$( e.currentTarget ).find( '.efw-variation-price-table' ).empty() ;
154		} ,
155		fee_desc_popup : function ( e ) {
156			e.preventDefault() ;
157			var $this = $( e.currentTarget ) ,
158					$product_id = $this.data( 'product_id' ) ;
159
160			var data = ( {
161				action : 'efw_fee_desc_popup' ,
162				product_id : $product_id ,
163				efw_security : efw_frontend_param.fee_desc_popup_nonce
164			} ) ;
165			EFW_Frontend_Scripts.block( $this ) ;
166			$.post( efw_frontend_param.ajaxurl , data , function ( response ) {
167				if ( true === response.success ) {
168					EFW_Frontend_Scripts.unblock( $this ) ;
169					if ( response.data.html ) {
170						$this.after( response.data.html ) ;
171						$this.closest( 'div' ).find( '#efw_fee_desc_popup' ).modal() ;
172					}
173				} else {
174					window.alert( response.data.error ) ;
175					EFW_Frontend_Scripts.unblock( $this ) ;
176				}
177			} ) ;
178			return false ;
179		} ,
180		fee_desc_rule_popup : function ( e ) {
181			e.preventDefault() ;
182			var $this = $( e.currentTarget ) ,
183					$product_id = $this.data( 'product_id' ) ,
184					$rule_id = $this.data( 'rule_id' ) ;
185
186			var data = ( {
187				action : 'efw_fee_desc_rule_popup' ,
188				product_id : $product_id ,
189				rule_id : $rule_id ,
190				efw_security : efw_frontend_param.fee_desc_rule_popup_nonce
191			} ) ;
192			EFW_Frontend_Scripts.block( $this ) ;
193			$.post( efw_frontend_param.ajaxurl , data , function ( response ) {
194				if ( true === response.success ) {
195					EFW_Frontend_Scripts.unblock( $this ) ;
196					if ( response.data.html ) {
197						$this.after( response.data.html ) ;
198						$this.closest( 'div' ).find( '#efw_fee_desc_rule_popup' ).modal() ;
199					}
200				} else {
201					window.alert( response.data.error ) ;
202					EFW_Frontend_Scripts.unblock( $this ) ;
203				}
204			} ) ;
205			return false ;
206		} ,
207		fee_gateway_desc_popup : function ( e ) {
208			e.preventDefault() ;
209			var $this = $( e.currentTarget ) ;
210			var data = ( {
211				action : 'efw_fee_gateway_desc_popup' ,
212				gateway_id : $this.data( 'gateway_id' ) ,
213				efw_security : efw_frontend_param.fee_gateway_desc_popup_nonce
214			} ) ;
215			EFW_Frontend_Scripts.block( $this ) ;
216			$.post( efw_frontend_param.ajaxurl , data , function ( response ) {
217				if ( true === response.success ) {
218					EFW_Frontend_Scripts.unblock( $this ) ;
219					if ( response.data.html ) {
220						$this.after( response.data.html ) ;
221						$this.closest( 'div' ).find( '#efw_gateway_fee_desc_popup' ).modal() ;
222					}
223				} else {
224					window.alert( response.data.error ) ;
225					EFW_Frontend_Scripts.unblock( $this ) ;
226				}
227			} ) ;
228			return false ;
229		} ,
230		fee_order_desc_popup : function ( e ) {
231			e.preventDefault() ;
232			var $this = $( e.currentTarget ) ;
233			var data = ( {
234				action : 'efw_fee_order_desc_popup' ,
235				efw_security : efw_frontend_param.fee_order_desc_popup_nonce
236			} ) ;
237			EFW_Frontend_Scripts.block( $this ) ;
238			$.post( efw_frontend_param.ajaxurl , data , function ( response ) {
239				if ( true === response.success ) {
240					EFW_Frontend_Scripts.unblock( $this ) ;
241					if ( response.data.html ) {
242						$this.after( response.data.html ) ;
243						$this.closest( 'div' ).find( '#efw_order_fee_desc_popup' ).modal() ;
244					}
245				} else {
246					window.alert( response.data.error ) ;
247					EFW_Frontend_Scripts.unblock( $this ) ;
248				}
249			} ) ;
250			return false ;
251		} ,
252		additional_fee_desc_popup : function ( e ) {
253			e.preventDefault() ;
254			var $this = $( e.currentTarget ) ;
255			var data = ( {
256				action : 'efw_additional_fee_desc_popup' ,
257				efw_security : efw_frontend_param.additional_fee_desc_popup_nonce
258			} ) ;
259			EFW_Frontend_Scripts.block( $this ) ;
260			$.post( efw_frontend_param.ajaxurl , data , function ( response ) {
261				if ( true === response.success ) {
262					EFW_Frontend_Scripts.unblock( $this ) ;
263					if ( response.data.html ) {
264						$this.after( response.data.html ) ;
265						$this.closest( 'div' ).find( '#efw_additional_fee_desc_popup' ).modal() ;
266					}
267				} else {
268					window.alert( response.data.error ) ;
269					EFW_Frontend_Scripts.unblock( $this ) ;
270				}
271			} ) ;
272			return false ;
273		} ,
274		fee_combined_desc_popup : function ( e ) {
275			e.preventDefault() ;
276			var $this = $( e.currentTarget ) ;
277			var data = ( {
278				action : 'efw_fee_combined_desc_popup' ,
279				fee_detail : $(this).data('fee_details') ,
280				efw_security : efw_frontend_param.combined_fee_desc_popup_nonce
281			} ) ;
282			EFW_Frontend_Scripts.block( $this ) ;
283			$.post( efw_frontend_param.ajaxurl , data , function ( response ) {
284				if ( true === response.success ) {
285					EFW_Frontend_Scripts.unblock( $this ) ;
286					if ( response.data.html ) {
287						$this.after( response.data.html ) ;
288						$this.closest( 'div' ).find( '#efw_combined_fee_desc_popup' ).modal() ;
289					}
290				} else {
291					window.alert( response.data.error ) ;
292					EFW_Frontend_Scripts.unblock( $this ) ;
293				}
294			} ) ;
295			return false ;
296		} ,
297		fee_shipping_desc_popup : function ( e ) {
298			e.preventDefault() ;
299			var $this = $( e.currentTarget ) ;
300			var data = ( {
301				action : 'efw_fee_shipping_desc_popup' ,
302				shipping_id : $this.data( 'shipping_id' ) ,
303				efw_security : efw_frontend_param.fee_shipping_desc_popup_nonce
304			} ) ;
305			EFW_Frontend_Scripts.block( $this ) ;
306			$.post( efw_frontend_param.ajaxurl , data , function ( response ) {
307				if ( true === response.success ) {
308					EFW_Frontend_Scripts.unblock( $this ) ;
309					if ( response.data.html ) {
310						$this.after( response.data.html ) ;
311						$this.closest( 'div' ).find( '#efw_shipping_fee_desc_popup' ).modal() ;
312					}
313				} else {
314					window.alert( response.data.error ) ;
315					EFW_Frontend_Scripts.unblock( $this ) ;
316				}
317			} ) ;
318			return false ;
319		} ,
320		display_booking_cost : function ( e ) {
321            e.preventDefault() ;
322            var form = $( this ).closest( 'form' ) ;
323            EFW_Frontend_Scripts.block( form ) ;
324            var data = {
325                action : 'efw_display_booking_cost' ,
326                form : form.serialize() ,
327				efw_security : efw_frontend_param.booking_nonce
328            } ;
329            $.ajax( {
330                url : efw_frontend_param.ajaxurl ,
331                data : data ,
332                dataType : 'JSON' ,
333                type : 'post' ,
334                success : function ( response ) {
335                    if ( true == response.success ) {
336                        form.find( '.efw-product-fee-table' ).html( response.data.html ) ;
337                        form.find( '.single_add_to_cart_button' ).removeClass( 'disabled' ) ;
338                    }
339
340                } ,
341                complete : function () {
342                    EFW_Frontend_Scripts.unblock( form ) ;
343                }
344            } ) ;
345
346        },
347		block : function ( id ) {
348			$( id ).block( {
349				message : null ,
350				overlayCSS : {
351					background : '#fff' ,
352					opacity : 0.6
353				}
354			} ) ;
355		} ,
356		unblock : function ( id ) {
357			$( id ).unblock() ;
358		} ,
359	} ;
360	EFW_Frontend_Scripts.init( ) ;
361} ) ;

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.