1( function( $ ) { 2 3 $( document ).ready( function() { 4 5 /** 6 * Render add to cart button. 7 * Table with Event tickets - Shortcode 8 * Display Type: Dropdown 9 */ 10 $( document ).on( 'change', '.tc-wb-event-dropdown-wrap select.ticket-type-id', function() { 11 12 let wrapper = $( this ).closest( '.tc-wb-event-dropdown-wrap' ), 13 ticketId = $( this ).val(), 14 actionsContainer = wrapper.find( '.actions' ), 15 addToCartContainer = actionsContainer.find( '[id="ticket-type-' + ticketId + '"]' ); 16 17 addToCartContainer.prependTo( actionsContainer ); 18 }); 19 20 /** 21 * Update add to cart data-quantity attribute on quantity change. 22 */ 23 $( document ).on( 'change keyup', '.tc-wb-quantity-selector', function() { 24 25 let wrapper = $( this ).closest( '.event_tickets' ), 26 quantity = $( this ).val(), 27 isTable = ( wrapper.length ) ? true : false; 28 29 if ( isTable ) { 30 31 let currentRow = $( this ).closest( 'tr' ), 32 addToCartBtn = currentRow.find( '.tc-wb-add-to-cart .add_to_cart_button' ), 33 addToCartHref = addToCartBtn.attr( 'href' ).replace( /(?=&).+/g, '' ); 34 35 addToCartBtn.attr( { 36 'href': addToCartHref + '&quantity=' + quantity, 37 'data-quantity': quantity 38 }); 39 40 } else { 41 42 wrapper = $( this ).closest( 'div' ).parent(); 43 let addToCartBtn = wrapper.find( '.tc-wb-add-to-cart .add_to_cart_button' ), 44 addToCartHref = addToCartBtn.attr( 'href' ).replace( /(?=&).+/g, '' ); 45 46 addToCartBtn.attr( { 47 'href': addToCartHref + '&quantity=' + quantity, 48 'data-quantity': quantity 49 }); 50 } 51 }); 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.