PageSourceSearch

https://myfitstation.com/wp-content/plugins/contact-form-7-paypal-…/assets/js/redirect_method.js?ver=2.5.2

js myfitstation.com collected 2026-10-03 20:11:23 UTC 4,221 bytes, 158 lines download raw bytes

1jQuery(document).ready(function($) {
2
3	var cf7pp_formid;
4	var cf7pp_id_long;
5	var cf7pp_amount_total;
6	var cf7pp_email;
7	var cf7pp_stripe_return;
8	var cf7pp_payment_id;
9
10	// for redirect method 1
11	document.addEventListener('wpcf7mailsent', function( event ) {
12		
13		if (ajax_object_cf7pp.method == 1) {
14			
15			var cf7pp_id_long =			event.detail.contactFormId;
16			var cf7pp_id = 				event.detail.contactFormId;
17			
18			var cf7pp_formid = cf7pp_id_long;
19			var cf7pp_formid = cf7pp_id;
20
21			cf7pp_redirect(cf7pp_formid, cf7pp_id_long);
22		}
23		
24	}, false );
25	
26	
27	
28	
29	// for redirect method 2
30    if (ajax_object_cf7pp.method == 2) {
31        var cf7pp_form_counter = 0;
32        jQuery('.wpcf7-form').bind('DOMSubtreeModified', function(e) {
33            if (cf7pp_form_counter == 0) {
34                cf7pp_form_counter = 1; // Set counter immediately to prevent multiple intervals
35                var $form = jQuery(this);
36                var interval = setInterval(function(){
37                    if ($form.hasClass('sent')) {
38                        clearInterval(interval);
39
40                        // get form id
41                        var cf7pp_id = $form.parent().attr('id').substring(7);
42
43                        cf7pp_id = cf7pp_id.split('-')[0];
44
45                        var cf7pp_id_long = $form.parent().attr('id');
46
47                        cf7pp_redirect(cf7pp_id, cf7pp_id_long);
48                    }
49                }, 500);
50            }
51        });
52    }
53	
54	
55	// used for redirect method 1 and 2
56	function cf7pp_redirect(cf7pp_id, cf7pp_id_long) {
57		
58		var cf7pp_forms = ajax_object_cf7pp.forms;
59		
60		var cf7pp_result_paypal = cf7pp_forms.indexOf(cf7pp_id+'|paypal'); // check to see if form is enabled for redriect
61		var cf7pp_result_stripe = cf7pp_forms.indexOf(cf7pp_id+'|stripe');
62		
63		
64		var cf7pp_gateway;
65		
66		var cf7pp_data = {
67			'action':	'cf7pp_get_form_post',
68		};
69		
70		// Use REST API if request_method is 2, otherwise use AJAX
71		var requestUrl = (ajax_object_cf7pp.request_method == '2') 
72			? ajax_object_cf7pp.rest_url + 'cf7pp_get_form_post'
73			: ajax_object_cf7pp.ajax_url;
74		
75		jQuery.ajax({
76			type: "GET",
77			data: cf7pp_data,
78			dataType: "json",
79			async: false,
80			url: requestUrl,
81			xhrFields: {
82				withCredentials: true
83			},
84			success: function (response) {
85				cf7pp_gateway = 			response.gateway;
86				cf7pp_amount_total = 		response.amount_total;
87				cf7pp_email = 				response.email;
88				cf7pp_stripe_return = 		response.stripe_return;
89				cf7pp_payment_id = 			response.payment_id;
90			}
91		});
92		
93		var cf7pp_path_paypal = ajax_object_cf7pp.path_paypal+cf7pp_id+'&cf7pp_p='+cf7pp_payment_id;
94		var cf7pp_path_stripe = ajax_object_cf7pp.path_stripe+cf7pp_id+'&cf7pp_fid='+cf7pp_id_long+'&cf7pp_p='+cf7pp_payment_id+'&cf7pp_return='+window.location.href;
95		
96		
97		// gateway chooser
98		if (cf7pp_gateway != null) {
99			// paypal
100			if (cf7pp_result_paypal > -1 && cf7pp_gateway == 'paypal') {
101				window.location.href = cf7pp_path_paypal;
102			}
103			
104			// stripe
105			if (cf7pp_result_stripe > -1 && cf7pp_gateway == 'stripe') {
106				window.location.href = cf7pp_path_stripe;
107			}
108		} else {
109			// no gateway chooser
110			if (cf7pp_result_paypal > -1) {
111				window.location.href = cf7pp_path_paypal;
112			}
113			
114			// stripe
115			if (cf7pp_result_stripe > -1) {
116				window.location.href = cf7pp_path_stripe;
117			}
118		}
119	}
120
121
122	// show stripe success message
123	let searchParams = new URLSearchParams(window.location.search)
124	
125	if (searchParams.has('cf7pp_stripe_success')) {
126		
127		let fid = searchParams.get('cf7pp_fid');
128		
129		var cf7pp_data = {
130			'action':	'cf7pp_get_form_stripe_success',
131		};
132		
133		// Use REST API if request_method is 2, otherwise use AJAX
134		var requestUrl = (ajax_object_cf7pp.request_method == '2') 
135			? ajax_object_cf7pp.rest_url + 'cf7pp_get_form_stripe_success'
136			: ajax_object_cf7pp.ajax_url;
137		
138		jQuery.ajax({
139			type: (ajax_object_cf7pp.request_method == '2') ? "GET" : "POST",
140			data: cf7pp_data,
141			dataType: "json",
142			async: false,
143			url: requestUrl,
144			xhrFields: {
145				withCredentials: true
146			},
147			success: function (response) {
148				var html_response = response.html;
149				
150				jQuery('[id^="wpcf7-f' + fid + '-"]').html(html_response);
151			}
152		});
153		
154	}
155
156
157
158});

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.