PageSourceSearch

https://www.edwardbulmerpaint.co.uk/app/plugins/woocommerce-gift-c…/js/frontend/wc-gc-main.min.js?ver=efb115

js edwardbulmerpaint.co.uk collected 2026-09-25 18:38:49 UTC 11,095 bytes, 1 lines download raw bytes

1((_,s,t)=>{function o(){var e;(o=function(){return e}).prototype=this,(e=new o).constructor=o,this.handlers={cart:new n,checkout:new a},this.integrations={subscriptions:new i},_(s.body).trigger("wc_gc_before_init",[this])}function a(){this.$notices_container=_("<div/>"),this.requires_async_process=!1,this.handle_remove=this.handle_remove.bind(this),this.handle_form=this.handle_form.bind(this),this.handle_checkout=this.handle_checkout.bind(this)}function n(){this.$notices_container=_("<div/>"),this.handle_submit=this.handle_submit.bind(this),this.handle_remove=this.handle_remove.bind(this),this.handle_checkbox=this.handle_checkbox.bind(this)}function i(){this.$toggle_balance_balance_container=null,this.$toggle_balance=null,this.$toggle_balance_auto_renew_container=null,this.$toggle_auto_renew=null,this.$parent_container=null,this.$icon=null,this.initial_status=null,this.txt_color=null,this.on_toggle=this.on_toggle.bind(this),this.on_auto_renew_toggle=this.on_auto_renew_toggle.bind(this),this.should_reload_before_showing_modal=this.should_reload_before_showing_modal.bind(this)}function l(e){return wc_gc_params.wc_ajax_url.toString().replace("%%endpoint%%",e)}function g(e){var t;(t=e).is(".processing")||t.parents(".processing").length||e.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}function d(e){e.removeClass("processing").unblock()}function u(e){_(".cart_totals").replaceWith(e),_(s.body).trigger("updated_cart_totals")}function h(e,t){return new Date(e.getTime()+6e4*t)}function p(e){return e.target||e.srcElement}void 0!==t.WC_GC?t.console.error('A global window variable with the name "WC_GC" already exists. Exiting...'):(_(function(){t.WC_GC.init()}),o.prototype.init=function(){"loading"===s.readyState?t.console.error("WC_GC_Controller called incorrectly. Please use this function after the DOM finishes loading. Exiting..."):(this.handlers.cart.register_events(),this.handlers.checkout.register_events(),this.integrations.subscriptions.init(),_(s).on("keydown","#wc_gc_cart_code",this.prevent_accidental_submiting),_(".woocommerce_gc_giftcard_form").wc_gc_datepickers(),_(s.body).trigger("wc_gc_init",[this]))},o.prototype.prevent_accidental_submiting=function(e){13==(e.which||e.keyCode||0)&&(e.preventDefault(),(e=_(p(e))).val())&&(e=e.closest(".add_gift_card_form").find("#wc_gc_cart_redeem_send")).length&&e.trigger("click")},a.prototype.register_events=function(){var e=_(".woocommerce-checkout");e.on("click","#wc_gc_cart_redeem_send",this.handle_form),e.on("click",".wc_gc_remove_gift_card",this.handle_remove),_(s.body).on("updated_checkout",this.handle_checkout)},a.prototype.handle_checkout=function(){var e;this.requires_async_process?((e=_(".woocommerce-checkout-payment, .woocommerce-checkout-review-order-table").find(".add_gift_card_form")).length&&(e=e.find(".wc_gc_add_gift_card_form__notices"))&&e.html(this.$notices_container),this.requires_async_process=!1):this.$notices_container.html("")},a.prototype.handle_form=function(e){e.preventDefault();var t=this,o=_(p(e)),e=o.closest(".add_gift_card_form"),a=e.find(".wc_gc_add_gift_card_form__notices"),n=e.find("#wc_gc_cart_code"),e=n.val();e&&(o.prop("disabled",!0),_(s.body).trigger("wc_gc_before_checkout_form_submit"),_.ajax({type:"post",url:l("apply_gift_card_to_session"),data:"wc_gc_is_checkout=true&wc_gc_cart_code="+e+"&security="+wc_gc_params.security_redeem_card_nonce,dataType:"json",success:function(e){"success"===e.result&&("yes"===e.applied&&(_(s.body).trigger("update_checkout"),t.requires_async_process=!0),t.$notices_container.html(e.notices_html),t.$notices_container.hide(),_(s.body).trigger("wc_gc_checkout_form_submit"),a.html(t.$notices_container),t.$notices_container.fadeIn("fast"),n.val("")),o.prop("disabled",!1)}}))},a.prototype.handle_remove=function(e){e.preventDefault();var t,e=_(p(e)).data("giftcard");return e&&((t=_("<input />")).prop("type","hidden"),t.prop("class","wc_gc_cart_remove_giftcards"),t.prop("name","wc_gc_cart_remove_giftcards"),t.appendTo("#order_review"),t.val(e),_(s.body).trigger("update_checkout"),setTimeout(function(){t.remove()},500)),!1},n.prototype.register_events=function(){var e=_(".woocommerce-cart");e.on("change","#use_gift_card_balance",this.handle_checkbox),e.on("click",".wc_gc_remove_gift_card",this.handle_remove),e.on("click","#wc_gc_cart_redeem_send",this.handle_submit)},n.prototype.handle_checkbox=function(e){e.preventDefault();e=!0===_(p(e)).is(":checked")?"on":"off";g(_("div.cart_totals")),_.ajax({type:"post",url:l("toggle_balance_usage"),data:"wc_gc_use_balance="+e+"&security="+wc_gc_params.security_update_use_balance_nonce,dataType:"html",success:function(e){d(_("div.cart_totals")),u(e)}})},n.prototype.handle_remove=function(e){e.preventDefault();e=_(p(e)).data("giftcard");return g(_("div.cart_totals")),_.ajax({type:"post",url:l("remove_gift_card_from_session"),data:"wc_gc_cart_id="+e+"&render_cart_fragments=1&security="+wc_gc_params.security_remove_card_nonce,dataType:"html",success:function(e){d(_("div.cart_totals")),u(e)}}),!1},n.prototype.handle_submit=function(e){e.preventDefault();var a=this,n=_(p(e)),i=n.closest(".add_gift_card_form"),c=i.find("#wc_gc_cart_code"),r=i.find(".wc_gc_add_gift_card_form__notices"),e=c.val();if(e)return n.prop("disabled",!0),g(_("div.cart_totals")),_(s.body).trigger("wc_gc_before_cart_form_submit"),_.ajax({type:"post",url:l("apply_gift_card_to_session"),data:"wc_gc_cart_code="+e+"&security="+wc_gc_params.security_redeem_card_nonce,dataType:"json",success:function(e){var t,o;"success"===e.result&&("yes"===e.applied&&(o=(t=_(e.html)).find(".add_gift_card_form"),u(t),o.length)&&(r=(i=o).find(".wc_gc_add_gift_card_form__notices")),a.$notices_container.html(e.notices_html),a.$notices_container.hide(),_(s.body).trigger("wc_gc_cart_form_submit"),r.html(a.$notices_container),a.$notices_container.fadeIn("fast"),c.val("")),d(_("div.cart_totals")),n.prop("disabled",!1)}}),!1},i.prototype.init=function(){this.$toggle_balance_balance_container=_(".wcs-gift-cards-toggle"),this.$toggle_balance_balance_container.length&&(this.$parent_container=this.$toggle_balance_balance_container.parents("tr"),this.$toggle_balance=_(".subscription-auto-renew-toggle",this.$toggle_balance_balance_container),this.$icon=this.$toggle_balance.find("i"),this.$toggle_balance_auto_renew_container=_(".wcs-auto-renew-toggle"),this.$toggle_auto_renew=_(".subscription-auto-renew-toggle",this.$toggle_balance_auto_renew_container),this.$toggle_balance.on("click",this.on_toggle),_(s).ajaxComplete(this.on_auto_renew_toggle),_(".subscription_renewal_early").on("click",this.should_reload_before_showing_modal),this.initial_status=!!this.$toggle_balance.hasClass("subscription-auto-renew-toggle--on"),this.maybe_apply_color(),this.display_toggle(
1),this.$toggle_auto_renew.length)&&!this.$toggle_auto_renew.hasClass("subscription-auto-renew-toggle--on")&&this.$parent_container.hide()},i.prototype.should_reload_before_showing_modal=function(e){return"no"===wc_gc_params.is_early_renewal_via_modal_enabled||this.$toggle_balance.hasClass("subscription-auto-renew-toggle--on")===this.initial_status||void(t.confirm(wc_gc_params.i18n_force_reload_on_changes_notice)&&(e.preventDefault(),e.stopImmediatePropagation(),t.location.reload()))},i.prototype.on_auto_renew_toggle=function(e,t,o){200===t.status&&(-1!==o.data.indexOf("action=wcs_disable_auto_renew")?this.$parent_container.hide():-1!==o.data.indexOf("action=wcs_enable_auto_renew")&&this.$parent_container.show())},i.prototype.on_toggle=function(e){var t;e.preventDefault(),this.$toggle_balance.hasClass("subscription-auto-renew-toggle--disabled")||(e=(e=function(e){"success"===e.result&&(this.toggle(),this.maybe_apply_color(),this.$toggle_balance.removeClass("subscription-auto-renew-toggle--disabled"))}).bind(this),this.$toggle_balance.addClass("subscription-auto-renew-toggle--disabled"),t={subscription_id:WCSViewSubscription.subscription_id,security:wc_gc_params.security_use_balance_renewals_nonce},_.ajax({type:"post",url:l("update_subscription_giftcards_toggle"),data:t,dataType:"json",success:e}))},i.prototype.get_text_color=function(){var e;return this.txt_color||(e=_('<a href="#" style="display:none;"></a>').appendTo(this.$toggle_balance_balance_container),this.txt_color=t.getComputedStyle(e[0]).color,e.remove()),this.txt_color},i.prototype.display_toggle=function(){this.$toggle_balance.removeClass("subscription-auto-renew-toggle--hidden")},i.prototype.hide_toggle=function(){this.$toggle_balance.addClass("subscription-auto-renew-toggle--hidden")},i.prototype.enable_toggle=function(){this.$icon.removeClass("fa-toggle-off").addClass("fa-toggle-on"),this.$toggle_balance.removeClass("subscription-auto-renew-toggle--off").addClass("subscription-auto-renew-toggle--on").attr("aria-checked","true")},i.prototype.disable_toggle=function(){this.$icon.removeClass("fa-toggle-on").addClass("fa-toggle-off"),this.$toggle_balance.removeClass("subscription-auto-renew-toggle--on").addClass("subscription-auto-renew-toggle--off").attr("aria-checked","false")},i.prototype.toggle=function(){this.$toggle_balance.hasClass("subscription-auto-renew-toggle--on")?this.disable_toggle():this.enable_toggle()},i.prototype.maybe_apply_color=function(){var e;this.$icon.length&&(e=this.$icon[0],this.$toggle_balance.hasClass("subscription-auto-renew-toggle--on")?(e.style.backgroundColor=this.get_text_color(),e.style.borderColor=this.get_text_color()):(e.style.backgroundColor=null,e.style.borderColor=null))},_.fn.wc_gc_datepickers=function(){_(this).find(".datepicker").each(function(){var e,o=_(this),t=o.parent(),a=t.find(".reset_delivery_date"),n=t.find('input[name="wc_gc_giftcard_delivery"]'),i=t.find('input[name="_wc_gc_giftcard_delivery_gmt_offset"]'),t=(i.length||((i=_("<input/>")).attr("type","hidden"),i.attr("name","_wc_gc_giftcard_delivery_gmt_offset"),t.append(i)),new Date),c=parseFloat(wc_gc_params.gmt_offset,10),r=t.getTimezoneOffset()/60,s=r-c,i=("default"===wc_gc_params.date_input_timezone_reference?(i.val(r),e="+1D"):"store"===wc_gc_params.date_input_timezone_reference&&(s=t.getHours()+t.getMinutes()/60+s,i.val(c),e=24<=s?"+"+(Math.floor(s/24)+1)+"D":s<=0?0:"+1D"),o.datepicker({beforeShow:function(e,t){wc_gc_params.datepicker_class&&(_("#ui-datepicker-div").removeClass(wc_gc_params.datepicker_class),_("#ui-datepicker-div").addClass(wc_gc_params.datepicker_class))},minDate:e,dateFormat:wc_gc_params.datepicker_date_format}),o.datepicker("getDate"));null!==i&&"function"==typeof i.getTime&&(i.setHours(t.getHours(),t.getMinutes()),"store"===wc_gc_params.date_input_timezone_reference&&(i=h(i,-1*r*60),i=h(i,60*c)),n.val(i.getTime()/1e3),a.show()),o.on("change",function(){var e,t=o.datepicker("getDate");null!==t&&"function"==typeof t.getTime?(e=new Date,t.setHours(e.getHours(),e.getMinutes()),"store"===wc_gc_params.date_input_timezone_reference&&(t=h(t,-1*r*60),t=h(t,60*c)),n.val(t.getTime()/1e3),a.show()):(a.hide(),n.val(""))}),a.on("click",function(e){e.preventDefault(),n.val(""),o.val("").trigger("change")})})},t.WC_GC=new o)})(jQuery,document,window);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.