PageSourceSearch

https://www.elephanttrust.org/wp-content/plugins/woocommerce-gift-…/js/frontend/wc-gc-main.min.js?ver=1.7.4

js elephanttrust.org collected 2026-10-02 05:06:33 UTC 11,101 bytes, 1 lines download raw bytes

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