woocommerce/assets/js/woocommerce.min.js

1 line
12 KiB
JavaScript
Raw Normal View History

2011-09-05 09:04:17 +00:00
jQuery.fn.animateHighlight=function(e,c){var d=e||"#FFFF9C";var a=c||1500;var b=this.css("backgroundColor");this.stop().css("background-color",d).animate({backgroundColor:b},a)};jQuery(function(){jQuery(".add_to_cart_button").live("click",function(){var j=jQuery(this);if(j.is(".product_type_simple")){jQuery(j).addClass("loading");var k={action:"woocommerce_add_to_cart",product_id:jQuery(j).attr("rel"),security:woocommerce_params.add_to_cart_nonce};jQuery("body").trigger("adding_to_cart");jQuery.post(woocommerce_params.ajax_url,k,function(l){k=jQuery.parseJSON(l);if(k.error){alert(k.error);jQuery(j).removeClass("loading");return}fragments=k;if(fragments){jQuery.each(fragments,function(m,n){jQuery(m).addClass("updating")})}jQuery(".widget_shopping_cart, .shop_table.cart, .updating").fadeTo("400","0.6").block({message:null,overlayCSS:{background:"transparent url("+woocommerce_params.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:0.6}});jQuery(j).addClass("added");jQuery(j).removeClass("loading");jQuery(".widget_shopping_cart:eq(0)").load(window.location+" .widget_shopping_cart:eq(0) > *",function(){if(fragments){jQuery.each(fragments,function(m,n){jQuery(m).replaceWith(n)})}jQuery(".widget_shopping_cart, .updating").css("opacity","1").unblock()});jQuery(".shop_table.cart").load(window.location+" .shop_table.cart:eq(0) > *",function(){jQuery("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('<input type="button" value="+" id="add1" class="plus" />').prepend('<input type="button" value="-" id="minus1" class="minus" />');jQuery(".shop_table.cart").css("opacity","1").unblock()});jQuery("body").trigger("added_to_cart")});return false}else{return true}});jQuery("select.orderby").change(function(){jQuery(this).closest("form").submit()});jQuery("#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>');jQuery("p.stars a").click(function(){jQuery("#rating").val(jQuery(this).text());jQuery("p.stars a").removeClass("active");jQuery(this).addClass("active");return false});var g=jQuery(".price_slider_amount #min_price").val();var d=jQuery(".price_slider_amount #max_price").val();if(woocommerce_params.min_price){current_min_price=woocommerce_params.min_price}else{current_min_price=g}if(woocommerce_params.max_price){current_max_price=woocommerce_params.max_price}else{current_max_price=d}current_min_price=parseInt(current_min_price);current_max_price=parseInt(current_max_price);jQuery(".price_slider").slider({range:true,animate:true,min:g,max:d,values:[current_min_price,current_max_price],create:function(j,k){if(woocommerce_params.currency_pos=="left"){jQuery(".price_slider_amount span").html(woocommerce_params.currency_symbol+current_min_price+" - "+woocommerce_params.currency_symbol+current_max_price)}else{if(woocommerce_params.currency_pos=="left_space"){jQuery(".price_slider_amount span").html(woocommerce_params.currency_symbol+" "+current_min_price+" - "+woocommerce_params.currency_symbol+" "+current_max_price)}else{if(woocommerce_params.currency_pos=="right"){jQuery(".price_slider_amount span").html(current_min_price+woocommerce_params.currency_symbol+" - "+current_max_price+woocommerce_params.currency_symbol)}else{if(woocommerce_params.currency_pos=="right_space"){jQuery(".price_slider_amount span").html(current_min_price+" "+woocommerce_params.currency_symbol+" - "+current_max_price+" "+woocommerce_params.currency_symbol)}}}}jQuery(".price_slider_amount #min_price").val(current_min_price);jQuery(".price_slider_amount #max_price").val(current_max_price)},slide:function(j,k){if(woocommerce_params.currency_pos=="left"){jQuery(".price_slider_amount span").html(woocommerce_params.currency_symbol+k.values[0]+" - "+woocommerce_params.currency_symbol+k.values[1])}else{if(woocommerce_params.currency_pos=="left_space"){jQuery(".price_slider_amount span").html(woocommerce_params.currency_symbol+" "+k.values