first commit
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Woo account Login/Register links
|
||||
oceanwpWooAccountLinks();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
WOOCOMMERCE ACCOUNT LOGIN/REGISTER LINKS
|
||||
============================================== */
|
||||
function oceanwpWooAccountLinks() {
|
||||
"use strict"
|
||||
|
||||
// Return if registration disabled
|
||||
if ( $j( '.owp-account-links' ).hasClass( 'registration-disabled' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Vars
|
||||
var $login = $j( '.owp-account-links .login a' ),
|
||||
$register = $j( '.owp-account-links .register a' ),
|
||||
$col_1 = $j( '#customer_login .col-1' ),
|
||||
$col_2 = $j( '#customer_login .col-2' );
|
||||
|
||||
// Display login form
|
||||
$login.on( 'click', function() {
|
||||
|
||||
$j( this ).addClass( 'current' );
|
||||
$register.removeClass( 'current' );
|
||||
|
||||
$col_1.siblings().stop().fadeOut( function() {
|
||||
$col_1.fadeIn();
|
||||
} );
|
||||
|
||||
return false;
|
||||
} );
|
||||
|
||||
// Display register form
|
||||
$register.on( 'click', function() {
|
||||
|
||||
$j( this ).addClass( 'current' );
|
||||
$login.removeClass( 'current' );
|
||||
|
||||
$col_2.siblings().stop().fadeOut( function() {
|
||||
$col_2.fadeIn();
|
||||
} );
|
||||
|
||||
return false;
|
||||
} );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Woo catalog view
|
||||
oceanwpWooGridList();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
WOOCOMMERCE GRID LIST VIEW
|
||||
============================================== */
|
||||
function oceanwpWooGridList() {
|
||||
"use strict"
|
||||
|
||||
if ( $j( 'body' ).hasClass( 'has-grid-list' ) ) {
|
||||
|
||||
// Re-run function
|
||||
var oceanwpProductSlider = function() {
|
||||
if ( ! $j( 'body' ).hasClass( 'no-carousel' )
|
||||
&& $j( '.woo-entry-image.product-entry-slider' ).length) {
|
||||
setTimeout( function() {
|
||||
$j( '.woo-entry-image.product-entry-slider' ).slick( 'unslick' );
|
||||
oceanwpInitCarousel();
|
||||
}, 350 );
|
||||
}
|
||||
}
|
||||
|
||||
$j( '#oceanwp-grid' ).on( 'click', function() {
|
||||
oceanwpProductSlider();
|
||||
|
||||
$j( this ).addClass( 'active' );
|
||||
$j( '#oceanwp-list' ).removeClass( 'active' );
|
||||
Cookies.set( 'gridcookie', 'grid', { path: '' } );
|
||||
$j( '.woocommerce ul.products' ).fadeOut( 300, function() {
|
||||
$j( this ).addClass( 'grid' ).removeClass( 'list' ).fadeIn( 300 );
|
||||
} );
|
||||
return false;
|
||||
} );
|
||||
|
||||
$j( '#oceanwp-list' ).on( 'click', function() {
|
||||
oceanwpProductSlider();
|
||||
|
||||
$j( this ).addClass( 'active' );
|
||||
$j( '#oceanwp-grid' ).removeClass( 'active' );
|
||||
Cookies.set( 'gridcookie', 'list', { path: '' } );
|
||||
$j( '.woocommerce ul.products' ).fadeOut( 300, function() {
|
||||
$j( this ).addClass( 'list' ).removeClass( 'grid' ).fadeIn( 300 );
|
||||
} );
|
||||
return false;
|
||||
} );
|
||||
|
||||
if ( Cookies.get( 'gridcookie' ) == 'grid' ) {
|
||||
$j( '.oceanwp-grid-list #oceanwp-grid' ).addClass( 'active' );
|
||||
$j( '.oceanwp-grid-list #oceanwp-list' ).removeClass( 'active' );
|
||||
$j( '.woocommerce ul.products' ).addClass( 'grid' ).removeClass( 'list' );
|
||||
}
|
||||
|
||||
if ( Cookies.get( 'gridcookie' ) == 'list' ) {
|
||||
$j( '.oceanwp-grid-list #oceanwp-list' ).addClass( 'active' );
|
||||
$j( '.oceanwp-grid-list #oceanwp-grid' ).removeClass( 'active' );
|
||||
$j( '.woocommerce ul.products' ).addClass( 'list' ).removeClass( 'grid' );
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
Cookies.remove( 'gridcookie', { path: '' } );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( window ).ready( function() {
|
||||
"use strict";
|
||||
// Woo quantity buttons
|
||||
oceanwpWooQuantityButtons();
|
||||
} );
|
||||
|
||||
$j( document ).ajaxComplete( function() {
|
||||
"use strict";
|
||||
// Woo quantity buttons
|
||||
oceanwpWooQuantityButtons();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
WOOCOMMERCE QUANTITY BUTTONS
|
||||
============================================== */
|
||||
function oceanwpWooQuantityButtons( $quantitySelector ) {
|
||||
|
||||
var $quantityBoxes
|
||||
$cart = $j( '.woocommerce div.product form.cart' );
|
||||
|
||||
if ( ! $quantitySelector ) {
|
||||
$quantitySelector = '.qty';
|
||||
}
|
||||
|
||||
$quantityBoxes = $j( 'div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)' ).find( $quantitySelector );
|
||||
|
||||
if ( $quantityBoxes && 'date' !== $quantityBoxes.prop( 'type' ) && 'hidden' !== $quantityBoxes.prop( 'type' ) ) {
|
||||
|
||||
// Add plus and minus icons
|
||||
$quantityBoxes.parent().addClass( 'buttons_added' ).prepend('<a href="javascript:void(0)" class="minus">-</a>');
|
||||
$quantityBoxes.after('<a href="javascript:void(0)" class="plus">+</a>');
|
||||
|
||||
// Target quantity inputs on product pages
|
||||
$j( 'input' + $quantitySelector + ':not(.product-quantity input' + $quantitySelector + ')' ).each( function() {
|
||||
var $min = parseFloat( $j( this ).attr( 'min' ) );
|
||||
|
||||
if ( $min && $min > 0 && parseFloat( $j( this ).val() ) < $min ) {
|
||||
$j( this ).val( $min );
|
||||
}
|
||||
});
|
||||
|
||||
// Quantity input
|
||||
if ( $j( 'body' ).hasClass( 'single-product' )
|
||||
&& 'on' == oceanwpLocalize.floating_bar
|
||||
&& ! $cart.hasClass( 'grouped_form' )
|
||||
&& ! $cart.hasClass( 'cart_group' ) ) {
|
||||
var $quantityInput = $j( '.woocommerce form input[type=number].qty' );
|
||||
$quantityInput.on( 'keyup', function() {
|
||||
var qty_val = $j( this ).val();
|
||||
$quantityInput.val( qty_val );
|
||||
});
|
||||
}
|
||||
|
||||
$j( '.plus, .minus' ).unbind( 'click' );
|
||||
|
||||
$j( '.plus, .minus' ).on( 'click', function() {
|
||||
|
||||
// Quantity
|
||||
var $quantityBox;
|
||||
|
||||
// If floating bar is enabled
|
||||
if ( $j( 'body' ).hasClass( 'single-product' )
|
||||
&& 'on' == oceanwpLocalize.floating_bar
|
||||
&& ! $cart.hasClass( 'grouped_form' )
|
||||
&& ! $cart.hasClass( 'cart_group' ) ) {
|
||||
$quantityBox = $j( '.plus, .minus' ).closest( '.quantity' ).find( $quantitySelector );
|
||||
} else {
|
||||
$quantityBox = $j( this ).closest( '.quantity' ).find( $quantitySelector );
|
||||
}
|
||||
|
||||
// Get values
|
||||
var $currentQuantity = parseFloat( $quantityBox.val() ),
|
||||
$maxQuantity = parseFloat( $quantityBox.attr( 'max' ) ),
|
||||
$minQuantity = parseFloat( $quantityBox.attr( 'min' ) ),
|
||||
$step = $quantityBox.attr( 'step' );
|
||||
|
||||
// Fallback default values
|
||||
if ( ! $currentQuantity || '' === $currentQuantity || 'NaN' === $currentQuantity ) {
|
||||
$currentQuantity = 0;
|
||||
}
|
||||
if ( '' === $maxQuantity || 'NaN' === $maxQuantity ) {
|
||||
$maxQuantity = '';
|
||||
}
|
||||
|
||||
if ( '' === $minQuantity || 'NaN' === $minQuantity ) {
|
||||
$minQuantity = 0;
|
||||
}
|
||||
if ( 'any' === $step || '' === $step || undefined === $step || 'NaN' === parseFloat( $step ) ) {
|
||||
$step = 1;
|
||||
}
|
||||
|
||||
// Change the value
|
||||
if ( $j( this ).is( '.plus' ) ) {
|
||||
|
||||
if ( $maxQuantity && ( $maxQuantity == $currentQuantity || $currentQuantity > $maxQuantity ) ) {
|
||||
$quantityBox.val( $maxQuantity );
|
||||
} else {
|
||||
$quantityBox.val( $currentQuantity + parseFloat( $step ) );
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if ( $minQuantity && ( $minQuantity == $currentQuantity || $currentQuantity < $minQuantity ) ) {
|
||||
$quantityBox.val( $minQuantity );
|
||||
} else if ( $currentQuantity > 0 ) {
|
||||
$quantityBox.val( $currentQuantity - parseFloat( $step ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Trigger change event
|
||||
$quantityBox.trigger( 'change' );
|
||||
|
||||
} );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Woo reviews scroll
|
||||
oceanwpWooReviewsScroll();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
WOOCOMMERCE REVIEWS SCROLL
|
||||
============================================== */
|
||||
function oceanwpWooReviewsScroll() {
|
||||
"use strict"
|
||||
|
||||
$j( '.woocommerce div.product .woocommerce-review-link' ).click( function( event ) {
|
||||
$j( '.woocommerce-tabs .description_tab' ).removeClass( 'active' );
|
||||
$j( '.woocommerce-tabs .reviews_tab' ).addClass( 'active' );
|
||||
$j( '.woocommerce-tabs #tab-description' ).css( 'display', 'none' );
|
||||
$j( '.woocommerce-tabs #tab-reviews' ).css( 'display', 'block' );
|
||||
|
||||
$j( 'html, body' ).stop(true,true).animate( {
|
||||
scrollTop: $j( this.hash ).offset().top -120
|
||||
}, 'normal' );
|
||||
return false;
|
||||
} );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Woo remove brackets from categories and filter widgets
|
||||
oceanwpWooRemoveBrackets();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
WOOCOMMERCE REMOVE BRACKETS
|
||||
============================================== */
|
||||
function oceanwpWooRemoveBrackets() {
|
||||
"use strict"
|
||||
|
||||
$j( '.widget_layered_nav span.count, .widget_product_categories span.count' ).each( function() {
|
||||
var count = $j( this ).html();
|
||||
count = count.substring( 1, count.length-1 );
|
||||
$j( this ).html( count );
|
||||
} );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
jQuery( function( $ ) {
|
||||
|
||||
if ( typeof oceanwpLocalize === 'undefined'
|
||||
|| $( '.woocommerce div.product' ).hasClass( 'product-type-grouped' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$.fn.serializeArrayAll = function () {
|
||||
|
||||
var rCRLF = /\r?\n/g;
|
||||
return this.map(function () {
|
||||
return this.elements ? jQuery.makeArray(this.elements) : this;
|
||||
}).map(function (i, elem) {
|
||||
var val = jQuery(this).val();
|
||||
|
||||
if (val == null) {
|
||||
return val == null
|
||||
|
||||
//If checkbox is unchecked
|
||||
} else if (this.type == "checkbox" && this.checked == false) {
|
||||
return {name: this.name, value: this.checked ? this.value : ''}
|
||||
|
||||
} else if (this.type == "radio" && this.checked == false) {
|
||||
return {name: this.name, value: this.checked ? this.value : ''}
|
||||
|
||||
//default: all checkboxes = on
|
||||
} else {
|
||||
return jQuery.isArray(val) ?
|
||||
jQuery.map(val, function (val, i) {
|
||||
return {name: elem.name, value: val.replace(rCRLF, "\r\n")};
|
||||
}) :
|
||||
{name: elem.name, value: val.replace(rCRLF, "\r\n")};
|
||||
}
|
||||
}).get();
|
||||
};
|
||||
|
||||
/**
|
||||
* AddToCartHandler class.
|
||||
*/
|
||||
var owpAddToCartHandler = function() {
|
||||
$( document.body )
|
||||
.on( 'click', '.product:not(.product-type-external) .single_add_to_cart_button:not(.disabled)', this.onAddToCart )
|
||||
.on( 'added_to_cart', this.updateButton );
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle the add to cart event.
|
||||
*/
|
||||
owpAddToCartHandler.prototype.onAddToCart = function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var button = $( this ),
|
||||
$form = $( this ).closest('form.cart'),
|
||||
data = $form.serializeArrayAll();
|
||||
|
||||
var is_valid = false;
|
||||
|
||||
$.each(data, function (i, item) {
|
||||
if (item.name === 'add-to-cart') {
|
||||
is_valid = true;
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
||||
if( is_valid ){
|
||||
e.preventDefault();
|
||||
}
|
||||
else{
|
||||
return;
|
||||
}
|
||||
|
||||
$(document.body).trigger('adding_to_cart', [button, data]);
|
||||
|
||||
button.removeClass( 'added' );
|
||||
button.addClass( 'loading' );
|
||||
|
||||
// Ajax action.
|
||||
$.ajax ({
|
||||
url: oceanwpLocalize.wc_ajax_url,
|
||||
type: 'POST',
|
||||
data : data,
|
||||
|
||||
success:function(results) {
|
||||
$( document.body ).trigger( 'wc_fragment_refresh' );
|
||||
$( document.body ).trigger( 'added_to_cart', [ results.fragments, results.cart_hash, button ] );
|
||||
|
||||
// Redirect to cart option
|
||||
if ( oceanwpLocalize.cart_redirect_after_add === 'yes' ) {
|
||||
window.location = oceanwpLocalize.cart_url;
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Update cart page elements after add to cart events.
|
||||
*/
|
||||
owpAddToCartHandler.prototype.updateButton = function( e, fragments, cart_hash, $button ) {
|
||||
$button = typeof $button === 'undefined' ? false : $button;
|
||||
|
||||
if ( $button ) {
|
||||
$button.removeClass( 'loading' );
|
||||
$button.addClass( 'added' );
|
||||
|
||||
// View cart text.
|
||||
if ( ! oceanwpLocalize.is_cart && $button.parent().find( '.added_to_cart' ).length === 0 ) {
|
||||
$button.after( ' <a href="' + oceanwpLocalize.cart_url + '" class="added_to_cart wc-forward" title="' +
|
||||
oceanwpLocalize.view_cart + '">' + oceanwpLocalize.view_cart + '</a>' );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Init owpAddToCartHandler.
|
||||
*/
|
||||
new owpAddToCartHandler();
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
jQuery(function(n){if("undefined"==typeof oceanwpLocalize||n(".woocommerce div.product").hasClass("product-type-grouped"))return!1;n.fn.serializeArrayAll=function(){var r=/\r?\n/g;return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this}).map(function(e,a){var t=jQuery(this).val();return null==t?null==t:"checkbox"==this.type&&0==this.checked||"radio"==this.type&&0==this.checked?{name:this.name,value:this.checked?this.value:""}:jQuery.isArray(t)?jQuery.map(t,function(e,t){return{name:a.name,value:e.replace(r,"\r\n")}}):{name:a.name,value:t.replace(r,"\r\n")}}).get()};function e(){n(document.body).on("click",".product:not(.product-type-external) .single_add_to_cart_button:not(.disabled)",this.onAddToCart).on("added_to_cart",this.updateButton)}e.prototype.onAddToCart=function(e){e.preventDefault();var t=n(this),a=n(this).closest("form.cart").serializeArrayAll(),r=!1;n.each(a,function(e,t){if("add-to-cart"===t.name)return!(r=!0)}),r&&(e.preventDefault(),n(document.body).trigger("adding_to_cart",[t,a]),t.removeClass("added"),t.addClass("loading"),n.ajax({url:oceanwpLocalize.wc_ajax_url,type:"POST",data:a,success:function(e){n(document.body).trigger("wc_fragment_refresh"),n(document.body).trigger("added_to_cart",[e.fragments,e.cart_hash,t]),"yes"!==oceanwpLocalize.cart_redirect_after_add||(window.location=oceanwpLocalize.cart_url)}}))},e.prototype.updateButton=function(e,t,a,r){(r=void 0!==r&&r)&&(r.removeClass("loading"),r.addClass("added"),oceanwpLocalize.is_cart||0!==r.parent().find(".added_to_cart").length||r.after(' <a href="'+oceanwpLocalize.cart_url+'" class="added_to_cart wc-forward" title="'+oceanwpLocalize.view_cart+'">'+oceanwpLocalize.view_cart+"</a>"))},new e});
|
||||
@@ -0,0 +1,32 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Woo categories widget
|
||||
oceanwpWooCategoriesWidget();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
WOOCOMMERCE CATEGORIES WIDGET
|
||||
============================================== */
|
||||
function oceanwpWooCategoriesWidget() {
|
||||
"use strict"
|
||||
|
||||
$j( '.woo-dropdown-cat .product-categories' ).each( function() {
|
||||
|
||||
var IconDown = '<i class="fa fa-angle-down"></i>',
|
||||
IconUp = '<i class="fa fa-angle-up"></i>';
|
||||
|
||||
$j( this ).find( 'li' ).has( '.children' ).has( 'li' ).prepend( '<div class="open-this">'+ IconDown +'</div>' );
|
||||
|
||||
$j( this ).find( '.open-this' ).on( 'click', function(){
|
||||
if ( $j( this ).parent().hasClass( 'opened' ) ) {
|
||||
$j( this ).html( IconDown ).parent().removeClass( 'opened' ).find( '> ul' ).slideUp( 200 );
|
||||
} else {
|
||||
$j( this ).html( IconUp ).parent().addClass( 'opened' ).find( '> ul' ).slideDown( 200 );
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
var $j=jQuery.noConflict();function oceanwpWooCategoriesWidget(){"use strict";$j(".woo-dropdown-cat .product-categories").each(function(){var e='<i class="fa fa-angle-down"></i>';$j(this).find("li").has(".children").has("li").prepend('<div class="open-this">'+e+"</div>"),$j(this).find(".open-this").on("click",function(){$j(this).parent().hasClass("opened")?$j(this).html(e).parent().removeClass("opened").find("> ul").slideUp(200):$j(this).html('<i class="fa fa-angle-up"></i>').parent().addClass("opened").find("> ul").slideDown(200)})})}$j(document).ready(function(){"use strict";oceanwpWooCategoriesWidget()});
|
||||
@@ -0,0 +1,58 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Woo display cart
|
||||
oceanwpWooDisplayCart();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
WOOCOMMERCE DISPLAY CART
|
||||
============================================== */
|
||||
function oceanwpWooDisplayCart() {
|
||||
"use strict"
|
||||
|
||||
var $overlay = $j( '.owp-cart-overlay' );
|
||||
|
||||
$j( 'body' ).on( 'added_to_cart', function() {
|
||||
$overlay.fadeIn();
|
||||
$j( 'body' ).addClass( 'show-cart' );
|
||||
|
||||
// Close quick view modal if enabled
|
||||
var qv_modal = $j( '#owp-qv-wrap' ),
|
||||
qv_content = $j( '#owp-qv-content' ),
|
||||
header = $j( '#site-header' );
|
||||
|
||||
if ( qv_modal.length ) {
|
||||
$j( 'html' ).css( {
|
||||
'overflow': '',
|
||||
'margin-right': ''
|
||||
} );
|
||||
$j( 'html' ).removeClass( 'owp-qv-open' );
|
||||
|
||||
qv_modal.fadeOut();
|
||||
qv_modal.removeClass( 'is-visible' );
|
||||
|
||||
setTimeout( function() {
|
||||
qv_content.html( '' );
|
||||
}, 600);
|
||||
}
|
||||
|
||||
if ( header.length
|
||||
&& ! header.hasClass( 'fixed-scroll' ) ) {
|
||||
$j( 'html, body' ).animate( { scrollTop: 0 }, 400 );
|
||||
}
|
||||
} );
|
||||
|
||||
$overlay.on( 'click', function() {
|
||||
$j( this ).fadeOut();
|
||||
$j( 'body' ).removeClass( 'show-cart' );
|
||||
} );
|
||||
|
||||
// Close on resize to avoid conflict
|
||||
$j( window ).resize( function() {
|
||||
$overlay.fadeOut();
|
||||
$j( 'body' ).removeClass( 'show-cart' );
|
||||
} );
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
var $j=jQuery.noConflict();function oceanwpWooDisplayCart(){"use strict";var a=$j(".owp-cart-overlay");$j("body").on("added_to_cart",function(){a.fadeIn(),$j("body").addClass("show-cart");var o=$j("#owp-qv-wrap"),t=$j("#owp-qv-content"),e=$j("#site-header");o.length&&($j("html").css({overflow:"","margin-right":""}),$j("html").removeClass("owp-qv-open"),o.fadeOut(),o.removeClass("is-visible"),setTimeout(function(){t.html("")},600)),e.length&&!e.hasClass("fixed-scroll")&&$j("html, body").animate({scrollTop:0},400)}),a.on("click",function(){$j(this).fadeOut(),$j("body").removeClass("show-cart")}),$j(window).resize(function(){a.fadeOut(),$j("body").removeClass("show-cart")})}$j(document).ready(function(){"use strict";oceanwpWooDisplayCart()});
|
||||
@@ -0,0 +1,149 @@
|
||||
( function( $ ) {
|
||||
$( document ).scroll( function() {
|
||||
|
||||
// Vars
|
||||
var $tabs = $( '.woocommerce div.product .woocommerce-tabs' ),
|
||||
$bottom = $tabs.offset().top,
|
||||
$bar = $( '.owp-floating-bar' ),
|
||||
$offset = 0,
|
||||
$adminBar = $( '#wpadminbar' ),
|
||||
$hasStickyTopBar = $( '#top-bar-sticky-wrapper' ),
|
||||
$stickyTopBar = $( '#top-bar-wrap' ),
|
||||
$stickyHeader = $( '#site-header' );
|
||||
|
||||
// Return if no tabs and from 960px
|
||||
if ( ! $tabs.length ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Offset adminbar
|
||||
if ( $adminBar.length
|
||||
&& $( window ).width() > 600 ) {
|
||||
$offset = $offset + $adminBar.outerHeight();
|
||||
}
|
||||
|
||||
// Offset sticky topbar
|
||||
if ( $hasStickyTopBar.length ) {
|
||||
$offset = $offset + $stickyTopBar.outerHeight();
|
||||
}
|
||||
|
||||
// If header
|
||||
if ( $stickyHeader.length ) {
|
||||
|
||||
// Offset header styles
|
||||
if ( $stickyHeader.hasClass( 'top-header' ) ) {
|
||||
$offset = $offset + $stickyHeader.find( '.header-top' ).outerHeight();
|
||||
} else if ( $stickyHeader.hasClass( 'medium-header' ) ) {
|
||||
if ( $( '#site-header .bottom-header-wrap' ).hasClass( 'fixed-scroll' ) ) {
|
||||
$offset = $offset + $stickyHeader.find( '.bottom-header-wrap' ).outerHeight();
|
||||
} else {
|
||||
$offset = $offset + $( '.is-sticky #site-header-inner' ).outerHeight();
|
||||
}
|
||||
} else if ( $stickyHeader.hasClass( 'center-header' )
|
||||
|| $stickyHeader.hasClass( 'custom-header' ) ) {
|
||||
$offset = $offset + $stickyHeader.outerHeight();
|
||||
} else if ( $stickyHeader.hasClass( 'vertical-header' ) ) {
|
||||
$offset = $offset;
|
||||
} else if ( $stickyHeader.hasClass( 'fixed-scroll' ) ) {
|
||||
$offset = $offset + $stickyHeader.data( 'height' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Add offset to the $bottom variable
|
||||
$bottom = $bottom - $offset;
|
||||
|
||||
// Offset
|
||||
$bar.css( 'top', $offset );
|
||||
|
||||
// Display floating bar
|
||||
$( window ).scroll( function() {
|
||||
if ( $( this ).scrollTop() > $bottom ) {
|
||||
$bar.addClass( 'show' );
|
||||
} else {
|
||||
$bar.removeClass( 'show' );
|
||||
}
|
||||
} );
|
||||
|
||||
// If variation or grouped product
|
||||
$( '.owp-floating-bar button.button.top' ).on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
var $target = $( '.woocommerce div.product .cart' ),
|
||||
$scrollPosition;
|
||||
|
||||
if ( $target.length ) {
|
||||
$scrollPosition = $target.offset().top - $offset;
|
||||
|
||||
$( 'html, body' ).stop().animate( {
|
||||
scrollTop: Math.round( $scrollPosition )
|
||||
}, 1000 );
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
/**
|
||||
* AddToCartHandler class.
|
||||
*/
|
||||
var owpFBAddToCartHandler = function() {
|
||||
$( document.body )
|
||||
.on( 'click', '.owp-floating-bar .floating_add_to_cart_button', this.onAddToCart )
|
||||
.on( 'added_to_cart', this.updateButton );
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle the add to cart event.
|
||||
*/
|
||||
owpFBAddToCartHandler.prototype.onAddToCart = function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
var button = $( this ),
|
||||
product_id = $( this ).val(),
|
||||
quantity = $('input[name="quantity"]').val();
|
||||
|
||||
button.removeClass( 'added' );
|
||||
button.addClass( 'loading' );
|
||||
|
||||
// Ajax action.
|
||||
$.ajax ({
|
||||
url: oceanwpLocalize.ajax_url,
|
||||
type:'POST',
|
||||
data:'action=oceanwp_add_cart_floating_bar&product_id=' + product_id + '&quantity=' + quantity,
|
||||
|
||||
success:function(results) {
|
||||
$( document.body ).trigger( 'wc_fragment_refresh' );
|
||||
$( document.body ).trigger( 'added_to_cart', [ results.fragments, results.cart_hash, button ] );
|
||||
|
||||
// Redirect to cart option
|
||||
if ( oceanwpLocalize.cart_redirect_after_add === 'yes' ) {
|
||||
window.location = oceanwpLocalize.cart_url;
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Update cart page elements after add to cart events.
|
||||
*/
|
||||
owpFBAddToCartHandler.prototype.updateButton = function( e, fragments, cart_hash, $button ) {
|
||||
$button = typeof $button === 'undefined' ? false : $button;
|
||||
|
||||
if ( $button ) {
|
||||
$button.removeClass( 'loading' );
|
||||
$button.addClass( 'added' );
|
||||
|
||||
// View cart text.
|
||||
if ( ! oceanwpLocalize.is_cart && $button.parent().find( '.added_to_cart' ).length === 0 ) {
|
||||
$button.after( ' <a href="' + oceanwpLocalize.cart_url + '" class="added_to_cart wc-forward" title="' +
|
||||
oceanwpLocalize.view_cart + '">' + oceanwpLocalize.view_cart + '</a>' );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Init owpFBAddToCartHandler.
|
||||
*/
|
||||
new owpFBAddToCartHandler();
|
||||
})( jQuery );
|
||||
@@ -0,0 +1 @@
|
||||
!function(i){i(document).scroll(function(){var t=i(".woocommerce div.product .woocommerce-tabs"),a=t.offset().top,e=i(".owp-floating-bar"),o=0,r=i("#wpadminbar"),d=i("#top-bar-sticky-wrapper"),n=i("#top-bar-wrap"),c=i("#site-header");t.length&&(r.length&&600<i(window).width()&&(o+=r.outerHeight()),d.length&&(o+=n.outerHeight()),c.length&&(c.hasClass("top-header")?o+=c.find(".header-top").outerHeight():c.hasClass("medium-header")?i("#site-header .bottom-header-wrap").hasClass("fixed-scroll")?o+=c.find(".bottom-header-wrap").outerHeight():o+=i(".is-sticky #site-header-inner").outerHeight():c.hasClass("center-header")||c.hasClass("custom-header")?o+=c.outerHeight():c.hasClass("vertical-header")||c.hasClass("fixed-scroll")&&(o+=c.data("height"))),a-=o,e.css("top",o),i(window).scroll(function(){i(this).scrollTop()>a?e.addClass("show"):e.removeClass("show")}),i(".owp-floating-bar button.button.top").on("click",function(t){t.preventDefault();var a,e=i(".woocommerce div.product .cart");e.length&&(a=e.offset().top-o,i("html, body").stop().animate({scrollTop:Math.round(a)},1e3))}))});function t(){i(document.body).on("click",".owp-floating-bar .floating_add_to_cart_button",this.onAddToCart).on("added_to_cart",this.updateButton)}t.prototype.onAddToCart=function(t){t.preventDefault();var a=i(this),e=i(this).val(),o=i('input[name="quantity"]').val();a.removeClass("added"),a.addClass("loading"),i.ajax({url:oceanwpLocalize.ajax_url,type:"POST",data:"action=oceanwp_add_cart_floating_bar&product_id="+e+"&quantity="+o,success:function(t){i(document.body).trigger("wc_fragment_refresh"),i(document.body).trigger("added_to_cart",[t.fragments,t.cart_hash,a]),"yes"!==oceanwpLocalize.cart_redirect_after_add||(window.location=oceanwpLocalize.cart_url)}})},t.prototype.updateButton=function(t,a,e,o){(o=void 0!==o&&o)&&(o.removeClass("loading"),o.addClass("added"),oceanwpLocalize.is_cart||0!==o.parent().find(".added_to_cart").length||o.after(' <a href="'+oceanwpLocalize.cart_url+'" class="added_to_cart wc-forward" title="'+oceanwpLocalize.view_cart+'">'+oceanwpLocalize.view_cart+"</a>"))},new t}(jQuery);
|
||||
@@ -0,0 +1,71 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
|
||||
// Wishlist button
|
||||
if ( $j( '.woocommerce ul.products li.product .woo-entry-buttons li.woo-wishlist-btn' ).length ) {
|
||||
|
||||
$j( document ).on( 'click', '.tinvwl_add_to_wishlist_button', function() {
|
||||
var $this = $j( this );
|
||||
|
||||
$this.parent().parent().addClass( 'loading' );
|
||||
|
||||
window.setTimeout( function() {
|
||||
$this.parent().parent().removeClass( 'loading' );
|
||||
}, 1000 );
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
// Thumbnails
|
||||
$j( document ).on( 'click', '.woo-product-gallery a.woo-product-gallery-link', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
var $this = $j( this ),
|
||||
$img = $this.attr( 'href' ),
|
||||
$main_img = $this.closest( '.product-inner' ).find( '.woo-entry-image-main' );
|
||||
|
||||
if ( $main_img ) {
|
||||
$main_img.parent().addClass( 'loading' );
|
||||
$main_img.attr( 'src', $img ).attr( 'srcset', $img );
|
||||
|
||||
$main_img.css( {
|
||||
'-webkit-transform': 'scale(0.5)',
|
||||
'-moz-transform': 'scale(0.5)',
|
||||
'-ms-transform': 'scale(0.5)',
|
||||
'-o-transform': 'scale(0.5)',
|
||||
'transform': 'scale(0.5)',
|
||||
'opacity': '0',
|
||||
'-webkit-transition': 'all 0.3s ease',
|
||||
'-moz-transition': 'all 0.3s ease',
|
||||
'-ms-transition': 'all 0.3s ease',
|
||||
'-o-transition': 'all 0.3s ease',
|
||||
'transition': 'all 0.3s ease',
|
||||
} ).load( function() {
|
||||
var $image = $j( this );
|
||||
|
||||
setTimeout( function() {
|
||||
$image.css( {
|
||||
'-webkit-transform': 'scale(1)',
|
||||
'-moz-transform': 'scale(1)',
|
||||
'-ms-transform': 'scale(1)',
|
||||
'-o-transform': 'scale(1)',
|
||||
'transform': 'scale(1)',
|
||||
'opacity': '1',
|
||||
'-webkit-transition': 'all 0.3s ease',
|
||||
'-moz-transition': 'all 0.3s ease',
|
||||
'-ms-transition': 'all 0.3s ease',
|
||||
'-o-transition': 'all 0.3s ease',
|
||||
'transition': 'all 0.3s ease',
|
||||
} );
|
||||
|
||||
$image.parent().removeClass( 'loading' );
|
||||
|
||||
}, 300 );
|
||||
} );
|
||||
|
||||
$j( this ).parent().addClass( 'active' ).siblings().removeClass( 'active' );
|
||||
}
|
||||
} );
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
var $j=jQuery.noConflict();$j(document).ready(function(){$j(".woocommerce ul.products li.product .woo-entry-buttons li.woo-wishlist-btn").length&&$j(document).on("click",".tinvwl_add_to_wishlist_button",function(){var a=$j(this);a.parent().parent().addClass("loading"),window.setTimeout(function(){a.parent().parent().removeClass("loading")},1e3)}),$j(document).on("click",".woo-product-gallery a.woo-product-gallery-link",function(a){a.preventDefault();var t=$j(this),s=t.attr("href"),o=t.closest(".product-inner").find(".woo-entry-image-main");o&&(o.parent().addClass("loading"),o.attr("src",s).attr("srcset",s),o.css({"-webkit-transform":"scale(0.5)","-moz-transform":"scale(0.5)","-ms-transform":"scale(0.5)","-o-transform":"scale(0.5)",transform:"scale(0.5)",opacity:"0","-webkit-transition":"all 0.3s ease","-moz-transition":"all 0.3s ease","-ms-transition":"all 0.3s ease","-o-transition":"all 0.3s ease",transition:"all 0.3s ease"}).load(function(){var a=$j(this);setTimeout(function(){a.css({"-webkit-transform":"scale(1)","-moz-transform":"scale(1)","-ms-transform":"scale(1)","-o-transform":"scale(1)",transform:"scale(1)",opacity:"1","-webkit-transition":"all 0.3s ease","-moz-transition":"all 0.3s ease","-ms-transition":"all 0.3s ease","-o-transition":"all 0.3s ease",transition:"all 0.3s ease"}),a.parent().removeClass("loading")},300)}),$j(this).parent().addClass("active").siblings().removeClass("active"))})});
|
||||
@@ -0,0 +1,54 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Woo mobile cart sidebar
|
||||
oceanwpWooMobileCart();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
WOOCOMMERCE MOBILE CART SIDEBAR
|
||||
============================================== */
|
||||
function oceanwpWooMobileCart() {
|
||||
"use strict"
|
||||
|
||||
if ( $j( 'body' ).hasClass( 'woocommerce-cart' )
|
||||
|| $j( 'body' ).hasClass( 'woocommerce-checkout' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var oceanwp_cart_filter_close = function() {
|
||||
$j( 'html' ).css( {
|
||||
'overflow': '',
|
||||
'margin-right': ''
|
||||
} );
|
||||
|
||||
$j( 'body' ).removeClass( 'show-cart-sidebar' );
|
||||
};
|
||||
|
||||
$j( document ).on( 'click', '.oceanwp-mobile-menu-icon a.wcmenucart', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
var innerWidth = $j( 'html' ).innerWidth();
|
||||
$j( 'html' ).css( 'overflow', 'hidden' );
|
||||
var hiddenInnerWidth = $j( 'html' ).innerWidth();
|
||||
$j( 'html' ).css( 'margin-right', hiddenInnerWidth - innerWidth );
|
||||
|
||||
$j( 'body' ).addClass( 'show-cart-sidebar' );
|
||||
} );
|
||||
|
||||
$j( '.oceanwp-cart-sidebar-overlay, .oceanwp-cart-close').on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
oceanwp_cart_filter_close();
|
||||
|
||||
// Remove show-cart here to let the header mini cart working
|
||||
$j( 'body' ).removeClass( 'show-cart' );
|
||||
} );
|
||||
|
||||
// Close on resize to avoid conflict
|
||||
$j( window ).resize( function() {
|
||||
oceanwp_cart_filter_close();
|
||||
} );
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
var $j=jQuery.noConflict();function oceanwpWooMobileCart(){"use strict";var e;$j("body").hasClass("woocommerce-cart")||$j("body").hasClass("woocommerce-checkout")||(e=function(){$j("html").css({overflow:"","margin-right":""}),$j("body").removeClass("show-cart-sidebar")},$j(document).on("click",".oceanwp-mobile-menu-icon a.wcmenucart",function(o){o.preventDefault();var e=$j("html").innerWidth();$j("html").css("overflow","hidden");var c=$j("html").innerWidth();$j("html").css("margin-right",c-e),$j("body").addClass("show-cart-sidebar")}),$j(".oceanwp-cart-sidebar-overlay, .oceanwp-cart-close").on("click",function(o){o.preventDefault(),e(),$j("body").removeClass("show-cart")}),$j(window).resize(function(){e()}))}$j(document).ready(function(){"use strict";oceanwpWooMobileCart()});
|
||||
@@ -0,0 +1,223 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Woo multi-step checkout
|
||||
oceanwpWooMultiStepCheckout();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
WOOCOMMERCE MULTI-STEP CHECKOUT
|
||||
============================================== */
|
||||
function oceanwpWooMultiStepCheckout() {
|
||||
"use strict"
|
||||
|
||||
var body = $j( 'body' ),
|
||||
login = $j( '#checkout_login' ),
|
||||
billing = $j( '#customer_billing_details' ),
|
||||
shipping = $j( '#customer_shipping_details' ),
|
||||
order = $j( '#order_review' ),
|
||||
payment = $j( '#order_checkout_payment' ),
|
||||
form_actions = $j( '#form_actions' ),
|
||||
coupon = $j( '#checkout_coupon' ),
|
||||
steps = new Array( login, billing, shipping, order, payment ),
|
||||
payment_method = function () {
|
||||
|
||||
$j( '#place_order' ).on( 'click', function () {
|
||||
var $this = $j( '#order_checkout_payment' ).find( 'input[name=payment_method]:checked' ),
|
||||
current_gateway = $this.val(),
|
||||
order_button_text = $this.data( 'order_button_text' );
|
||||
|
||||
order.find( 'input[name="payment_method"]' ).val( current_gateway ).data( 'order_button_text', order_button_text ).attr( 'checked', 'checked' );
|
||||
} );
|
||||
|
||||
};
|
||||
|
||||
body.on( 'updated_checkout', function( e ) {
|
||||
|
||||
steps[4] = $j( '#order_checkout_payment' );
|
||||
if ( e.type == 'updated_checkout' ) {
|
||||
steps[4] = $j( '#order_checkout_payment' );
|
||||
}
|
||||
|
||||
$j( '#order_checkout_payment' ).find( 'input[name=payment_method]' ).on( 'click', function() {
|
||||
|
||||
if ( $j( '.payment_methods input.input-radio' ).length > 1 ) {
|
||||
var target_payment_box = $j( 'div.payment_box.' + $j( this ).attr( 'ID' ) );
|
||||
|
||||
if ( $j( this ).is( ':checked' ) && ! target_payment_box.is( ':visible' ) ) {
|
||||
$j( 'div.payment_box' ).filter( ':visible' ).slideUp( 250 );
|
||||
|
||||
if ( $j( this ).is( ':checked' ) ) {
|
||||
$j( 'div.payment_box.' + $j( this ).attr( 'ID' )).slideDown( 250 );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$j( 'div.payment_box' ).show();
|
||||
}
|
||||
|
||||
if ( $j( this ).data( 'order_button_text' )) {
|
||||
$j( '#place_order' ).val( $j( this ).data( 'order_button_text' ) );
|
||||
} else {
|
||||
$j( '#place_order' ).val( $j( '#place_order' ).data( 'value' ) );
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
form_actions.find( '.button.prev' ).add( '.button.next' ).on( 'click', function( e ) {
|
||||
var $this = $j( this ),
|
||||
timeline = $j( '#owp-checkout-timeline' ),
|
||||
action = $this.data( 'action' ),
|
||||
current_step = form_actions.data( 'step' ),
|
||||
next_step = current_step + 1,
|
||||
prev_step = current_step - 1,
|
||||
prev = form_actions.find( '.button.prev' ),
|
||||
next = form_actions.find( '.button.next' ),
|
||||
checkout_form = $j( 'form.woocommerce-checkout' ),
|
||||
is_logged_in = oceanwpLocalize.is_logged_in,
|
||||
button_title,
|
||||
valid = false,
|
||||
current_step_item = steps[current_step],
|
||||
selector = current_step_item.selector,
|
||||
posted_data = {},
|
||||
type = '',
|
||||
$offset = 30,
|
||||
$adminBar = $j( '#wpadminbar' ),
|
||||
$stickyTopBar = $j( '#top-bar-wrap' ),
|
||||
$stickyHeader = $j( '#site-header' );
|
||||
|
||||
// Offset adminbar
|
||||
if ( $adminBar.length
|
||||
&& $j( window ).width() > 600 ) {
|
||||
$offset = $offset + $adminBar.outerHeight();
|
||||
}
|
||||
|
||||
// Offset sticky topbar
|
||||
if ( true == oceanwpLocalize.hasStickyTopBar ) {
|
||||
$offset = $offset + $stickyTopBar.outerHeight();
|
||||
}
|
||||
|
||||
// Offset sticky header
|
||||
if ( $j( '#site-header' ).hasClass( 'fixed-scroll' )
|
||||
&& ! $j( '#site-header' ).hasClass( 'vertical-header' ) ) {
|
||||
$offset = $offset + $stickyHeader.outerHeight();
|
||||
}
|
||||
|
||||
$j( 'form.woocommerce-checkout .woocommerce-NoticeGroup.woocommerce-NoticeGroup-checkout' ).remove();
|
||||
|
||||
type = (selector.indexOf( 'billing' ) >= 0) ? 'billing' : type;
|
||||
type = (selector.indexOf( 'shipping' ) >= 0) ? 'shipping' : type;
|
||||
|
||||
if ( type == 'billing' || type == 'shipping' ) {
|
||||
|
||||
$j( selector ).find( '.validate-required input' ).each( function() {
|
||||
posted_data[ $j( this ).attr( 'name' ) ] = $j( this ).val();
|
||||
} );
|
||||
|
||||
$j( selector ).find( '.validate-required select' ).each( function() {
|
||||
posted_data[ $j( this ).attr( 'name' ) ] = $j( this ).val();
|
||||
} );
|
||||
|
||||
$j( selector ).find( '.input-checkbox' ).each( function() {
|
||||
if ( $j( this ).is( ':checked' ) ) {
|
||||
posted_data[ $j( this ).attr( 'name' ) ] = $j( this ).val();
|
||||
}
|
||||
} );
|
||||
|
||||
var data = {
|
||||
action: 'oceanwp_validate_checkout',
|
||||
type: type,
|
||||
posted_data: posted_data
|
||||
};
|
||||
|
||||
$j.ajax( {
|
||||
type: 'POST',
|
||||
url: oceanwpLocalize.ajax_url,
|
||||
data: data,
|
||||
success: function( response ) {
|
||||
valid = response.valid;
|
||||
|
||||
if ( ! response.valid ) {
|
||||
$j( 'form.woocommerce-checkout' ).prepend( response.html );
|
||||
$j( 'html, body' ).animate( {
|
||||
scrollTop: $j( 'form.woocommerce-checkout' ).offset().top - $offset },
|
||||
'slow' );
|
||||
}
|
||||
else{
|
||||
after_validation(timeline,form_actions,checkout_form,checkout_form,steps,action,next_step,current_step,prev_step,prev,next,$offset,is_logged_in,coupon); }
|
||||
},
|
||||
complete: function() {}
|
||||
} );
|
||||
|
||||
} else {
|
||||
valid = true;
|
||||
after_validation(timeline,form_actions,checkout_form,checkout_form,steps,action,next_step,current_step,prev_step,prev,next,$offset,is_logged_in,coupon); }
|
||||
|
||||
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
function after_validation(timeline,form_actions,checkout_form,checkout_form,steps,action,next_step,current_step,prev_step,prev,next,$offset,is_logged_in,coupon)
|
||||
{
|
||||
timeline.find( '.active' ).removeClass( 'active' );
|
||||
|
||||
if ( action == 'next' ) {
|
||||
form_actions.data( 'step', next_step );
|
||||
steps[current_step].fadeOut( 120, function() {
|
||||
steps[next_step].fadeIn( 120 );
|
||||
} );
|
||||
|
||||
$j( '#timeline-' + next_step ).toggleClass( 'active' );
|
||||
$j( 'html, body' ).animate( {
|
||||
scrollTop: $j( '#owp-checkout-timeline' ).offset().top - $offset },
|
||||
'slow' );
|
||||
} else if ( action == 'prev' ) {
|
||||
form_actions.data( 'step', prev_step );
|
||||
steps[current_step].fadeOut( 120, function() {
|
||||
steps[prev_step].fadeIn( 120 );
|
||||
} );
|
||||
|
||||
$j( '#timeline-' + prev_step ).toggleClass( 'active' );
|
||||
$j( 'html, body' ).animate( {
|
||||
scrollTop: $j( '#owp-checkout-timeline' ).offset().top - $offset },
|
||||
'slow' );
|
||||
}
|
||||
|
||||
current_step = form_actions.data( 'step' );
|
||||
|
||||
if ( ( current_step == 1
|
||||
&& is_logged_in == true ) ||
|
||||
( is_logged_in == false
|
||||
&& ( ( current_step == 0
|
||||
&& oceanwpLocalize.login_reminder_enabled == 1 )
|
||||
|| ( current_step == 1
|
||||
&& oceanwpLocalize.login_reminder_enabled == 0 ) ) ) ) {
|
||||
prev.fadeOut( 120 );
|
||||
} else {
|
||||
prev.fadeIn( 120 );
|
||||
}
|
||||
|
||||
// Next title
|
||||
if ( is_logged_in == false
|
||||
&& ( ( current_step == 0
|
||||
&& oceanwpLocalize.login_reminder_enabled == 1 )
|
||||
|| ( current_step == 1
|
||||
&& oceanwpLocalize.login_reminder_enabled == 0 ) ) ) {
|
||||
next.val( oceanwpLocalize.no_account_btn );
|
||||
} else {
|
||||
next.val( oceanwpLocalize.next );
|
||||
}
|
||||
|
||||
// Last step
|
||||
if ( current_step == 3 ) {
|
||||
checkout_form.removeClass( 'processing' );
|
||||
coupon.fadeIn( 80 );
|
||||
next.fadeOut( 120 );
|
||||
} else {
|
||||
checkout_form.addClass( 'processing' );
|
||||
coupon.fadeOut( 80 );
|
||||
next.fadeIn( 120 );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
var $j=jQuery.noConflict();function oceanwpWooMultiStepCheckout(){"use strict";var e=$j("body"),t=$j("#checkout_login"),o=$j("#customer_billing_details"),a=$j("#customer_shipping_details"),i=$j("#order_review"),n=$j("#order_checkout_payment"),v=$j("#form_actions"),w=$j("#checkout_coupon"),b=new Array(t,o,a,i,n);e.on("updated_checkout",function(e){b[4]=$j("#order_checkout_payment"),"updated_checkout"==e.type&&(b[4]=$j("#order_checkout_payment")),$j("#order_checkout_payment").find("input[name=payment_method]").on("click",function(){var e;1<$j(".payment_methods input.input-radio").length?(e=$j("div.payment_box."+$j(this).attr("ID")),$j(this).is(":checked")&&!e.is(":visible")&&($j("div.payment_box").filter(":visible").slideUp(250),$j(this).is(":checked")&&$j("div.payment_box."+$j(this).attr("ID")).slideDown(250))):$j("div.payment_box").show(),$j(this).data("order_button_text")?$j("#place_order").val($j(this).data("order_button_text")):$j("#place_order").val($j("#place_order").data("value"))})}),v.find(".button.prev").add(".button.next").on("click",function(e){var t,o=$j(this),a=$j("#owp-checkout-timeline"),i=o.data("action"),n=v.data("step"),c=n+1,d=n-1,r=v.find(".button.prev"),l=v.find(".button.next"),s=$j("form.woocommerce-checkout"),p=oceanwpLocalize.is_logged_in,u=b[n].selector,h={},j="",m=30,$=$j("#wpadminbar"),f=$j("#top-bar-wrap"),_=$j("#site-header");$.length&&600<$j(window).width()&&(m+=$.outerHeight()),1==oceanwpLocalize.hasStickyTopBar&&(m+=f.outerHeight()),$j("#site-header").hasClass("fixed-scroll")&&!$j("#site-header").hasClass("vertical-header")&&(m+=_.outerHeight()),$j("form.woocommerce-checkout .woocommerce-NoticeGroup.woocommerce-NoticeGroup-checkout").remove(),j=0<=u.indexOf("billing")?"billing":j,"billing"==(j=0<=u.indexOf("shipping")?"shipping":j)||"shipping"==j?($j(u).find(".validate-required input").each(function(){h[$j(this).attr("name")]=$j(this).val()}),$j(u).find(".validate-required select").each(function(){h[$j(this).attr("name")]=$j(this).val()}),$j(u).find(".input-checkbox").each(function(){$j(this).is(":checked")&&(h[$j(this).attr("name")]=$j(this).val())}),t={action:"oceanwp_validate_checkout",type:j,posted_data:h},$j.ajax({type:"POST",url:oceanwpLocalize.ajax_url,data:t,success:function(e){e.valid,e.valid?after_validation(a,v,s,s,b,i,c,n,d,r,l,m,p,w):($j("form.woocommerce-checkout").prepend(e.html),$j("html, body").animate({scrollTop:$j("form.woocommerce-checkout").offset().top-m},"slow"))},complete:function(){}})):after_validation(a,v,s,s,b,i,c,n,d,r,l,m,p,w)})}function after_validation(e,t,o,o,a,i,n,c,d,r,l,s,p,u){e.find(".active").removeClass("active"),"next"==i?(t.data("step",n),a[c].fadeOut(120,function(){a[n].fadeIn(120)}),$j("#timeline-"+n).toggleClass("active"),$j("html, body").animate({scrollTop:$j("#owp-checkout-timeline").offset().top-s},"slow")):"prev"==i&&(t.data("step",d),a[c].fadeOut(120,function(){a[d].fadeIn(120)}),$j("#timeline-"+d).toggleClass("active"),$j("html, body").animate({scrollTop:$j("#owp-checkout-timeline").offset().top-s},"slow")),1==(c=t.data("step"))&&1==p||0==p&&(0==c&&1==oceanwpLocalize.login_reminder_enabled||1==c&&0==oceanwpLocalize.login_reminder_enabled)?r.fadeOut(120):r.fadeIn(120),0==p&&(0==c&&1==oceanwpLocalize.login_reminder_enabled||1==c&&0==oceanwpLocalize.login_reminder_enabled)?l.val(oceanwpLocalize.no_account_btn):l.val(oceanwpLocalize.next),3==c?(o.removeClass("processing"),u.fadeIn(80),l.fadeOut(120)):(o.addClass("processing"),u.fadeOut(80),l.fadeIn(120))}$j(document).ready(function(){"use strict";oceanwpWooMultiStepCheckout()});
|
||||
@@ -0,0 +1,35 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Woo off canvas
|
||||
oceanwpWooOffCanvas();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
WOOCOMMERCE OFF CANVAS
|
||||
============================================== */
|
||||
function oceanwpWooOffCanvas() {
|
||||
"use strict"
|
||||
|
||||
$j( document ).on( 'click', '.oceanwp-off-canvas-filter', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
var innerWidth = $j( 'html' ).innerWidth();
|
||||
$j( 'html' ).css( 'overflow', 'hidden' );
|
||||
var hiddenInnerWidth = $j( 'html' ).innerWidth();
|
||||
$j( 'html' ).css( 'margin-right', hiddenInnerWidth - innerWidth );
|
||||
|
||||
$j( 'body' ).addClass( 'off-canvas-enabled' );
|
||||
} );
|
||||
|
||||
$j( '.oceanwp-off-canvas-overlay, .oceanwp-off-canvas-close' ).on( 'click', function() {
|
||||
$j( 'html' ).css( {
|
||||
'overflow': '',
|
||||
'margin-right': ''
|
||||
} );
|
||||
|
||||
$j( 'body' ).removeClass( 'off-canvas-enabled' );
|
||||
} );
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
var $j=jQuery.noConflict();function oceanwpWooOffCanvas(){"use strict";$j(document).on("click",".oceanwp-off-canvas-filter",function(n){n.preventDefault();var o=$j("html").innerWidth();$j("html").css("overflow","hidden");var a=$j("html").innerWidth();$j("html").css("margin-right",a-o),$j("body").addClass("off-canvas-enabled")}),$j(".oceanwp-off-canvas-overlay, .oceanwp-off-canvas-close").on("click",function(){$j("html").css({overflow:"","margin-right":""}),$j("body").removeClass("off-canvas-enabled")})}$j(document).ready(function(){"use strict";oceanwpWooOffCanvas()});
|
||||
@@ -0,0 +1,224 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
|
||||
if ( typeof oceanwpLocalize === 'undefined' ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Vars
|
||||
var qv_modal = $j( '#owp-qv-wrap' ),
|
||||
qv_content = $j( '#owp-qv-content' );
|
||||
|
||||
/**
|
||||
* Open quick view.
|
||||
*/
|
||||
$j( document ).on( 'click', '.owp-quick-view', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
var $this = $j( this ),
|
||||
product_id = $j( this ).data( 'product_id' );
|
||||
|
||||
$this.parent().addClass( 'loading' );
|
||||
|
||||
$j.ajax( {
|
||||
url: oceanwpLocalize.ajax_url,
|
||||
data: {
|
||||
action : 'oceanwp_product_quick_view',
|
||||
product_id : product_id
|
||||
},
|
||||
success: function( results ) {
|
||||
|
||||
var innerWidth = $j( 'html' ).innerWidth();
|
||||
$j( 'html' ).css( 'overflow', 'hidden' );
|
||||
var hiddenInnerWidth = $j( 'html' ).innerWidth();
|
||||
$j( 'html' ).css( 'margin-right', hiddenInnerWidth - innerWidth );
|
||||
$j( 'html' ).addClass( 'owp-qv-open' );
|
||||
|
||||
qv_content.html( results );
|
||||
|
||||
// Display modal
|
||||
qv_modal.fadeIn();
|
||||
qv_modal.addClass( 'is-visible' );
|
||||
|
||||
// Variation Form
|
||||
var form_variation = qv_content.find( '.variations_form' );
|
||||
|
||||
form_variation.trigger( 'check_variations' );
|
||||
form_variation.trigger( 'reset_image' );
|
||||
|
||||
var var_form = qv_content.find( '.variations_form' );
|
||||
|
||||
if ( var_form.length > 0 ) {
|
||||
var_form.wc_variation_form();
|
||||
var_form.find( 'select' ).change();
|
||||
}
|
||||
|
||||
var image_slider_wrap = qv_content.find( '.owp-qv-image' );
|
||||
|
||||
if ( image_slider_wrap.find( 'li' ).length > 1 ) {
|
||||
image_slider_wrap.flexslider();
|
||||
}
|
||||
|
||||
// If grouped product
|
||||
var grouped = qv_content.find( 'form.grouped_form' );
|
||||
if ( grouped ) {
|
||||
var grouped_product_url = qv_content.find( 'form.grouped_form' ).attr( 'action' );
|
||||
grouped.find( '.group_table, button.single_add_to_cart_button' ).hide();
|
||||
grouped.append( ' <a href="' + grouped_product_url + '" class="button">' + oceanwpLocalize.grouped_text + '</a>' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} ).done( function() {
|
||||
$this.parent().removeClass( 'loading' );
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
/**
|
||||
* Close quick view function.
|
||||
*/
|
||||
var owpCloseQuickView = function() {
|
||||
$j( 'html' ).css( {
|
||||
'overflow': '',
|
||||
'margin-right': ''
|
||||
} );
|
||||
$j( 'html' ).removeClass( 'owp-qv-open' );
|
||||
|
||||
qv_modal.fadeOut();
|
||||
qv_modal.removeClass( 'is-visible' );
|
||||
|
||||
setTimeout( function() {
|
||||
qv_content.html( '' );
|
||||
}, 600);
|
||||
};
|
||||
|
||||
/**
|
||||
* Close quick view.
|
||||
*/
|
||||
$j( '.owp-qv-overlay, .owp-qv-close' ).on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
owpCloseQuickView();
|
||||
} );
|
||||
|
||||
/**
|
||||
* Check if user has pressed 'Esc'.
|
||||
*/
|
||||
$j( document ).keyup( function( e ) {
|
||||
if ( e.keyCode == 27 ) {
|
||||
owpCloseQuickView();
|
||||
}
|
||||
} );
|
||||
|
||||
$j.fn.serializeArrayAll = function () {
|
||||
|
||||
var rCRLF = /\r?\n/g;
|
||||
return this.map(function () {
|
||||
return this.elements ? jQuery.makeArray(this.elements) : this;
|
||||
}).map(function (i, elem) {
|
||||
var val = jQuery(this).val();
|
||||
|
||||
if (val == null) {
|
||||
return val == null
|
||||
|
||||
//If checkbox is unchecked
|
||||
} else if (this.type == "checkbox" && this.checked == false) {
|
||||
return {name: this.name, value: this.checked ? this.value : ''}
|
||||
|
||||
} else if (this.type == "radio" && this.checked == false) {
|
||||
return {name: this.name, value: this.checked ? this.value : ''}
|
||||
|
||||
//default: all checkboxes = on
|
||||
} else {
|
||||
return jQuery.isArray(val) ?
|
||||
jQuery.map(val, function (val, i) {
|
||||
return {name: elem.name, value: val.replace(rCRLF, "\r\n")};
|
||||
}) :
|
||||
{name: elem.name, value: val.replace(rCRLF, "\r\n")};
|
||||
}
|
||||
}).get();
|
||||
};
|
||||
|
||||
/**
|
||||
* AddToCartHandler class.
|
||||
*/
|
||||
var owpQVAddToCartHandler = function() {
|
||||
$j( document.body )
|
||||
.on( 'click', '#owp-qv-content .product:not(.product-type-external) .single_add_to_cart_button', this.onAddToCart )
|
||||
.on( 'added_to_cart', this.updateButton );
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle the add to cart event.
|
||||
*/
|
||||
owpQVAddToCartHandler.prototype.onAddToCart = function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
var button = $j( this ),
|
||||
$form = $j( this ).closest('form.cart'),
|
||||
data = $form.serializeArrayAll();
|
||||
|
||||
var is_valid = false;
|
||||
|
||||
$j.each(data, function (i, item) {
|
||||
if (item.name === 'add-to-cart') {
|
||||
is_valid = true;
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
||||
if( is_valid ){
|
||||
e.preventDefault();
|
||||
}
|
||||
else{
|
||||
return;
|
||||
}
|
||||
|
||||
$j(document.body).trigger('adding_to_cart', [button, data]);
|
||||
|
||||
button.removeClass( 'added' );
|
||||
button.addClass( 'loading' );
|
||||
|
||||
// Ajax action.
|
||||
$j.ajax ({
|
||||
url: oceanwpLocalize.wc_ajax_url,
|
||||
type: 'POST',
|
||||
data : data,
|
||||
|
||||
success:function(results) {
|
||||
$j( document.body ).trigger( 'wc_fragment_refresh' );
|
||||
$j( document.body ).trigger( 'added_to_cart', [ results.fragments, results.cart_hash, button ] );
|
||||
|
||||
// Redirect to cart option
|
||||
if ( oceanwpLocalize.cart_redirect_after_add === 'yes' ) {
|
||||
window.location = oceanwpLocalize.cart_url;
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Update cart page elements after add to cart events.
|
||||
*/
|
||||
owpQVAddToCartHandler.prototype.updateButton = function( e, fragments, cart_hash, $button ) {
|
||||
$button = typeof $button === 'undefined' ? false : $button;
|
||||
|
||||
if ( $button ) {
|
||||
$button.removeClass( 'loading' );
|
||||
$button.addClass( 'added' );
|
||||
|
||||
// View cart text.
|
||||
if ( ! oceanwpLocalize.is_cart && $button.parent().find( '.added_to_cart' ).length === 0 ) {
|
||||
$button.after( ' <a href="' + oceanwpLocalize.cart_url + '" class="added_to_cart wc-forward" title="' +
|
||||
oceanwpLocalize.view_cart + '">' + oceanwpLocalize.view_cart + '</a>' );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Init owpAddToCartHandler.
|
||||
*/
|
||||
new owpQVAddToCartHandler();
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
var $j=jQuery.noConflict();$j(document).ready(function(){if("undefined"==typeof oceanwpLocalize)return!1;var d=$j("#owp-qv-wrap"),l=$j("#owp-qv-content");$j(document).on("click",".owp-quick-view",function(e){e.preventDefault();var t=$j(this),a=$j(this).data("product_id");t.parent().addClass("loading"),$j.ajax({url:oceanwpLocalize.ajax_url,data:{action:"oceanwp_product_quick_view",product_id:a},success:function(e){var t=$j("html").innerWidth();$j("html").css("overflow","hidden");var a=$j("html").innerWidth();$j("html").css("margin-right",a-t),$j("html").addClass("owp-qv-open"),l.html(e),d.fadeIn(),d.addClass("is-visible");var n=l.find(".variations_form");n.trigger("check_variations"),n.trigger("reset_image");var o=l.find(".variations_form");0<o.length&&(o.wc_variation_form(),o.find("select").change());var r=l.find(".owp-qv-image");1<r.find("li").length&&r.flexslider();var i,c=l.find("form.grouped_form");c&&(i=l.find("form.grouped_form").attr("action"),c.find(".group_table, button.single_add_to_cart_button").hide(),c.append(' <a href="'+i+'" class="button">'+oceanwpLocalize.grouped_text+"</a>"))}}).done(function(){t.parent().removeClass("loading")})});function t(){$j("html").css({overflow:"","margin-right":""}),$j("html").removeClass("owp-qv-open"),d.fadeOut(),d.removeClass("is-visible"),setTimeout(function(){l.html("")},600)}$j(".owp-qv-overlay, .owp-qv-close").on("click",function(e){e.preventDefault(),t()}),$j(document).keyup(function(e){27==e.keyCode&&t()}),$j.fn.serializeArrayAll=function(){var n=/\r?\n/g;return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this}).map(function(e,a){var t=jQuery(this).val();return null==t?null==t:"checkbox"==this.type&&0==this.checked||"radio"==this.type&&0==this.checked?{name:this.name,value:this.checked?this.value:""}:jQuery.isArray(t)?jQuery.map(t,function(e,t){return{name:a.name,value:e.replace(n,"\r\n")}}):{name:a.name,value:t.replace(n,"\r\n")}}).get()};function e(){$j(document.body).on("click","#owp-qv-content .product:not(.product-type-external) .single_add_to_cart_button",this.onAddToCart).on("added_to_cart",this.updateButton)}e.prototype.onAddToCart=function(e){e.preventDefault();var t=$j(this),a=$j(this).closest("form.cart").serializeArrayAll(),n=!1;$j.each(a,function(e,t){if("add-to-cart"===t.name)return!(n=!0)}),n&&(e.preventDefault(),$j(document.body).trigger("adding_to_cart",[t,a]),t.removeClass("added"),t.addClass("loading"),$j.ajax({url:oceanwpLocalize.wc_ajax_url,type:"POST",data:a,success:function(e){$j(document.body).trigger("wc_fragment_refresh"),$j(document.body).trigger("added_to_cart",[e.fragments,e.cart_hash,t]),"yes"!==oceanwpLocalize.cart_redirect_after_add||(window.location=oceanwpLocalize.cart_url)}}))},e.prototype.updateButton=function(e,t,a,n){(n=void 0!==n&&n)&&(n.removeClass("loading"),n.addClass("added"),oceanwpLocalize.is_cart||0!==n.parent().find(".added_to_cart").length||n.after(' <a href="'+oceanwpLocalize.cart_url+'" class="added_to_cart wc-forward" title="'+oceanwpLocalize.view_cart+'">'+oceanwpLocalize.view_cart+"</a>"))},new e});
|
||||
@@ -0,0 +1 @@
|
||||
var $j=jQuery.noConflict();function oceanwpWooAccountLinks(){"use strict";var o,t,e,a;$j(".owp-account-links").hasClass("registration-disabled")||(o=$j(".owp-account-links .login a"),t=$j(".owp-account-links .register a"),e=$j("#customer_login .col-1"),a=$j("#customer_login .col-2"),o.on("click",function(){return $j(this).addClass("current"),t.removeClass("current"),e.siblings().stop().fadeOut(function(){e.fadeIn()}),!1}),t.on("click",function(){return $j(this).addClass("current"),o.removeClass("current"),a.siblings().stop().fadeOut(function(){a.fadeIn()}),!1}))}function oceanwpWooGridList(){"use strict";var o;$j("body").hasClass("has-grid-list")?(o=function(){!$j("body").hasClass("no-carousel")&&$j(".woo-entry-image.product-entry-slider").length&&setTimeout(function(){$j(".woo-entry-image.product-entry-slider").slick("unslick"),oceanwpInitCarousel()},350)},$j("#oceanwp-grid").on("click",function(){return o(),$j(this).addClass("active"),$j("#oceanwp-list").removeClass("active"),Cookies.set("gridcookie","grid",{path:""}),$j(".woocommerce ul.products").fadeOut(300,function(){$j(this).addClass("grid").removeClass("list").fadeIn(300)}),!1}),$j("#oceanwp-list").on("click",function(){return o(),$j(this).addClass("active"),$j("#oceanwp-grid").removeClass("active"),Cookies.set("gridcookie","list",{path:""}),$j(".woocommerce ul.products").fadeOut(300,function(){$j(this).addClass("list").removeClass("grid").fadeIn(300)}),!1}),"grid"==Cookies.get("gridcookie")&&($j(".oceanwp-grid-list #oceanwp-grid").addClass("active"),$j(".oceanwp-grid-list #oceanwp-list").removeClass("active"),$j(".woocommerce ul.products").addClass("grid").removeClass("list")),"list"==Cookies.get("gridcookie")&&($j(".oceanwp-grid-list #oceanwp-list").addClass("active"),$j(".oceanwp-grid-list #oceanwp-grid").removeClass("active"),$j(".woocommerce ul.products").addClass("list").removeClass("grid"))):Cookies.remove("gridcookie",{path:""})}function oceanwpWooQuantityButtons(i){var o,t;$cart=$j(".woocommerce div.product form.cart"),i=i||".qty",(o=$j("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").find(i))&&"date"!==o.prop("type")&&"hidden"!==o.prop("type")&&(o.parent().addClass("buttons_added").prepend('<a href="javascript:void(0)" class="minus">-</a>'),o.after('<a href="javascript:void(0)" class="plus">+</a>'),$j("input"+i+":not(.product-quantity input"+i+")").each(function(){var o=parseFloat($j(this).attr("min"));o&&0<o&&parseFloat($j(this).val())<o&&$j(this).val(o)}),!$j("body").hasClass("single-product")||"on"!=oceanwpLocalize.floating_bar||$cart.hasClass("grouped_form")||$cart.hasClass("cart_group")||(t=$j(".woocommerce form input[type=number].qty")).on("keyup",function(){var o=$j(this).val();t.val(o)}),$j(".plus, .minus").unbind("click"),$j(".plus, .minus").on("click",function(){var o=!$j("body").hasClass("single-product")||"on"!=oceanwpLocalize.floating_bar||$cart.hasClass("grouped_form")||$cart.hasClass("cart_group")?$j(this).closest(".quantity").find(i):$j(".plus, .minus").closest(".quantity").find(i),t=parseFloat(o.val()),e=parseFloat(o.attr("max")),a=parseFloat(o.attr("min")),s=o.attr("step");t&&""!==t&&"NaN"!==t||(t=0),""!==e&&"NaN"!==e||(e=""),""!==a&&"NaN"!==a||(a=0),"any"!==s&&""!==s&&void 0!==s&&"NaN"!==parseFloat(s)||(s=1),$j(this).is(".plus")?e&&(e==t||e<t)?o.val(e):o.val(t+parseFloat(s)):a&&(a==t||t<a)?o.val(a):0<t&&o.val(t-parseFloat(s)),o.trigger("change")}))}function oceanwpWooReviewsScroll(){"use strict";$j(".woocommerce div.product .woocommerce-review-link").click(function(o){return $j(".woocommerce-tabs .description_tab").removeClass("active"),$j(".woocommerce-tabs .reviews_tab").addClass("active"),$j(".woocommerce-tabs #tab-description").css("display","none"),$j(".woocommerce-tabs #tab-reviews").css("display","block"),$j("html, body").stop(!0,!0).animate({scrollTop:$j(this.hash).offset().top-120},"normal"),!1})}function oceanwpWooRemoveBrackets(){"use strict";$j(".widget_layered_nav span.count, .widget_product_categories span.count").each(function(){var o=(o=$j(this).html()).substring(1,o.length-1);$j(this).html(o)})}$j(document).ready(function(){"use strict";oceanwpWooAccountLinks()}),($j=jQuery.noConflict())(document).ready(function(){"use strict";oceanwpWooGridList()}),($j=jQuery.noConflict())(window).ready(function(){"use strict";oceanwpWooQuantityButtons()}),$j(document).ajaxComplete(function(){"use strict";oceanwpWooQuantityButtons()}),($j=jQuery.noConflict())(document).ready(function(){"use strict";oceanwpWooReviewsScroll()}),($j=jQuery.noConflict())(document).ready(function(){"use strict";oceanwpWooRemoveBrackets()});
|
||||
@@ -0,0 +1,53 @@
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j( document ).ready( function() {
|
||||
"use strict";
|
||||
// Woo vertical thumbnails
|
||||
oceanwpWooThumbnails();
|
||||
} );
|
||||
|
||||
// On load
|
||||
$j( window ).on( 'load', function() {
|
||||
"use strict";
|
||||
// Woo vertical thumbnails
|
||||
oceanwpWooThumbnails();
|
||||
} );
|
||||
|
||||
// On resize
|
||||
$j( window ).on( 'resize', function() {
|
||||
"use strict";
|
||||
// Woo vertical thumbnails
|
||||
oceanwpWooThumbnails();
|
||||
} );
|
||||
|
||||
/* ==============================================
|
||||
WOOCOMMERCE VERTICAL THUMBNAILS
|
||||
============================================== */
|
||||
function oceanwpWooThumbnails() {
|
||||
"use strict"
|
||||
|
||||
var $thumbnails = $j( '.owp-thumbs-layout-vertical' ),
|
||||
$nav = $thumbnails.find( '.flex-control-nav' );
|
||||
|
||||
if ( $nav.length > 0 ) {
|
||||
|
||||
if ( $j( window ).width() > 768 ) {
|
||||
|
||||
var $image_height = $thumbnails.find( '.flex-viewport' ).height(),
|
||||
$nav_height = $thumbnails.find('.flex-control-nav').height();
|
||||
|
||||
if ( $nav_height > ( $image_height + 50 ) ) {
|
||||
$nav.css( {
|
||||
'max-height' : $image_height + 'px',
|
||||
} );
|
||||
}
|
||||
|
||||
} else {
|
||||
$nav.css( {
|
||||
'max-height' : '',
|
||||
} );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
var $j=jQuery.noConflict();function oceanwpWooThumbnails(){"use strict";var n,o=$j(".owp-thumbs-layout-vertical"),i=o.find(".flex-control-nav");0<i.length&&(768<$j(window).width()?(n=o.find(".flex-viewport").height())+50<o.find(".flex-control-nav").height()&&i.css({"max-height":n+"px"}):i.css({"max-height":""}))}$j(document).ready(function(){"use strict";oceanwpWooThumbnails()}),$j(window).on("load",function(){"use strict";oceanwpWooThumbnails()}),$j(window).on("resize",function(){"use strict";oceanwpWooThumbnails()});
|
||||
Reference in New Issue
Block a user