laipower/wp-content/plugins/easy-digital-downloads/assets/js/edd-admin-licensing.js

1 line
2.8 KiB
JavaScript

!function(e){var t={};function a(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,a),i.l=!0,i.exports}a.m=e,a.c=t,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)a.d(n,i,function(t){return e[t]}.bind(null,i));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=229)}({1:function(e,t){e.exports=jQuery},229:function(e,t,a){(function(e){!function(e,t){"use strict";t("p.submit").remove(),t(".edd-license__control").on("click",".edd-license__action",(function(e){e.preventDefault();var a=t(this),n=a.attr("data-action"),i="",r=a.text(),d=t(this).closest(".edd-license__control"),s=d.find("input");if(!a.attr("disabled")){switch(n){case"activate":i="edd_activate_extension_license",a.text(EDDLicenseHandler.activating);break;case"deactivate":i="edd_deactivate_extension_license",a.text(EDDLicenseHandler.deactivating);break;default:return}a.removeClass("button-primary").attr("disabled",!0).addClass("updating-message");var o={action:i,token:a.attr("data-token"),timestamp:a.attr("data-timestamp"),nonce:a.attr("data-nonce"),license:s.val(),item_id:s.attr("data-item"),item_name:s.attr("data-name"),key:s.attr("data-key")};t.post(ajaxurl,o).done((function(e){console.log(e),a.text(r);var t=d.next(".edd-license-data");e.success?(e.data.actions&&d.find(".edd-licensing__actions").replaceWith(e.data.actions),e.data.message&&("deactivate"===n?t.find("p").replaceWith(e.data.message):t.replaceWith(e.data.message)),o.license.length&&"activate"===n?s.attr("readonly",!0):s.attr("readonly",!1)):t.find("p").replaceWith(e.data.message),a.attr("disabled",!1).removeClass("updating-message")}))}})),t(".edd-license__control").on("click",".edd-license__delete",(function(e){e.preventDefault();var a=t(this),n=t(this).closest(".edd-license__control"),i=n.find("input"),r={action:"edd_delete_extension_license",token:a.attr("data-token"),timestamp:a.attr("data-timestamp"),nonce:a.attr("data-nonce"),license:i.val(),item_name:i.attr("data-name")};a.attr("disabled",!0).addClass("updating-message"),i.val(""),t.post(ajaxurl,r).done((function(e){e.success&&a.hide(),n.next(".edd-license-data").find("p").replaceWith(e.data.message),a.attr("disabled",!1).removeClass("updating-message")}))}))}(document,e)}).call(this,a(1))}});