1( function ( $ ) { 2 3 "use strict"; 4 5 window.BuddyBossThemeWc = { 6 init: function () { 7 this.wcShop(); 8 this.wcProductSlider(); 9 }, 10 11 wcShop: function() { 12 13 $( '.wc-widget-area .widget_product_categories ul.product-categories .cat-item.cat-parent' ).each( function () { 14 var self = $( this ); 15 16 self.prepend( '<span class="expand-parent"><i class="bb-icon-angle-right"></i></span>' ); 17 if ( self.is( '.current-cat, .current-cat-parent' ) ) { 18 self.find( '.expand-parent' ).first().addClass( 'active' ); 19 self.addClass( 'cat-expanded' ); 20 } 21 } ); 22 23 $( document ).on( 'click', 'ul.product-categories li span.expand-parent', function ( e ) { 24 var self = $( this ), 25 catParent = self.closest( 'li.cat-parent' ), 26 catChildrent = catParent.find( 'ul.children' ).first(); 27 28 self.toggleClass( 'active' ); 29 catChildrent.slideToggle( '200' ); 30 } ); 31 32 $( '.wc-widget-area .widget_product_categories ul.product-categories li .count' ).text( function ( _, text ) { 33 return text.replace( /\(|\)/g, '' ); 34 } ); 35 36 $( '#tab-title-reviews a' ).html( function ( i, h ) { 37 return h.replace( /\(/g, '<span>' ).replace( /\)/, '</span>' ); 38 } ); 39 40 $( document ).on( 'click', '.bs-quantity .quantity-button:not(".limit")', function () { 41 var input_qty = $( this ).parents( '.bs-quantity' ).find( 'input' ), 42 oldValue = input_qty.val(), 43 newVal = oldValue, 44 min = input_qty.attr( 'min' ), 45 max = input_qty.attr( 'max' ); 46 47 if ( oldValue == 0 ) { 48 $( this ).parents( '.bs-quantity' ).find( '.quantity-down' ).addClass( 'limit' ); 49 } 50 51 if ( $( this ).hasClass( 'quantity-up' ) ) { 52 $( this ).parents( '.bs-quantity' ).find( '.quantity-down' ).removeClass( 'limit' ); 53 if ( parseInt( oldValue ) == parseInt( max ) - 1 ) { 54 $( this ).parents( '.bs-quantity' ).find( '.quantity-up' ).addClass( 'limit' ); 55 } 56 if ( max.length === 0 ) { 57 newVal = parseInt( oldValue ) + 1; 58 } else { 59 if ( parseInt( oldValue ) >= parseInt( max ) ) { 60 newVal = parseInt( oldValue ); 61 } else { 62 newVal = parseInt( oldValue ) + 1; 63 } 64 } 65 } else { 66 if ( parseInt( oldValue ) == parseInt( min ) + 1 ) { 67 $( this ).parents( '.bs-quantity' ).find( '.quantity-down' ).addClass( 'limit' ); 68 } 69 if ( parseInt( oldValue ) <= parseInt( min ) ) { 70 newVal = parseInt( oldValue ); 71 } else { 72 newVal = parseInt( oldValue ) - 1; 73 $( this ).parents( '.bs-quantity' ).find( '.quantity-up' ).removeClass( 'limit' ); 74 } 75 } 76 $( this ).parents( '.bs-quantity' ).find( 'input' ).val( parseInt( newVal ) ).trigger( 'change' ); 77 } ); 78 79 $( document ).on( "change", "form[name='checkout'] input[name='payment_method']", function () { 80 if ( $( this ).is( ':checked' ) ) { 81 $( this ).addClass( "selected_payment_method" ); 82 } else { 83 $( this ).removeClass( "selected_payment_method" ); 84 } 85 } ); 86 87 $( document ).on( 'click', 'a.push-my-account-nav', function ( event ) { 88 event.preventDefault(); 89 90 var self = $( this ); 91 var navContainer = $( this ).closest( '.woocommerce-MyAccount-navigation' ); 92 navContainer.find( 'ul.woocommerce-MyAccount-menu' ).slideToggle(); 93 } ); 94 95 $( document ).on( 'click', 'span.wc-widget-area-expand', function ( event ) { 96 var self = $( this ); 97 var widgetsContainer = $( this ).closest( '#secondary' ); 98 widgetsContainer.find( '.wc-widget-area-expandable' ).slideToggle(); 99 widgetsContainer.find( '.widget.widgets_expand' ).toggleClass( 'active' ); 100 } ); 101 102 if ( $( '.widget_layered_nav' ).length > 0 ) { 103 $( '.widget_layered_nav' ).on( "click", "li input[type='checkbox']", function () { 104 window.location.href = $( this ).data( 'href' ); 105 } ); 106 } 107 108 if ( $( '.widget_price_filter' ).length > 0 ) { 109 $( '.price_slider' ).on( "slidestop", function ( event, ui ) { 110 $( '.price_slider' ).parent().parent().submit(); 111 } ); 112 } 113 114 function filterCheckboxes() {
115 // Checkbox Styling 116 $( '.woocommerce-widget-layered-attribute input[type=checkbox].bb-input-switch' ).each( function () { 117 var $this = $( this ); 118 $this.addClass( 'checkbox' ); 119 if ( $this.is( ':checked' ) ) { 120 $this.next( 'span.checkbox' ).addClass( 'on' ); 121 $this.closest( 'li.woocommerce-widget-layered-nav-list__item' ).addClass( 'on' ); 122 } 123 ; 124 $this.fadeTo( 0, 0 ); 125 $this.change( function () { 126 $this.next( 'span.checkbox' ).toggleClass( 'on' ); 127 } ); 128 } ); 129 } 130 filterCheckboxes(); 131 132 var couponCode = 'form.woocommerce-cart-form .coupon #coupon_code'; 133 var couponCodeBtn = 'form.woocommerce-cart-form .coupon .button'; 134 $( document ).on( 'keyup', couponCode, function () { 135 136 var empty = false; 137 $( couponCode ).each( function () { 138 if ( $( this ).val() == '' ) { 139 empty = true; 140 } 141 } ); 142 143 if ( empty ) { 144 $( couponCodeBtn ).removeClass( 'bp-coupon-btn-active' ); 145 } else { 146 $( couponCodeBtn ).addClass( 'bp-coupon-btn-active' ); 147 } 148 } ); 149 150 $( document ).on( 'click', function ( e ) { 151 if ( $( e.target ).closest( '.woocommerce-shipping-calculator .shipping-calculator-form' ).length === 0 ) { 152 $( '.woocommerce-shipping-calculator .shipping-calculator-form' ).hide(); 153 } 154 } ); 155 156 $( document.body ).on( 'removed_from_cart', function () { 157 $( document.body ).one( 'wc_fragments_loaded', function () { 158 $( '.header-cart-link-wrap.menu-item-has-children' ).addClass( 'selected' ); 159 } ); 160 } ); 161 162 }, 163 164 wcProductSlider: function() { 165 function wcProductGallery() { 166 var wcGallery = { 167 infinite: false, 168 slidesToShow: 3, 169 slidesToScroll: 1, 170 adaptiveHeight: true, 171 arrows: true, 172 prevArrow: '<span class="bb-slide-prev"><i class="bb-icon-angle-right"></i></span>', 173 nextArrow: '<span class="bb-slide-next"><i class="bb-icon-angle-right"></i></span>', 174 } 175 176 setTimeout( function() { //Defer until DOM is ready 177 $( '.woocommerce-product-gallery .flex-control-thumbs' ).not( '.slick-initialized' ).slick( wcGallery ); 178 },0); 179 } 180 181 wcProductGallery(); 182 }, 183 184 }; 185 186 $( document ).on( 'ready', function () { 187 BuddyBossThemeWc.init(); 188 } ); 189 190} )( 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.