1jQuery( document ).ready(function () { 2 addApplePayEnabledToCookie(); 3 addFingerprintToCardPayment(); 4 5 jQuery( 'body' ).on('click', '.paynow-data-processing-info-less .expand', toggleProcessingInfo); 6 7 jQuery( 'body' ).on( 'updated_checkout', function () { 8 addFingerprintToCardPayment(); 9 }); 10 11 jQuery(document).on('click', '.paynow-payment-card-menu .paynow-payment-card-menu-button', function (e) { 12 jQuery(e.currentTarget).siblings().toggleClass('--hidden'); 13 }); 14 15 jQuery(document).on('click', function (e) { 16 if (!jQuery(e.target).is('[data-remove-saved-instrument]') && !jQuery(e.target).is('.paynow-payment-card-menu .paynow-payment-card-menu-button')) { 17 jQuery('[data-remove-saved-instrument]').addClass('--hidden') 18 } 19 }); 20 21 jQuery(document).on('click', '[data-remove-saved-instrument]', function (e) { 22 const target = jQuery(e.currentTarget); 23 const savedInstrument = target.data('removeSavedInstrument'); 24 const nonce = target.data('nonce'); 25 const errorMessage = target.data('errorMessage'); 26 const cardMethodOption = jQuery('#wrapper-' + savedInstrument); 27 28 cardMethodOption.addClass('loading'); 29 jQuery.ajax(target.data('action'), { 30 method: 'POST', type: 'POST', 31 data: { 32 'savedInstrumentToken': savedInstrument, 33 '_wpnonce': nonce, 34 }, 35 }).success(function (data, textStatus, jqXHR) { 36 if (data.success === true) { 37 cardMethodOption.remove(); 38 } else { 39 cardMethodOption.removeClass('loading'); 40 showRemoveSavedInstrumentErrorMessage(savedInstrument, errorMessage); 41 } 42 }).error(function (jqXHR, textStatus, errorThrown) { 43 cardMethodOption.removeClass('loading'); 44 showRemoveSavedInstrumentErrorMessage(savedInstrument, errorMessage); 45 }); 46 }); 47}); 48 49function addApplePayEnabledToCookie() { 50 let applePayEnabled = false; 51 52 if (window.ApplePaySession) { 53 applePayEnabled = window.ApplePaySession.canMakePayments(); 54 } 55 56 document.cookie = 'applePayEnabled=' + (applePayEnabled ? '1' : '0'); 57} 58 59function addFingerprintToCardPayment() { 60 const input = jQuery('#payment-method-fingerprint'); 61 62 if (!input.length) { 63 return; 64 } 65 66 try { 67 const fpPromise = import('https://static.paynow.pl/scripts/PyG5QjFDUI.min.js') 68 .then(FingerprintJS => FingerprintJS.load()) 69 70 fpPromise 71 .then(fp => fp.get()) 72 .then(result => { 73 input.val(result.visitorId); 74 }) 75 } catch (e) { 76 console.error('Cannot get fingerprint'); 77 } 78} 79 80function showRemoveSavedInstrumentErrorMessage(savedInstrument, errorMessage) { 81 const errorMessageWrapper = jQuery('#wrapper-' + savedInstrument + ' .paynow-payment-card-error'); 82 83 errorMessageWrapper.text(errorMessage); 84 85 setTimeout(() => { 86 errorMessageWrapper.text(''); 87 }, 5000) 88} 89 90function toggleProcessingInfo() { 91 let $target = jQuery( jQuery( this ).data( 'target' ) ); 92 if ( ! $target.hasClass( 'show' )) { 93 $target.slideDown(); 94 $target.addClass( 'show' ); 95 jQuery( this ).text( jQuery( this ).data( 'expanded-text' ) ); 96 } else { 97 $target.slideUp(); 98 $target.removeClass( 'show' ); 99 jQuery( this ).text( jQuery( this ).data( 'collapsed-text' ) ); 100 } 101}
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.