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