1jQuery( function( $ ) { 2 3 jQuery('.woocommerce').on( 'click', '.woocommerce-product-gallery__trigger', function() { 4 jQuery('.creativo-elements-template-content').css('z-index','100'); 5 }); 6 7 $('.single-product .woocommerce-product-gallery__trigger').empty(); 8 9 if ( ! String.prototype.getDecimals ) { 10 String.prototype.getDecimals = function() { 11 var num = this, 12 match = ('' + num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/); 13 if ( ! match ) { 14 return 0; 15 } 16 return Math.max( 0, ( match[1] ? match[1].length : 0 ) - ( match[2] ? +match[2] : 0 ) ); 17 } 18 } 19 20 function wcqi_refresh_quantity_increments(){ 21 $( '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" />' ); 22 } 23 24 $( document ).on( 'updated_wc_div', function() { 25 wcqi_refresh_quantity_increments(); 26 } ); 27 28 $( document ).on( 'click', '.plus, .minus', function() { 29 // Get values 30 var $qty = $( this ).closest( '.quantity' ).find( '.qty'), 31 currentVal = parseFloat( $qty.val() ), 32 max = parseFloat( $qty.attr( 'max' ) ), 33 min = parseFloat( $qty.attr( 'min' ) ), 34 step = $qty.attr( 'step' ); 35 36 // Format values 37 if ( ! currentVal || currentVal === '' || currentVal === 'NaN' ) currentVal = 0; 38 if ( max === '' || max === 'NaN' ) max = ''; 39 if ( min === '' || min === 'NaN' ) min = 0; 40 if ( step === 'any' || step === '' || step === undefined || parseFloat( step ) === 'NaN' ) step = 1; 41 42 // Change the value 43 if ( $( this ).is( '.plus' ) ) { 44 if ( max && ( currentVal >= max ) ) { 45 $qty.val( max ); 46 } else { 47 $qty.val( ( currentVal + parseFloat( step )).toFixed( step.getDecimals() ) ); 48 } 49 } else { 50 if ( min && ( currentVal <= min ) ) { 51 $qty.val( min ); 52 } else if ( currentVal > 0 ) { 53 $qty.val( ( currentVal - parseFloat( step )).toFixed( step.getDecimals() ) ); 54 } 55 } 56 57 // Trigger change event 58 $qty.trigger( 'change' ); 59 }); 60 61 62 63 wcqi_refresh_quantity_increments(); 64});
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.