2012-07-17 14:09:18 +00:00
|
|
|
jQuery(document).ready(function($) {
|
2012-12-10 13:11:05 +00:00
|
|
|
|
2012-07-17 14:09:18 +00:00
|
|
|
// Tabs
|
2013-01-03 11:40:10 +00:00
|
|
|
$('.woocommerce-tabs .panel').hide();
|
2012-12-10 13:11:05 +00:00
|
|
|
|
2013-01-03 11:40:10 +00:00
|
|
|
$('.woocommerce-tabs ul.tabs li a').click(function(){
|
2012-12-10 13:11:05 +00:00
|
|
|
|
2012-07-17 14:09:18 +00:00
|
|
|
var $tab = $(this);
|
2013-01-03 11:40:10 +00:00
|
|
|
var $tabs_wrapper = $tab.closest('.woocommerce-tabs');
|
2012-12-10 13:11:05 +00:00
|
|
|
|
2012-07-17 14:09:18 +00:00
|
|
|
$('ul.tabs li', $tabs_wrapper).removeClass('active');
|
|
|
|
$('div.panel', $tabs_wrapper).hide();
|
|
|
|
$('div' + $tab.attr('href')).show();
|
|
|
|
$tab.parent().addClass('active');
|
2012-12-10 13:11:05 +00:00
|
|
|
|
|
|
|
return false;
|
2012-07-17 14:09:18 +00:00
|
|
|
});
|
2012-12-10 13:11:05 +00:00
|
|
|
|
2013-01-03 11:40:10 +00:00
|
|
|
$('.woocommerce-tabs').each(function() {
|
2012-07-17 14:09:18 +00:00
|
|
|
var hash = window.location.hash;
|
|
|
|
if (hash.toLowerCase().indexOf("comment-") >= 0) {
|
|
|
|
$('ul.tabs li.reviews_tab a', $(this)).click();
|
|
|
|
} else {
|
|
|
|
$('ul.tabs li:first a', $(this)).click();
|
|
|
|
}
|
|
|
|
});
|
2012-12-10 13:11:05 +00:00
|
|
|
|
2012-07-17 14:09:18 +00:00
|
|
|
// Star ratings for comments
|
|
|
|
$('#rating').hide().before('<p class="stars"><span><a class="star-1" href="#">1</a><a class="star-2" href="#">2</a><a class="star-3" href="#">3</a><a class="star-4" href="#">4</a><a class="star-5" href="#">5</a></span></p>');
|
2012-12-10 13:11:05 +00:00
|
|
|
|
2013-01-31 14:15:50 +00:00
|
|
|
$('p.stars a').live( 'click', function(){
|
2012-07-17 14:09:18 +00:00
|
|
|
var $star = $(this);
|
|
|
|
$('#rating').val( $star.text() );
|
|
|
|
$('p.stars a').removeClass('active');
|
|
|
|
$star.addClass('active');
|
|
|
|
return false;
|
|
|
|
});
|
2012-12-10 13:11:05 +00:00
|
|
|
|
2012-12-28 13:02:12 +00:00
|
|
|
$('#review_form').on( 'click', '#submit', function(){
|
2012-07-17 14:09:18 +00:00
|
|
|
var rating = $('#rating').val();
|
2012-12-10 13:11:05 +00:00
|
|
|
|
2012-07-17 14:09:18 +00:00
|
|
|
if ( $('#rating').size() > 0 && !rating && woocommerce_params.review_rating_required == 'yes' ) {
|
2012-12-10 13:11:05 +00:00
|
|
|
alert(woocommerce_params.i18n_required_rating_text);
|
2012-07-17 14:09:18 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2012-12-10 13:11:05 +00:00
|
|
|
|
2012-10-17 11:21:50 +00:00
|
|
|
// prevent double form submission
|
|
|
|
$('form.cart').submit(function(){
|
|
|
|
$(this).find(':submit').attr( 'disabled','disabled' );
|
|
|
|
});
|
2012-12-10 13:11:05 +00:00
|
|
|
|
2012-07-17 14:09:18 +00:00
|
|
|
});
|