// source --> http://peterlevinmusic.com/wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart.min.js?ver=3.5.2 jQuery(function(e){if("undefined"==typeof wc_add_to_cart_params)return!1;var t=function(){e(document.body).on("click",".add_to_cart_button",this.onAddToCart).on("click",".remove_from_cart_button",this.onRemoveFromCart).on("added_to_cart",this.updateButton).on("added_to_cart",this.updateCartPage).on("added_to_cart removed_from_cart",this.updateFragments)};t.prototype.onAddToCart=function(t){var a=e(this);if(a.is(".ajax_add_to_cart")){if(!a.attr("data-product_id"))return!0;t.preventDefault(),a.removeClass("added"),a.addClass("loading");var o={};e.each(a.data(),function(t,a){o[t]=a}),e(document.body).trigger("adding_to_cart",[a,o]),e.post(wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart"),o,function(t){t&&(t.error&&t.product_url?window.location=t.product_url:"yes"!==wc_add_to_cart_params.cart_redirect_after_add?e(document.body).trigger("added_to_cart",[t.fragments,t.cart_hash,a]):window.location=wc_add_to_cart_params.cart_url)})}},t.prototype.onRemoveFromCart=function(t){var a=e(this),o=a.closest(".woocommerce-mini-cart-item");t.preventDefault(),o.block({message:null,overlayCSS:{opacity:.6}}),e.post(wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","remove_from_cart"),{cart_item_key:a.data("cart_item_key")},function(t){t&&t.fragments?e(document.body).trigger("removed_from_cart",[t.fragments,t.cart_hash,a]):window.location=a.attr("href")}).fail(function(){window.location=a.attr("href")})},t.prototype.updateButton=function(t,a,o,r){(r=void 0!==r&&r)&&(r.removeClass("loading"),r.addClass("added"),wc_add_to_cart_params.is_cart||0!==r.parent().find(".added_to_cart").length||r.after(' '+wc_add_to_cart_params.i18n_view_cart+""),e(document.body).trigger("wc_cart_button_updated",[r]))},t.prototype.updateCartPage=function(){var t=window.location.toString().replace("add-to-cart","added-to-cart");e(".shop_table.cart").load(t+" .shop_table.cart:eq(0) > *",function(){e(".shop_table.cart").stop(!0).css("opacity","1").unblock(),e(document.body).trigger("cart_page_refreshed")}),e(".cart_totals").load(t+" .cart_totals:eq(0) > *",function(){e(".cart_totals").stop(!0).css("opacity","1").unblock(),e(document.body).trigger("cart_totals_refreshed")})},t.prototype.updateFragments=function(t,a){a&&(e.each(a,function(t){e(t).addClass("updating").fadeTo("400","0.6").block({message:null,overlayCSS:{opacity:.6}})}),e.each(a,function(t,a){e(t).replaceWith(a),e(t).stop(!0).css("opacity","1").unblock()}),e(document.body).trigger("wc_fragments_loaded"))},new t}); // source --> http://peterlevinmusic.com/wp-content/plugins/js_composer/assets/js/vendors/woocommerce-add-to-cart.js?ver=5.4.7 window.jQuery( document ).ready( function ( $ ) { $( 'body' ).on( 'adding_to_cart', function ( event, $button, data ) { $button && $button.hasClass( 'vc_gitem-link' ) && $button .addClass( 'vc-gitem-add-to-cart-loading-btn' ) .parents( '.vc_grid-item-mini' ) .addClass( 'vc-woocommerce-add-to-cart-loading' ) .append( $( '
' ) ); } ).on( 'added_to_cart', function ( event, fragments, cart_hash, $button ) { if ( 'undefined' === typeof($button) ) { $button = $( '.vc-gitem-add-to-cart-loading-btn' ); } $button && $button.hasClass( 'vc_gitem-link' ) && $button .removeClass( 'vc-gitem-add-to-cart-loading-btn' ) .parents( '.vc_grid-item-mini' ) .removeClass( 'vc-woocommerce-add-to-cart-loading' ) .find( '.vc_wc-load-add-to-loader-wrapper' ).remove(); } ); } ); // source --> http://peterlevinmusic.com/wp-content/themes/lush/js/gambit-smoothscroll.js?ver=1 /** * Gambit Smooth Scroll Javascript Library * Author Benjamin Intal - Gambit Technologies Inc * Version 3.1 * License: Proprietary, Gambit Technologies Inc & Benjamin Intal */ (function() { this.GambitSmoothScroll = function( settings ){ if ( typeof settings === 'undefined' ) { settings = {}; } var defaults = { 'amount': 150, 'speed': 900 }; for ( var key in defaults ) { if ( ! settings.hasOwnProperty( key ) ) { settings[ key ] = defaults[ key ]; } } // Disable in mobile because we don't need smooth scrolling there if ( navigator.userAgent.match(/Mobi/)) { return; } this.settings = settings; this.startedAsTrackpad = false; this.start(); }; /** * Start our plugin */ GambitSmoothScroll.prototype.start = function() { document.addEventListener('DOMContentLoaded', function() { window.addEventListener( 'wheel', this.overrideScroll.bind(this) ); }.bind(this)); }; /** * Stops the current scroll */ GambitSmoothScroll.prototype.stop = function( isDown, timestamp ) { if ( typeof this.scrollInterval !== 'undefined' ) { this.startedAsTrackpad = false; clearInterval( this.scrollInterval ); this.scrollInterval = undefined; } }; /** * Performs the smooth page scroll */ GambitSmoothScroll.prototype.newScroll = function( isDown, timestamp ) { // If the scroll went the opposite way, reset the scroll as if from full stop if ( isDown !== this.isDown && typeof this.isDown !== 'undefined' ) { this.stop(); } this.isDown = isDown; // If called to scroll from a full stop, create our scroller loop if ( typeof this.scrollInterval === 'undefined' ) { this.startingSpeed = this.settings.amount; this.scrollInterval = setInterval( function() { // Perform the scroll var scrollBy = ( this.isDown ? 1 : -1 ) * this.startingSpeed / 15; //window.scrollBy( 0, scrollBy ); document.getElementById("pusher").scrollTop += scrollBy; // Stop the scroller when the scroll becomes too small this.startingSpeed *= 1 - ( 900 / this.settings.speed ) / 10; // 0.9; if ( Math.abs( scrollBy ) < 1 ) { this.stop(); } }.bind(this), 16.666666667 ); // 60fps // If called while the page is still scrolling, add more momentum to the current scroll } else { // Base the momentum multiplier on the delta time to avoid super fast scrolls var multiplier = 1 + ( timestamp - this.prevTimestamp ) / 40 * 0.7; // Limit the amount this.startingSpeed = Math.max( this.startingSpeed * multiplier, this.settings.amount ); this.startingSpeed = Math.min( this.startingSpeed, 300 ); } this.prevTimestamp = timestamp; }; /** * Stops the default scroll behavior and does our own thing */ GambitSmoothScroll.prototype.overrideScroll = function(e) { if(!jQuery('.side-menu').hasClass('open')) { // Normalize wheel delta scroll var delta = e.wheelDelta ? -e.wheelDelta / 120 : (e.detail || e.deltaY) / 3; /** * Basically, when we check the delta variable, trackpads give out a value of < 1 && < -1 * mouse wheel scrolls give out a value >= 1 || <= -1 * We can use this to turn OFF smooth scrolling for trackpads. * * IMPORTANT: Firefox in Mac somehow handles things differently. * the skipCheck variable handles things for FF in Macs */ // Special for Firefox-Mac var skipCheck = false; if ( typeof window.mozInnerScreenX !== 'undefined' ) { if ( navigator.platform.indexOf( 'Mac' ) !== -1 ) { this.startedAsTrackpad = false; skipCheck = true; if ( e.deltaY === parseInt( e.deltaY, 10 ) ) { this.startedAsTrackpad = true; return; } } } if ( typeof this.trackpadTimeout !== 'undefined' ) { clearTimeout( this.trackpadTimeout ); this.trackpadTimeout = undefined; } // If delta is less than 1, assume that we are using a trackpad and do the normal behavior if ( ( Math.abs( delta ) < 1 || this.startedAsTrackpad ) && ! skipCheck ) { this.trackpadTimeout = setTimeout( function() { this.startedAsTrackpad = false; this.trackpadTimeout = undefined; }.bind(this), 200 ); this.startedAsTrackpad = true; return true; } // If the code reaches here, then scrolling will be smoothened // Disable normal scrolling e = e || window.event; if ( e.preventDefault ) { e.preventDefault(); } e.returnValue = false; // Perform our own scrolling this.newScroll( delta > 0, e.timeStamp ); }; }// end : if(!jQuery('.side-menu').hasClass('open')) }()); new GambitSmoothScroll();