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 if( edd_recurring_vars.has_trial ) { 36 setTrialTotal(); 37 38 $( document.body ).on( 'edd_discount_applied', setTrialTotal ); 39 $( document.body ).on( 'edd_discount_removed', setTrialTotal ); 40 $( document.body ).on( 'edd_taxes_recalculated', setTrialTotal ); 41 } 42 43 /** 44 * Sets the total order amount in the UI for a trial. (`0.00` in the store currency) 45 * 46 * @since 2.11 47 */ 48 function setTrialTotal( e, data ) { 49 // This sets the amount due today. 50 $('.edd_cart_amount').html( edd_recurring_vars.total ); 51 52 // This sets the recurring amount (after a trial). 53 if ( 'undefined' !== typeof data && data.response && data.response.total ) { 54 $( 'body' ).find( '.edd_recurring_total_after_trial' ).each( function () { 55 $( this ).html( data.response.total ); 56 } ); 57 } 58 } 59 60 // Look to see if the customer has purchased a free trial after email is entered on checkout 61 $('#edd_purchase_form').on( 'focusout', '#edd-email', function() { 62 63 if( 'undefined' == edd_scripts ) { 64 return; 65 } 66 67 // We don't need to make this AJAX call, if there isn't a trial in the cart. 68 if ( ! edd_recurring_vars.has_trial ) { 69 return; 70 } 71 72 var email = $(this).val(); 73 var product_ids = []; 74 75 $('body').find('.edd_cart_item').each(function() { 76 product_ids.push( $(this).data( 'download-id' ) ); 77 }); 78 79 $.ajax({ 80 type: "POST", 81 data: { 82 action: 'edd_recurring_check_repeat_trial', 83 email: email, 84 downloads: product_ids 85 }, 86 dataType: "json", 87 url: edd_scripts.ajaxurl, 88 xhrFields: { 89 withCredentials: true 90 }, 91 success: function (response) { 92 93 if( response.message ) { 94 $('<div class="edd_errors"><p class="edd_error">' + response.message + '</p></div>').insertBefore( '#edd_purchase_submit' ); 95 } 96 97 } 98 }).fail(function (response) { 99 if ( window.console && window.console.log ) { 100 console.log( response ); 101 } 102 }).done(function (response) { 103 104 }); 105 106 }); 107 108});
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.