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 );
|
||||
} );
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user