woocommerce/assets/js/woocommerce.min.js

1 line
12 KiB
JavaScript
Raw Normal View History

jQuery(document).ready(function(f){if(woocommerce_params.option_ajax_add_to_cart=="yes"){f(".add_to_cart_button").live("click",function(){var n=f(this);if(n.is(".product_type_simple, .product_type_downloadable, .product_type_virtual")){f(n).addClass("loading");var o={action:"woocommerce_add_to_cart",product_id:f(n).attr("rel"),security:woocommerce_params.add_to_cart_nonce};f("body").trigger("adding_to_cart");f.post(woocommerce_params.ajax_url,o,function(p){f(n).removeClass("loading");o=f.parseJSON(p);if(o.error){alert(o.error);return}fragments=o;if(fragments){f.each(fragments,function(q,r){f(q).addClass("updating")})}f(".widget_shopping_cart, .shop_table.cart, .updating, .cart_totals").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}});f(n).addClass("added");if(f(".widget_shopping_cart").size()>0){f(".widget_shopping_cart:eq(0)").load(window.location+" .widget_shopping_cart:eq(0) > *",function(){if(fragments){f.each(fragments,function(q,r){f(q).replaceWith(r)})}f(".widget_shopping_cart, .updating").css("opacity","1").unblock()})}else{if(fragments){f.each(fragments,function(q,r){f(q).replaceWith(r)})}f(".widget_shopping_cart, .updating").css("opacity","1").unblock()}f(".shop_table.cart").load(window.location+" .shop_table.cart:eq(0) > *",function(){f("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" />');f(".shop_table.cart").css("opacity","1").unblock()});f(".cart_totals").load(window.location+" .cart_totals:eq(0) > *",function(){f(".cart_totals").css("opacity","1").unblock()});f("body").trigger("added_to_cart")});return false}else{return true}})}f("select.orderby").change(function(){f(this).closest("form").submit()});f("#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>');f("p.stars a").click(function(){var n=f(this);f("#rating").val(n.text());f("p.stars a").removeClass("active");n.addClass("active");return false});var i=f(".price_slider_amount #min_price").val();var d=f(".price_slider_amount #max_price").val();current_min_price=parseInt(i);current_max_price=parseInt(d);if(woocommerce_params.min_price){current_min_price=parseInt(woocommerce_params.min_price)}if(woocommerce_params.max_price){current_max_price=parseInt(woocommerce_params.max_price)}f(".price_slider").slider({range:true,animate:true,min:i,max:d,values:[current_min_price,current_max_price],create:function(n,o){if(woocommerce_params.currency_pos=="left"){f(".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"){f(".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"){f(".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"){f(".price_slider_amount span").html(current_min_price+" "+woocommerce_params.currency_symbol+" - "+current_max_price+" "+woocommerce_params.currency_symbol)}}}}f(".price_slider_amount #min_price").val(current_min_price);f(".price_slider_amount #max_price").val(current_max_price)},slide:function(n,o){if(woocommerce_params.currency_pos=="left"){f(".price_slider_amount span").html(woocommerce_params.currency_symbol+o.values[0]+" - "+woocommerce_params.currency_symbol+o.values[1])}else{if(woocommerce_params.currency_pos=="left_space"){f(".price_slider_amount span").html(woocommerce_params.currency_symbol+" "+o.values[0]+" - "+woocommerce_para