1(function ( $ ) { 2 "use strict"; 3 4 const $document = $(document); 5 6 let enableDonateButton = function( WidgetContainer ){ 7 WidgetContainer.find('button.dropp-payment').attr('disabled', false); 8 }; 9 10 let disableDonateButton = function( WidgetContainer ){ 11 WidgetContainer.find('button.dropp-payment').attr('disabled', 'disabled'); 12 }; 13 14 let setDonationAmount = function( WidgetContainer, amount = '' ){ 15 WidgetContainer.find('button.dropp-payment').attr('data-amount', amount); 16 } 17 18 $document.on( 'change', 'input[name="droppcc-button-amount"]', function( e ){ 19 let WidgetContainer = $( e.target ).closest('.droppcc-widget__content'); 20 let value = WidgetContainer.find('input[name="droppcc-button-amount"]:checked').val(); 21 22 if( '' !== value ){ 23 WidgetContainer.find('input[name="dropp_wd_custom_amount"]').val('').removeClass('dropp_input_active'); 24 }; 25 26 enableDonateButton( WidgetContainer ); 27 setDonationAmount( WidgetContainer, value ); 28 29 }); 30 31 $document.on( 'change', 'input[name="dropp_wd_custom_amount"]', function( e ){ 32 let WidgetContainer = $( e.target ).closest('.droppcc-widget__content'); 33 let value = e.target.value; 34 35 if( '' !== value ){ 36 WidgetContainer.find('input[name="droppcc-button-amount"]').prop('checked', ''); 37 $(this).addClass('dropp_input_active'); 38 39 setDonationAmount( WidgetContainer, value ); 40 enableDonateButton( WidgetContainer ); 41 } else { 42 $(this).removeClass('dropp_input_active'); 43 setDonationAmount( WidgetContainer, '' ); 44 disableDonateButton( WidgetContainer ); 45 }; 46 47 }); 48 49 $document.on( 'keydown', 'input[name="dropp_wd_custom_amount"]', function( e ){ 50 // limiting to 2 decimal places 51 if(!new RegExp(/^\d*\.?\d{0,1}$/).test(e.target.value)){ e.preventDefault(); } 52 }); 53 54})( jQuery );
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.