2014-02-03 14:35:26 +00:00
|
|
|
jQuery(function(a){if("undefined"==typeof wc_cart_fragments_params)return!1;if($supports_html5_storage="sessionStorage"in window&&null!==window.sessionStorage,$fragment_refresh={url:wc_cart_fragments_params.ajax_url,type:"POST",data:{action:"woocommerce_get_refreshed_fragments"},success:function(b){b&&b.fragments&&(a.each(b.fragments,function(b,c){a(b).replaceWith(c)}),$supports_html5_storage&&(sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(b.fragments)),sessionStorage.setItem("wc_cart_hash",b.cart_hash)),a("body").trigger("wc_fragments_refreshed"))}},$supports_html5_storage){a("body").bind("added_to_cart",function(a,b,c){sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(b)),sessionStorage.setItem("wc_cart_hash",c)});try{var b=a.parseJSON(sessionStorage.getItem(wc_cart_fragments_params.fragment_name)),c=sessionStorage.getItem("wc_cart_hash"),d=a.cookie("woocommerce_cart_hash");if((null==c||void 0==c||""==c)&&(c=""),(null==d||void 0==d||""==d)&&(d=""),!b||!b["div.widget_shopping_cart_content"]||c!=d)throw"No fragment";a.each(b,function(b,c){a(b).replaceWith(c)}),a("body").trigger("wc_fragments_loaded")}catch(e){a.ajax($fragment_refresh)}}else a.ajax($fragment_refresh);a.cookie("woocommerce_items_in_cart")>0?a(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show():a(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").hide(),a("body").bind("adding_to_cart",function(){a(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show()})});
|