1 2$j(document).ready(function() { 3 "use strict"; 4 5 $j('.price_slider_wrapper').parents('.widget').addClass('widget_price_filter'); 6 initSelect2(); 7 initAddToCartPlusMinus(); 8}); 9 10function initSelect2() { 11 $j('.woocommerce-ordering .orderby, #calc_shipping_country, #dropdown_product_cat').select2({ 12 minimumResultsForSearch: -1 13 }); 14 $j('.woocommerce-account .country_select').select2(); 15} 16 17function initAddToCartPlusMinus(){ 18 19 $j(document).on( 'click', '.quantity .plus, .quantity .minus', function() { 20 21 // Get values 22 var $qty = $j(this).closest('.quantity').find('.qty'), 23 currentVal = parseFloat( $qty.val() ), 24 max = parseFloat( $qty.attr( 'max' ) ), 25 min = parseFloat( $qty.attr( 'min' ) ), 26 step = $qty.attr( 'step' ); 27 28 // Format values 29 if ( ! currentVal || currentVal === '' || currentVal === 'NaN' ) currentVal = 0; 30 if ( max === '' || max === 'NaN' ) max = ''; 31 if ( min === '' || min === 'NaN' ) min = 0; 32 if ( step === 'any' || step === '' || step === undefined || parseFloat( step ) === 'NaN' ) step = 1; 33 34 // Change the value 35 if ( $j( this ).is( '.plus' ) ) { 36 37 if ( max && ( max == currentVal || currentVal > max ) ) { 38 $qty.val( max ); 39 } else { 40 $qty.val( currentVal + parseFloat( step ) ); 41 } 42 43 } else { 44 45 if ( min && ( min == currentVal || currentVal < min ) ) { 46 $qty.val( min ); 47 } else if ( currentVal > 0 ) { 48 $qty.val( currentVal - parseFloat( step ) ); 49 } 50 } 51 52 // Trigger change event 53 $qty.trigger( 'change' ); 54 }); 55}
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.