jQuery(function(e){if("undefined"==typeof wc_add_to_cart_params)return!1;var t=function(){e(document.body).on("click",".add_to_cart_button",this.onAddToCart).on("click",".remove_from_cart_button",this.onRemoveFromCart).on("added_to_cart",this.updateButton).on("added_to_cart",this.updateCartPage).on("added_to_cart removed_from_cart",this.updateFragments)};t.prototype.onAddToCart=function(t){var a=e(this);if(a.is(".ajax_add_to_cart")){if(!a.attr("data-product_id"))return!0;t.preventDefault(),a.removeClass("added"),a.addClass("loading");var o={};e.each(a.data(),function(t,a){o[t]=a}),e(document.body).trigger("adding_to_cart",[a,o]),e.post(wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart"),o,function(t){t&&(t.error&&t.product_url?window.location=t.product_url:"yes"!==wc_add_to_cart_params.cart_redirect_after_add?e(document.body).trigger("added_to_cart",[t.fragments,t.cart_hash,a]):window.location=wc_add_to_cart_params.cart_url)})}},t.prototype.onRemoveFromCart=function(t){var a=e(this),o=a.closest(".woocommerce-mini-cart-item");t.preventDefault(),o.block({message:null,overlayCSS:{opacity:.6}}),e.post(wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","remove_from_cart"),{cart_item_key:a.data("cart_item_key")},function(t){t&&t.fragments?e(document.body).trigger("removed_from_cart",[t.fragments,t.cart_hash]):window.location=a.attr("href")}).fail(function(){window.location=a.attr("href")})},t.prototype.updateButton=function(t,a,o,r){(r=void 0!==r&&r)&&(r.removeClass("loading"),r.addClass("added"),wc_add_to_cart_params.is_cart||0!==r.parent().find(".added_to_cart").length||r.after(' '+wc_add_to_cart_params.i18n_view_cart+""),e(document.body).trigger("wc_cart_button_updated",[r]))},t.prototype.updateCartPage=function(){var t=window.location.toString().replace("add-to-cart","added-to-cart");e(".shop_table.cart").load(t+" .shop_table.cart:eq(0) > *",function(){e(".shop_table.cart").stop(!0).css("opacity","1").unblock(),e(document.body).trigger("cart_page_refreshed")}),e(".cart_totals").load(t+" .cart_totals:eq(0) > *",function(){e(".cart_totals").stop(!0).css("opacity","1").unblock(),e(document.body).trigger("cart_totals_refreshed")})},t.prototype.updateFragments=function(t,a){a&&(e.each(a,function(t){e(t).addClass("updating").fadeTo("400","0.6").block({message:null,overlayCSS:{opacity:.6}})}),e.each(a,function(t,a){e(t).replaceWith(a),e(t).stop(!0).css("opacity","1").unblock()}),e(document.body).trigger("wc_fragments_loaded"))},new t}); !function(){"use strict";function e(e){function t(t,n){var s,h,k=t==window,y=n&&n.message!==undefined?n.message:undefined;if(!(n=e.extend({},e.blockUI.defaults,n||{})).ignoreIfBlocked||!e(t).data("blockUI.isBlocked")){if(n.overlayCSS=e.extend({},e.blockUI.defaults.overlayCSS,n.overlayCSS||{}),s=e.extend({},e.blockUI.defaults.css,n.css||{}),n.onOverlayClick&&(n.overlayCSS.cursor="pointer"),h=e.extend({},e.blockUI.defaults.themedCSS,n.themedCSS||{}),y=y===undefined?n.message:y,k&&p&&o(window,{fadeOut:0}),y&&"string"!=typeof y&&(y.parentNode||y.jquery)){var m=y.jquery?y[0]:y,g={};e(t).data("blockUI.history",g),g.el=m,g.parent=m.parentNode,g.display=m.style.display,g.position=m.style.position,g.parent&&g.parent.removeChild(m)}e(t).data("blockUI.onUnblock",n.onUnblock);var v,I,w,U,x=n.baseZ;v=e(r||n.forceIframe?'':''),I=e(n.theme?'':''),n.theme&&k?(U='"):n.theme?(U='"):U=k?'':'',w=e(U),y&&(n.theme?(w.css(h),w.addClass("ui-widget-content")):w.css(s)),n.theme||I.css(n.overlayCSS),I.css("position",k?"fixed":"absolute"),(r||n.forceIframe)&&v.css("opacity",0);var C=[v,I,w],S=e(k?"body":t);e.each(C,function(){this.appendTo(S)}),n.theme&&n.draggable&&e.fn.draggable&&w.draggable({handle:".ui-dialog-titlebar",cancel:"li"});var O=f&&(!e.support.boxModel||e("object,embed",k?null:t).length>0);if(u||O){if(k&&n.allowBodyStretch&&e.support.boxModel&&e("html,body").css("height","100%"),(u||!e.support.boxModel)&&!k)var E=a(t,"borderTopWidth"),T=a(t,"borderLeftWidth"),M=E?"(0 - "+E+")":0,B=T?"(0 - "+T+")":0;e.each(C,function(e,t){var o=t[0].style;if(o.position="absolute",e<2)k?o.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:"+n.quirksmodeOffsetHack+') + "px"'):o.setExpression("height",'this.parentNode.offsetHeight + "px"'),k?o.setExpression("width",'jQuery.support.boxModel&&document.documentElement.clientWidth||document.body.clientWidth + "px"'):o.setExpression("width",'this.parentNode.offsetWidth + "px"'),B&&o.setExpression("left",B),M&&o.setExpression("top",M);else if(n.centerY)k&&o.setExpression("top",'(document.documentElement.clientHeight||document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah=document.documentElement.scrollTop ? document.documentElement.scrollTop:document.body.scrollTop) + "px"'),o.marginTop=0;else if(!n.centerY&&k){var i="((document.documentElement.scrollTop ? document.documentElement.scrollTop:document.body.scrollTop) + "+(n.css&&n.css.top?parseInt(n.css.top,10):0)+') + "px"';o.setExpression("top",i)}})}if(y&&(n.theme?w.find(".ui-widget-content").append(y):w.append(y),(y.jquery||y.nodeType)&&e(y).show()),(r||n.forceIframe)&&n.showOverlay&&v.show(),n.fadeIn){var j=n.onBlock?n.onBlock:c,H=n.showOverlay&&!y?j:c,z=y?j:c;n.showOverlay&&I._fadeIn(n.fadeIn,H),y&&w._fadeIn(n.fadeIn,z)}else n.showOverlay&&I.show(),y&&w.show(),n.onBlock&&n.onBlock.bind(w)();if(i(1,t,n),k?(p=w[0],b=e(n.focusableElements,p),n.focusInput&&setTimeout(l,20)):d(w[0],n.centerX,n.centerY),n.timeout){var W=setTimeout(function(){k?e.unblockUI(n):e(t).unblock(n)},n.timeout);e(t).data("blockUI.timeout",W)}}}function o(t,o){var s,l=t==window,d=e(t),a=d.data("blockUI.history"),c=d.data("blockUI.timeout");c&&(clearTimeout(c),d.removeData("blockUI.timeout")),o=e.extend({},e.blockUI.defaults,o||{}),i(0,t,o),null===o.onUnblock&&(o.onUnblock=d.data("blockUI.onUnblock"),d.removeData("blockUI.onUnblock"));var r;r=l?e(document.body).children().filter(".blockUI").add("body > .blockUI"):d.find(">.blockUI"),o.cursorReset&&(r.length>1&&(r[1].style.cursor=o.cursorReset),r.length>2&&(r[2].style.cursor=o.cursorReset)),l&&(p=b=null),o.fadeOut?(s=r.length,r.stop().fadeOut(o.fadeOut,function(){0==--s&&n(r,a,o,t)})):n(r,a,o,t)}function n(t,o,n,i){var s=e(i);if(!s.data("blockUI.isBlocked")){t.each(function(e,t){this.parentNode&&this.parentNode.removeChild(this)}),o&&o.el&&(o.el.style.display=o.display,o.el.style.position=o.position,o.el.style.cursor="default",o.parent&&o.parent.appendChild(o.el),s.removeData("blockUI.history")),s.data("blockUI.static")&&s.css("position","static"),"function"==typeof n.onUnblock&&n.onUnblock(i,n);var l=e(document.body),d=l.width(),a=l[0].style.width;l.width(d-1).width(d),l[0].style.width=a}}function i(t,o,n){var i=o==window,l=e(o);if((t||(!i||p)&&(i||l.data("blockUI.isBlocked")))&&(l.data("blockUI.isBlocked",t),i&&n.bindEvents&&(!t||n.showOverlay))){var d="mousedown mouseup keydown keypress keyup touchstart touchend touchmove";t?e(document).bind(d,n,s):e(document).unbind(d,s)}}function s(t){if("keydown"===t.type&&t.keyCode&&9==t.keyCode&&p&&t.data.constrainTabKey){var o=b,n=!t.shiftKey&&t.target===o[o.length-1],i=t.shiftKey&&t.target===o[0];if(n||i)return setTimeout(function(){l(i)},10),!1}var s=t.data,d=e(t.target);return d.hasClass("blockOverlay")&&s.onOverlayClick&&s.onOverlayClick(t),d.parents("div."+s.blockMsgClass).length>0||0===d.parents().children().filter("div.blockUI").length}function l(e){if(b){var t=b[!0===e?b.length-1:0];t&&t.focus()}}function d(e,t,o){var n=e.parentNode,i=e.style,s=(n.offsetWidth-e.offsetWidth)/2-a(n,"borderLeftWidth"),l=(n.offsetHeight-e.offsetHeight)/2-a(n,"borderTopWidth");t&&(i.left=s>0?s+"px":"0"),o&&(i.top=l>0?l+"px":"0")}function a(t,o){return parseInt(e.css(t,o),10)||0}e.fn._fadeIn=e.fn.fadeIn;var c=e.noop||function(){},r=/MSIE/.test(navigator.userAgent),u=/MSIE 6.0/.test(navigator.userAgent)&&!/MSIE 8.0/.test(navigator.userAgent),f=(document.documentMode,e.isFunction(document.createElement("div").style.setExpression));e.blockUI=function(e){t(window,e)},e.unblockUI=function(e){o(window,e)},e.growlUI=function(t,o,n,i){var s=e('
');t&&s.append("

"+t+"

"),o&&s.append("

"+o+"

"),n===undefined&&(n=3e3);var l=function(t){t=t||{},e.blockUI({message:s,fadeIn:"undefined"!=typeof t.fadeIn?t.fadeIn:700,fadeOut:"undefined"!=typeof t.fadeOut?t.fadeOut:1e3,timeout:"undefined"!=typeof t.timeout?t.timeout:n,centerY:!1,showOverlay:!1,onUnblock:i,css:e.blockUI.defaults.growlCSS})};l();s.css("opacity");s.mouseover(function(){l({fadeIn:0,timeout:3e4});var t=e(".blockMsg");t.stop(),t.fadeTo(300,1)}).mouseout(function(){e(".blockMsg").fadeOut(1e3)})},e.fn.block=function(o){if(this[0]===window)return e.blockUI(o),this;var n=e.extend({},e.blockUI.defaults,o||{});return this.each(function(){var t=e(this);n.ignoreIfBlocked&&t.data("blockUI.isBlocked")||t.unblock({fadeOut:0})}),this.each(function(){"static"==e.css(this,"position")&&(this.style.position="relative",e(this).data("blockUI.static",!0)),this.style.zoom=1,t(this,o)})},e.fn.unblock=function(t){return this[0]===window?(e.unblockUI(t),this):this.each(function(){o(this,t)})},e.blockUI.version=2.7,e.blockUI.defaults={message:"

Please wait...

",title:null,draggable:!0,theme:!1,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:.6,cursor:"wait"},cursorReset:"default",growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px","border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:!1,baseZ:1e3,centerX:!0,centerY:!0,allowBodyStretch:!0,bindEvents:!0,constrainTabKey:!0,fadeIn:200,fadeOut:400,timeout:0,showOverlay:!0,focusInput:!0,focusableElements:":input:enabled:visible",onBlock:null,onUnblock:null,onOverlayClick:null,quirksmodeOffsetHack:4,blockMsgClass:"blockMsg",ignoreIfBlocked:!1};var p=null,b=[]}"function"==typeof define&&define.amd&&define.amd.jQuery?define(["jquery"],e):e(jQuery)}(); !function(e){var n=!1;if("function"==typeof define&&define.amd&&(define(e),n=!0),"object"==typeof exports&&(module.exports=e(),n=!0),!n){var o=window.Cookies,t=window.Cookies=e();t.noConflict=function(){return window.Cookies=o,t}}}(function(){function e(){for(var e=0,n={};e1){if("number"==typeof(i=e({path:"/"},t.defaults,i)).expires){var a=new Date;a.setMilliseconds(a.getMilliseconds()+864e5*i.expires),i.expires=a}i.expires=i.expires?i.expires.toUTCString():"";try{c=JSON.stringify(r),/^[\{\[]/.test(c)&&(r=c)}catch(m){}r=o.write?o.write(r,n):encodeURIComponent(String(r)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),n=(n=(n=encodeURIComponent(String(n))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var f="";for(var s in i)i[s]&&(f+="; "+s,!0!==i[s]&&(f+="="+i[s]));return document.cookie=n+"="+r+f}n||(c={});for(var p=document.cookie?document.cookie.split("; "):[],d=/(%[0-9A-Z]{2})+/g,u=0;u 0){ notification_el.slideDown('slow'); clearTimeout(fadenotice); fadenotice=setTimeout(function(){ notification_el.slideUp('slow',function(){ notification_el.html(''); }); },parseInt(xoo_wsc_localize.notification_time)) }} function toggle_sidecart(toggle_type){ var toggle_element=$('.xoo-wsc-modal , body, html'), toggle_class='xoo-wsc-active'; if(toggle_type=='show'){ toggle_element.addClass(toggle_class); } else if(toggle_type=='hide'){ toggle_element.removeClass(toggle_class); }else{ toggle_element.toggleClass('xoo-wsc-active'); } unblock_cart(); } $('body').on('click','.xoo-wsc-basket,.xoo-wsc-sc-cont',toggle_sidecart); if(xoo_wsc_localize.trigger_class){ $('.'+xoo_wsc_localize.trigger_class).on('click',toggle_sidecart); } (function(){ if(xoo_wsc_localize.added_to_cart){ var toggled=false; $(document).on('wc_fragments_refreshed',function(){ if(!toggled){ setTimeout(toggle_sidecart,1,'show'); toggled=true; }}) }}()); $(document).on('added_to_cart',function(event,fragments,hash,atc_btn){ var cart=$('.xoo-wsc-basket'); if(xoo_wsc_localize.show_basket!='always_hide'){ cart.show(); } var opensidecart=function(){ if(xoo_wsc_localize.auto_open_cart==1){ setTimeout(toggle_sidecart,1,'show'); }} if(xoo_wsc_localize.flyto_anim==1){ fly_to_cart(atc_btn,opensidecart); }else{ opensidecart(); } if(!xoo_wsc_localize.apply_coupon_nonce){ create_coupon_nonce(); } update_cartChk(); }); function create_coupon_nonce(){ $.ajax({ url: xoo_wsc_localize.adminurl, type: 'POST', data: { action: 'xoo_wsc_create_nonces' }, success: function(response){ if(response['apply-coupon']){ xoo_wsc_localize.apply_coupon_nonce=response['apply-coupon']; } if(response['remove-coupon']){ xoo_wsc_localize.remove_coupon_nonce=response['remove-coupon']; }} }) } function close_sidecart(e){ $.each(e.target.classList,function(key,value){ if(value!='xoo-wsc-container'&&(value=='xoo-wsc-close'||value=='xoo-wsc-opac'||value=='xoo-wsc-basket'||value=='xoo-wsc-cont')){ $('.xoo-wsc-modal , body, html').removeClass('xoo-wsc-active'); }}) } $('body').on('click','.xoo-wsc-close , .xoo-wsc-opac',function(e){ e.preventDefault(); close_sidecart(e); }); $('body').on('click','.xoo-wsc-cont',function(e){ var link=$.trim($(this).attr('href')); if(link=="#"||!link){ e.preventDefault(); close_sidecart(e); }}); function content_height(){ var header=$('.xoo-wsc-header').outerHeight(), footer=$('.xoo-wsc-footer').outerHeight(), screen=window.innerHeight, $cont=$('.xoo-wsc-container'); if(xoo_wsc_localize.cont_height=="auto_adjust"){ $cont.css({"top": "", "bottom": ""}); var body_height='calc(100% - '+(header+footer)+'px)'; if($cont.outerHeight() > screen){ $cont.css({"top": "0", "bottom": "0"}); }}else{ var body_height=screen-(header+footer); } $('.xoo-wsc-body').css('height',body_height); }; content_height(); $(window).resize(function(){ content_height(); }); function add_to_cart(atc_btn,product_data){ $(document.body).trigger('adding_to_cart', [ atc_btn, product_data ]); $.ajax({ url: xoo_wsc_localize.wc_ajax_url.toString().replace('%%endpoint%%', 'xoo_wsc_add_to_cart'), type: 'POST', data: $.param(product_data), success: function(response){ add_to_cart_button_check_icon(atc_btn); if(response.fragments){ $(document.body).trigger('added_to_cart', [ response.fragments, response.cart_hash, atc_btn ]); } else if(response.error){ show_notice('error',response.error); toggle_sidecart(); }else{ console.log(response); }} }) } function update_cart(cart_key,new_qty){ block_cart(); var endpoint='xoo_wsc_update_cart'; endpoint +=new_qty > 0 ? '&xoo_wsc_qty_update':''; $.ajax({ url: xoo_wsc_localize.wc_ajax_url.toString().replace('%%endpoint%%', endpoint), type: 'POST', data: { cart_key: cart_key, new_qty: new_qty }, success: function(response){ if(response.fragments){ var fragments=response.fragments, cart_hash=response.cart_hash; $.each(response.fragments, function(key, value){ $(key).replaceWith(value); $(key).stop(true).css('opacity', '1').unblock(); }); if(wc_cart_fragments_params){ var cart_hash_key=wc_cart_fragments_params.ajax_url.toString() + '-wc_cart_hash'; sessionStorage.setItem(wc_cart_fragments_params.fragment_name, JSON.stringify(fragments)); localStorage.setItem(cart_hash_key, cart_hash); sessionStorage.setItem(cart_hash_key, cart_hash); } $(document.body).trigger('wc_fragments_loaded'); $(document.body).trigger('xoo_wsc_cart_updated'); }else{ show_notice('error',response.error); }} }) } $(document).on('click', '.xoo-wsc-chng' ,function(){ var _this=$(this); var qty_element=_this.siblings('.xoo-wsc-qty'); qty_element.trigger('focusin'); var input_qty=parseFloat(qty_element.val()); var step=parseFloat(qty_element.attr('step')); var min_value=parseFloat(qty_element.attr('min')); var max_value=parseFloat(qty_element.attr('max')); if(_this.hasClass('xoo-wsc-plus')){ var new_qty=input_qty + step; if(new_qty > max_value&&max_value > 0){ alert('Maximum Quantity: '+max_value); return; }} else if(_this.hasClass('xoo-wsc-minus')){ var new_qty=input_qty - step; if(new_qty===0){ _this.parents('.xoo-wsc-product').find('.xoo-wsc-remove').trigger('click'); return; } else if(new_qty < min_value){ return; } else if(input_qty < 0){ alert('Invalid'); return; }} var cart_key=_this.parents('.xoo-wsc-product').data('xoo_wsc'); update_cart(cart_key,new_qty); }) $(document).on('focusin','.xoo-wsc-qty',function(){ focus_qty=$(this).val(); }) $(document).on('change','.xoo-wsc-qty',function(e){ var _this=$(this); var new_qty=parseFloat($(this).val()); var step=parseFloat($(this).attr('step')); var min_value=parseFloat($(this).attr('min')); var max_value=parseFloat($(this).attr('max')); var invalid=false; var cart_key=_this.parents('.xoo-wsc-product').data('xoo_wsc'); if(new_qty===0){ _this.parents('.xoo-wsc-product').find('.xoo-wsc-remove').trigger('click'); return; } else if(isNaN(new_qty)||new_qty < 0){ invalid=true; } else if(new_qty > max_value&&max_value > 0){ alert('Maximum Quantity: '+max_value); invalid=true; } else if(new_qty < min_value){ invalid=true; } else if((new_qty % step)!==0){ alert('Quantity can only be purchased in multiple of '+step); invalid=true; }else{ update_cart(cart_key,new_qty); } if(invalid===true){ $(this).val(focus_qty); }}) $(document).on('click','.xoo-wsc-remove',function(e){ e.preventDefault(); var product_row=$(this).parents('.xoo-wsc-product'); var cart_key=product_row.data('xoo_wsc'); update_cart(cart_key,0); }) $(document).on('submit','form.cart',function(e){ if(xoo_wsc_localize.ajax_atc!=1) return; e.preventDefault(); block_cart(); var form=$(this); var atc_btn=form.find('button[type="submit"]'); add_to_cart_button_loading_icon(atc_btn); var product_data=form.serializeArray(); var has_product_id=false; $.each(product_data,function(key,form_item){ if(form_item.name==='product_id'||form_item.name==='add-to-cart'){ if(form_item.value){ has_product_id=true; return false; }} }) if(!has_product_id){ var is_url=form.attr('action').match(/add-to-cart=([0-9]+)/); var product_id=is_url ? is_url[1]:false; } if(atc_btn.attr('name')&&atc_btn.attr('name')=='add-to-cart'&&atc_btn.attr('value')){ var product_id=atc_btn.attr('value'); } if(product_id){ product_data.push({name: 'add-to-cart', value: product_id}); } product_data.push({name: 'action', value: 'xoo_wsc_add_to_cart'}); add_to_cart(atc_btn,product_data); }) function show_notice(notice_type,notice){ $('.xoo-wsc-notice').html(notice).attr('class','xoo-wsc-notice').addClass('xoo-wsc-nt-'+notice_type); $('.xoo-wsc-notice-box').fadeIn('fast'); clearTimeout(fadenotice); var fadenotice=setTimeout(function(){ $('.xoo-wsc-notice-box').fadeOut('slow'); },2000); }; function add_to_cart_button_loading_icon(atc_btn){ if(xoo_wsc_localize.atc_icons!=1) return; if(atc_btn.find('.xoo-wsc-icon-atc').length!==0){ atc_btn.find('.xoo-wsc-icon-atc').attr('class','xoo-wsc-icon-spinner2 xoo-wsc-icon-atc xoo-wsc-active'); }else{ atc_btn.append(''); }} function add_to_cart_button_check_icon(atc_btn){ if(xoo_wsc_localize.atc_icons!=1) return; atc_btn.find('.xoo-wsc-icon-atc').attr('class','xoo-wsc-icon-checkmark xoo-wsc-icon-atc'); } $(document).on('click','.xoo-wsc-coupon-trigger',function(){ $('.xoo-wsc-coupon').toggleClass('active'); $(this).toggleClass('active'); }) $(document).on('click','.xoo-wsc-coupon-submit',function(e){ var coupon=$('#xoo-wsc-coupon-code'); var coupon_code=(coupon.val()).trim(); if(!coupon_code.length){ return; } $('.xoo-wsc-block-cart').show(); $(this).addClass('active'); var data={ security: xoo_wsc_localize.apply_coupon_nonce, coupon_code: coupon_code } $.ajax({ url: xoo_wsc_localize.wc_ajax_url.toString().replace('%%endpoint%%', 'apply_coupon'), type: 'POST', data: data, success: function(response){ show_notice('error',response); $(document.body).trigger('applied_coupon', [ coupon_code ]); $(document.body).trigger('wc_fragment_refresh'); }, complete: function(){ $('.xoo-wsc-block-cart').hide(); }}) }) $(document).on('click','.xoo-wsc-remove-coupon',function(e){ var coupon=$(this).attr('data-coupon'); if(!coupon.length){ e.preventDefault(); } $(this).css("pointer-events","none"); block_cart(); var data={ security: xoo_wsc_localize.remove_coupon_nonce, coupon: coupon } $.ajax({ url: xoo_wsc_localize.wc_ajax_url.toString().replace('%%endpoint%%', 'remove_coupon'), type: 'POST', data: data, success: function(response){ show_notice('error',response); $(document.body).trigger('removed_coupon', [ coupon ]); $(document.body).trigger('wc_fragment_refresh'); }, complete: function(){ $('.xoo-wsc-block-cart').hide(); }}) }) $(document).on('click','.xoo-wsc-undo-item',function(){ var cart_key=$(this).data('xoo_ckey'); if(!cart_key) return; block_cart(); $.ajax({ url: xoo_wsc_localize.wc_ajax_url.toString().replace('%%endpoint%%', 'xoo_wsc_undo_item'), type: 'POST', data: { cart_key: cart_key, }, success: function(response){ if(response.fragments){ $(document.body).trigger('added_to_cart', [ response.fragments, response.cart_hash]); } else if(response.error){ show_notice('error',response.error) }else{ console.log(response); } unblock_cart(); }}) }) function fly_to_cart(atc_btn,callback){ var cart=$('.xoo-wsc-basket'); if(cart.length < 1){ cart=$('.xoo-wsc-sc-cont'); } if(atc_btn.parents('form.cart').length!==0){ var imgtodrag=$('.woocommerce-product-gallery'); }else{ var imgtodrag=atc_btn.parents('.product'); } if(imgtodrag.length===0||cart.length===0){ callback(); return; } var imgclone=imgtodrag.clone() .offset({ top: imgtodrag.offset().top, left: imgtodrag.offset().left }) .css({ 'opacity': '1', 'position': 'absolute', 'height': '150px', 'width': '150px', 'z-index': '100' }) .appendTo($('body')) .animate({ 'top': cart.offset().top - 10, 'left': cart.offset().left - 10, 'width': 75, 'height': 75 }, 1000, 'easeInOutExpo'); setTimeout(function (){ cart.effect("shake", { times: 1 }, 200, setTimeout(function(){ callback(); },200)); }, 1500); imgclone.animate({ 'width': 0, 'height': 0 }, function (){ $(this).detach(); }); }}); !function(d,l){"use strict";var e=!1,n=!1;if(l.querySelector)if(d.addEventListener)e=!0;if(d.wp=d.wp||{},!d.wp.receiveEmbedMessage)if(d.wp.receiveEmbedMessage=function(e){var t=e.data;if(t)if(t.secret||t.message||t.value)if(!/[^a-zA-Z0-9]/.test(t.secret)){for(var r,i,a,s=l.querySelectorAll('iframe[data-secret="'+t.secret+'"]'),n=l.querySelectorAll('blockquote[data-secret="'+t.secret+'"]'),o=new RegExp("^https?:$","i"),c=0;c