1jQuery( document ).ready( function( $ ) { 2 3 4 // Quantity buttons 5 var add_quantity_button = function () { 6 $( 'div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)' ).addClass( 'buttons_added' ).append( '<input type="button" value="+" class="plus" />' ).prepend( '<input type="button" value="-" class="minus" />' ); 7 } 8 //fix woocommerce composite 9 $( document ).on( 'wc-composite-ui-updated qv_loader_stop cart_page_refreshed wc_fragments_refreshed applied_coupon update_shipping_method removed_coupon updated_wc_div', add_quantity_button); 10 11 add_quantity_button(); 12 13 $( document ).on( 'click', '.plus, .minus', function() { 14 15 // Get values 16 var $qty = $( this ).closest( '.quantity' ).find( '.qty' ), 17 currentVal = parseFloat( $qty.val() ), 18 max = parseFloat( $qty.attr( 'max' ) ), 19 min = parseFloat( $qty.attr( 'min' ) ), 20 step = $qty.attr( 'step' ); 21 22 // Format values 23 if ( ! currentVal || currentVal === '' || currentVal === 'NaN' ) currentVal = 0; 24 if ( max === '' || max === 'NaN' ) max = ''; 25 if ( min === '' || min === 'NaN' ) min = 0; 26 if ( step === 'any' || step === '' || step === undefined || parseFloat( step ) === 'NaN' ) step = 1; 27 28 // Change the value 29 if ( $( this ).is( '.plus' ) ) { 30 31 if ( max && ( max == currentVal || currentVal > max ) ) { 32 $qty.val( max ); 33 } else { 34 $qty.val( currentVal + parseFloat( step ) ); 35 } 36 37 } else { 38 39 if ( min && ( min == currentVal || currentVal < min ) ) { 40 $qty.val( min ); 41 } else if ( currentVal > 0 ) { 42 $qty.val( currentVal - parseFloat( step ) ); 43 } 44 45 } 46 47 // Trigger change event 48 $qty.trigger( 'change' ); 49 }); 50 51 $( document ).on( 'qv_loader_stop', function() { 52 53 $( 'div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)' ).addClass( 'buttons_added' ).append( '<input type="button" value="+" class="plus" />' ).prepend( '<input type="button" value="-" class="minus" />' ); 54 55 }); 56 57});
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.