1jQuery(document).ready(function($) { 2 3 function rtecTriggerPaymentTableInit() { 4 if ( ! $('.rtec-payment-table-wrap').length) { 5 return; 6 } 7 var evt = $.Event('rtecPaymentTableInit'); 8 evt.el = $('.rtec-payment-table-wrap').first(); 9 10 $(window).trigger(evt); 11 } 12 13 // Email / visitor checkout is rendered on page load (not via AJAX submission). 14 rtecTriggerPaymentTableInit(); 15 16 $(window).on('rtecsubmissionajax', function (event) { 17 rtecTriggerPaymentTableInit(); 18 }); 19 20 $(window).off('rtecPaymentTableInit.rtec').on('rtecPaymentTableInit.rtec', function (event) { 21 if ( ! $('.rtec-payment-table-wrap').length) { 22 return; 23 } 24 $('.rtec-payment-table-wrap').each(function(){ 25 if ($(this).find('.rtec-payment-submit-item').length > 1) { 26 rtecToggleGateway($(this)); 27 rtecInitGatewaySelector($(this)); 28 } 29 }); 30 31 var rtecDelay = (function () { 32 var rtecTimer = 0; 33 return function (rtecCallback, rtecMs) { 34 clearTimeout(rtecTimer); 35 rtecTimer = setTimeout(rtecCallback, rtecMs); 36 }; 37 })(); 38 $(window).on('resize',function () { 39 rtecDelay(function () { 40 rtecPaymentAfterResize(); 41 }, 500); 42 }); 43 rtecPaymentAfterResize(); 44 45 var evt = $.Event('rtecAfterPaymentTableLoaded'); 46 evt.el = $('.rtec-payment-table-wrap').first(); 47 48 $(window).trigger(evt); 49 $('.rtec-ajax-payment').on('click', function(e) { 50 e.preventDefault(); 51 let $form = $(this).closest('form'), 52 $context = $form.closest('.rtec-payment-table-wrap'); 53 54 if (window.RtecCommon) { 55 window.RtecCommon.showLoading($context); 56 } 57 $context.find('table').fadeTo(500,.5); 58 $form.find('button[type="submit"]').prop('disabled', true).fadeTo(500,.5); 59 60 $.ajax({ 61 url: rtec.ajaxUrl, 62 type: 'post', 63 data: $form.serializeArray(), 64 success: function(data) { 65 if (window.RtecCommon) { 66 window.RtecCommon.hideLoading($context); 67 } 68 $context.find('table').fadeTo(500,1); 69 $form.replaceWith(data.data.html); 70 $context.find('.rtec-response-wrap').fadeIn(); 71 $context.find('.rtec-discounts-tool-wrap').remove(); 72 73 } 74 }); 75 }); 76 77 function rtecInitGatewaySelector($context){ 78 $context.find('.rtec-payment-gateway-selector-input').on('change', function(){ 79 rtecToggleGateway($context); 80 }); 81 } 82 function rtecToggleGateway($context){ 83 $context.find('.rtec-payment-submit-item').hide(); 84 $context.find('.rtec-payment-submit-item').each(function() { 85 let $this = $(this), 86 gateway = $this.attr('data-service'); 87 88 if($context.find('.rtec-payment-gateway-selector-input[value="' + gateway + '"]').is(':checked')){ 89 $this.show(); 90 } 91 }); 92 } 93 94 function rtecPaymentAfterResize() { 95 if ( $('.rtec-payment-table-wrap').length ) { 96 if ($('.rtec-payment-table-wrap').width() < 500) { 97 $('.rtec-payment-table-wrap').addClass('rtec-table-narrow'); 98 } else { 99 $('.rtec-payment-table-wrap').removeClass('rtec-table-narrow'); 100 } 101 } 102 } 103 }); 104 105 106 107});
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.