PageSourceSearch

https://oiopublisher.com/wp-content/plugins/edd-recurring/assets/js/edd-frontend-recurring.js?ver=2.11.11.1

js oiopublisher.com collected 2026-09-24 09:01:04 UTC 3,851 bytes, 140 lines download raw bytes

1var edd_scripts;
2jQuery(document).ready(function($) {
3	$('.edd_subscription_cancel').on('click',function(e) {
4		if( confirm( edd_recurring_vars.confirm_cancel ) ) {
5			return true;
6		}
7		return false;
8	});
9
10	// Force subscription terms to behave for Custom Prices
11	$('.edd_download_purchase_form').each(function() {
12
13		var form = $(this);
14
15		if ( form.find( '.edd-cp-container' ).length && form.find( '.edd_price_options' ).length ) {
16
17			var terms = form.find('.eddr-custom-terms-notice');
18			var signup_fee = form.find('.eddr-custom-signup-fee-notice');
19			terms.prev().append(terms);
20			signup_fee.prev().append(signup_fee);
21			terms.show();
22			signup_fee.show();
23
24		} else if ( form.find( '.edd-cp-container' ).length ) {
25
26			form.find('.edd_cp_price').keyup(function() {
27				form.find('.eddr-terms-notice,.eddr-signup-fee-notice').hide();
28				form.find('.eddr-custom-terms-notice,.eddr-custom-signup-fee-notice').show();
29			});
30
31		}
32
33	});
34
35	// Look to see if the customer has purchased a free trial after email is entered on checkout
36	$('#edd_purchase_form').on( 'focusout', '#edd-email', function() {
37
38		if( 'undefined' == edd_scripts ) {
39			return;
40		}
41
42		// We don't need to make this AJAX call, if there isn't a trial in the cart.
43		if ( ! edd_recurring_vars.has_trial ) {
44			return;
45		}
46
47		var email = $(this).val();
48		var product_ids = [];
49
50		$('body').find('.edd_cart_item').each(function() {
51			product_ids.push( $(this).data( 'download-id' ) );
52		});
53
54		 $.ajax({
55			type: "POST",
56			data: {
57				action: 'edd_recurring_check_repeat_trial',
58				email: email,
59				downloads: product_ids
60			},
61			dataType: "json",
62			url: edd_scripts.ajaxurl,
63			xhrFields: {
64				withCredentials: true
65			},
66			success: function (response) {
67
68				if( response.message ) {
69					$('<div class="edd_errors"><p class="edd_error">' + response.message + '</p></div>').insertBefore( '#edd_purchase_submit' );
70				}
71
72			}
73		}).fail(function (response) {
74			if ( window.console && window.console.log ) {
75				console.log( response );
76			}
77		}).done(function (response) {
78
79		});
80
81	} );
82
83	$( document.body ).on( 'edd_discount_applied', updateNotices );
84	$( document.body ).on( 'edd_discount_removed', updateNotices );
85
86	/**
87	 * Update cart item notices when a discount is added to or removed from the cart.
88	 */
89	function updateNotices ( e, data ) {
90		let trial = $( '.edd_recurring_total_after_trial' );
91		if ( trial.length && data.recurring_total ) {
92			trial.text( data.recurring_total );
93		}
94		if ( data.recurring_sl ) {
95			for ( var key in data.recurring_sl ) {
96				if ( data.recurring_sl.hasOwnProperty( key ) ) {
97					let amount = $( '.' + key );
98					if ( amount.length ) {
99						amount.text( data.recurring_sl[ key ] );
100					}
101				}
102			}
103		}
104	}
105
106	$( document.body ).on( 'edd_taxes_recalculated', function ( e, response ) {
107		if ( !edd_recurring_vars.has_trial ) {
108			return;
109		}
110		let selector = $( '.edd_recurring_trial_total_note' );
111		if ( selector && $( '.edd_recurring_total_after_trial' ).length ) {
112			selector.text( edd_recurring_vars.trial_message );
113		}
114	} );
115
116	if ( edd_recurring_vars.has_trial ) {
117		setTrialTotal();
118
119		$( document.body ).on( 'edd_discount_applied', setTrialTotal );
120		$( document.body ).on( 'edd_discount_removed', setTrialTotal );
121		$( document.body ).on( 'edd_taxes_recalculated', setTrialTotal );
122	}
123
124	/**
125	 * Sets the total order amount in the UI for a trial. (`0.00` in the store currency)
126	 *
127	 * @since 2.11
128	 */
129	function setTrialTotal ( e, data ) {
130		// This sets the amount due today.
131		$( '.edd_cart_amount' ).html( edd_recurring_vars.total );
132
133		// This sets the recurring amount (after a trial).
134		if ( 'undefined' !== typeof data && data.response && data.response.total ) {
135			$( 'body' ).find( '.edd_recurring_total_after_trial' ).each( function () {
136				$( this ).html( data.response.total );
137			} );
138		}
139	}
140} );

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.