芝麻web文件管理V1.00
编辑当前文件:/var/www/cognitio.in/wp-content/plugins/woocommerce/assets/js/frontend/cart.min.js
jQuery(function(n){if("undefined"==typeof wc_cart_params)return!1;const i=t=>{window.fetch(t.url,{method:t.type||"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:t.data}).then(t=>{if(t.ok)return t.text();throw new Error(t.statusText)}).then(t.success)["finally"](()=>t.complete())};var a=function(t){return wc_cart_params.wc_ajax_url.toString().replace("%%endpoint%%",t)},r=function(t){return t.is(".processing")||t.parents(".processing").length},s=function(t){r(t)||t.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},m=function(t){t.removeClass("processing").unblock()},o=function(t,e){var o,c,t=n.parseHTML(t),r=n(".woocommerce-cart-form",t),i=n(".cart_totals",t),a=(a=n(".woocommerce-error, .woocommerce-message, .woocommerce-info",t),o=[],(c=a).each(function(t){var e=n(this).text();"undefined"==typeof o[e]?o[e]=!0:c.splice(t,1)}),c);if(0===n(".woocommerce-cart-form").length)window.location.reload();else{if(e||n(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove(),0===r.length){if(n(".woocommerce-checkout").length)return void window.location.reload();e=n(".cart-empty",t).closest(".woocommerce");n(".woocommerce-cart-form__contents").closest(".woocommerce").replaceWith(e),0
a",this.item_remove_clicked),n(document).on("click",".woocommerce-cart .restore-item",this.item_restore_clicked),n(document).on("change input",".woocommerce-cart-form .cart_item :input",this.input_changed),n('.woocommerce-cart-form :input[name="update_cart"]').prop("disabled",!0).attr("aria-disabled",!0)},input_changed:function(){n('.woocommerce-cart-form :input[name="update_cart"]').prop("disabled",!1).attr("aria-disabled",!1)},update_cart:function(e){var t=n(".woocommerce-cart-form");s(t),s(n("div.cart_totals")),i({type:t.attr("method"),url:t.attr("action"),data:new URLSearchParams(new FormData(t[0])).toString(),dataType:"html",success:function(t){o(t,e)},complete:function(){m(t),m(n("div.cart_totals")),n.scroll_to_notices(n('[role="alert"]'))}})},update_cart_totals:function(){s(n("div.cart_totals")),i({url:a("get_cart_totals"),dataType:"html",success:function(t){p(t)},complete:function(){m(n("div.cart_totals"))}})},input_keypress:function(t){if(13===t.keyCode){var e=n(t.currentTarget).parents("form");try{e[0].checkValidity()&&(t.preventDefault(),this.cart_submit(t))}catch(o){t.preventDefault(),this.cart_submit(t)}}},cart_submit:function(t){var e=n(document.activeElement),o=n(":input[type=submit][clicked=true]"),c=n(t.currentTarget);if(0!==(c=c.is("form")?c:n(t.currentTarget).parents("form")).find(".woocommerce-cart-form__contents").length)return!r(c)&&void(o.is(':input[name="update_cart"]')||e.is("input.qty")?(t.preventDefault(),this.quantity_update(c)):(o.is(':input[name="apply_coupon"]')||e.is("#coupon_code"))&&(t.preventDefault(),this.apply_coupon(c)))},submit_click:function(t){n(":input[type=submit]",n(t.target).parents("form")).removeAttr("clicked"),n(t.target).attr("clicked","true")},apply_coupon:function(t){s(t);var e=this,o=n("#coupon_code"),c=o.val(),r={security:wc_cart_params.apply_coupon_nonce,coupon_code:c};i({type:"POST",url:a("apply_coupon"),data:new URLSearchParams(r).toString(),dataType:"html",success:function(t){n(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove(),u(t),n(document.body).trigger("applied_coupon",[c])},complete:function(){m(t),o.val(""),e.update_cart(!0)}})},remove_coupon_clicked:function(t){t.preventDefault();var e=this,o=n(t.currentTarget).closest(".cart_totals"),c=n(t.currentTarget).attr("data-coupon"),t=(s(o),{security:wc_cart_params.remove_coupon_nonce,coupon:c});i({type:"POST",url:a("remove_coupon"),data:new URLSearchParams(t).toString(),dataType:"html",success:function(t){n(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove(),u(t),n(document.body).trigger("removed_coupon",[c]),m(o)},complete:function(){e.update_cart(!0)}})},quantity_update:function(t){s(t),s(n("div.cart_totals")),n("
").attr("type","hidden").attr("name","update_cart").attr("value","Update Cart").appendTo(t),i({type:t.attr("method"),url:t.attr("action"),data:new URLSearchParams(new FormData(t[0])).toString(),dataType:"html",success:function(t){o(t)},complete:function(){m(t),m(n("div.cart_totals")),n.scroll_to_notices(n('[role="alert"]'))}})},item_remove_clicked:function(t){t.preventDefault();var t=n(t.currentTarget),e=t.parents("form");s(e),s(n("div.cart_totals")),i({type:"GET",url:t.attr("href"),dataType:"html",success:function(t){o(t)},complete:function(){m(e),m(n("div.cart_totals")),n.scroll_to_notices(n('[role="alert"]'))}})},item_restore_clicked:function(t){t.preventDefault();var t=n(t.currentTarget),e=n("form.woocommerce-cart-form");s(e),s(n("div.cart_totals")),i({type:"GET",url:t.attr("href"),dataType:"html",success:function(t){o(t)},complete:function(){m(e),m(n("div.cart_totals"))}})}};({init:function(t){this.cart=t,this.toggle_shipping=this.toggle_shipping.bind(this),this.shipping_method_selected=this.shipping_method_selected.bind(this),this.shipping_calculator_submit=this.shipping_calculator_submit.bind(this),n(document).on("click",".shipping-calculator-button",this.toggle_shipping),n(document).on("change","select.shipping_method, :input[name^=shipping_method]",this.shipping_method_selected),n(document).on("submit","form.woocommerce-shipping-calculator",this.shipping_calculator_submit),n(".shipping-calculator-form").hide()},toggle_shipping:function(){return n(".shipping-calculator-form").slideToggle("slow"),n("select.country_to_state, input.country_to_state").trigger("change"),n(document.body).trigger("country_to_state_changed"),!1},shipping_method_selected:function(){var t,e={},o=(n("select.shipping_method, :input[name^=shipping_method][type=radio]:checked, :input[name^=shipping_method][type=hidden]").each(function(){e[n(this).data("index")]=n(this).val()}),s(n("div.cart_totals")),{security:wc_cart_params.update_shipping_method_nonce});for(t in e)o["shipping_method["+t+"]"]=e[t];i({type:"post",url:a("update_shipping_method"),data:new URLSearchParams(o).toString(),dataType:"html",success:function(t){p(t)},complete:function(){m(n("div.cart_totals")),n(document.body).trigger("updated_shipping_method")}})},shipping_calculator_submit:function(t){t.preventDefault();var e=n(t.currentTarget);s(n("div.cart_totals")),s(e),n("
").attr("type","hidden").attr("name","calc_shipping").attr("value","x").appendTo(e),i({type:e.attr("method"),url:e.attr("action"),data:new URLSearchParams(new FormData(e[0])).toString(),dataType:"html",success:function(t){o(t)},complete:function(){m(e),m(n("div.cart_totals"))}})}}).init(t),t.init()});