1jQuery( function( $ ) { 2 var button = $( '.single_variation_wrap .single_add_to_cart_button' ); 3 var add_to_cart_text = button.html(); 4 $( 'form.variations_form' ) 5 .on( 'show_variation', function( event, variation, purchasable ) { 6 var button = $( this ).find( '.single_add_to_cart_button' ); // It's mandatory to override this variable in order to take specifically the current button (when there is more than 1 Variable product in the current page). 7 8 if ( 'yes' === variation.is_pre_order ) { 9 // Show button label 10 button.html( variation.pre_order_label ); 11 12 // Show date label 13 var unix_time = parseInt( $( this ).find( 'div.pre_order_single' ).data( 'time' ) ); 14 var date = new Date( 0 ); 15 date.setUTCSeconds( unix_time ); 16 var time = date.toLocaleTimeString(); 17 time = time.slice( 0, -3 ); 18 $( this ).find( '.pre_order_single .availability_date' ).text( date.toLocaleDateString() ); 19 $( this ).find( '.pre_order_single .availability_time' ).text( time ); 20 21 } else { 22 button.html( add_to_cart_text ); 23 } 24 } ) 25 .on( 'hide_variation', function( event ) { 26 var button = $( this ).find( '.single_add_to_cart_button' ); 27 event.preventDefault(); 28 button.html( add_to_cart_text ); 29 } ); 30 31 // Show date label for simple products 32 $( 'div.pre_order_single, div.pre_order_loop' ).each( function () { 33 var unix_time = parseInt( $( this ).data( 'time' ) ); 34 var date = new Date( 0 ); 35 date.setUTCSeconds( unix_time ); 36 var time = date.toLocaleTimeString(); 37 time = time.slice( 0, -3 ); 38 $( this ).find( '.availability_date' ).text( date.toLocaleDateString() ); 39 $( this ).find( '.availability_time' ).text( time ); 40 } ); 41} );
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.