-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathdeactivate.js
More file actions
1 lines (1 loc) · 5.75 KB
/
deactivate.js
File metadata and controls
1 lines (1 loc) · 5.75 KB
1
!function(t){var e={};function o(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,o),i.l=!0,i.exports}o.m=t,o.c=e,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)o.d(n,i,function(e){return t[e]}.bind(null,i));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=158)}({11:function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var o=0,n=new Array(e);o<e;o++)n[o]=t[o];return n},t.exports.default=t.exports,t.exports.__esModule=!0},158:function(t,e,o){"use strict";o.r(e);var n=o(9),i=o.n(n),a={modal:document.getElementById("cloudinary-deactivation"),modalBody:document.getElementById("modal-body"),modalFooter:document.getElementById("modal-footer"),modalUninstall:document.getElementById("modal-uninstall"),modalClose:document.querySelectorAll('button[data-action="cancel"], button[data-action="close"]'),pluginListLinks:document.querySelectorAll(".cld-deactivate-link, .cld-deactivate"),triggers:document.getElementsByClassName("cld-deactivate"),options:document.querySelectorAll('.cloudinary-deactivation .reasons input[type="radio"]'),report:document.getElementById("cld-report"),contact:document.getElementById("cld-contact"),submitButton:document.querySelectorAll('.cloudinary-deactivation button[data-action="submit"]'),contactButton:document.querySelectorAll('.cloudinary-deactivation button[data-action="contact"]'),deactivateButton:document.querySelectorAll('.cloudinary-deactivation button[data-action="deactivate"]'),emailField:document.getElementById("email"),reason:"",more:null,deactivationUrl:"",email:"",isCloudinaryOnly:!1,addEvents:function(){var t=this;if(i()(t.modalClose).forEach((function(e){e.addEventListener("click",(function(e){t.closeModal()}))})),window.addEventListener("keyup",(function(e){"visible"===t.modal.style.visibility&&"Escape"===e.key&&(t.modal.style.visibility="hidden",t.modal.style.opacity="0")})),t.modal.addEventListener("click",(function(e){e.stopPropagation(),e.target===t.modal&&t.closeModal()})),i()(t.pluginListLinks).forEach((function(e){e.addEventListener("click",(function(e){e.preventDefault(),t.deactivationUrl=e.target.getAttribute("href"),t.openModal()}))})),i()(t.contactButton).forEach((function(e){e.addEventListener("click",(function(){t.emailField&&(t.email=t.emailField.value),t.submit()}))})),i()(t.deactivateButton).forEach((function(e){e.addEventListener("click",(function(){window.location.href=t.deactivationUrl}))})),i()(t.options).forEach((function(e){e.addEventListener("change",(function(e){t.reason=e.target.value,t.more=e.target.parentNode.querySelector("textarea")}))})),t.contact&&t.report.addEventListener("change",(function(){t.report.checked?t.contact.parentNode.removeAttribute("style"):t.contact.parentNode.style.display="none"})),i()(t.submitButton).forEach((function(e){e.addEventListener("click",(function(){var e=document.querySelector('.cloudinary-deactivation .data input[name="option"]:checked'),o="";e&&(o=e.value),"uninstall"===o&&(t.modalBody.style.display="none",t.modalFooter.style.display="none",t.modalUninstall.style.display="block"),t.submit(o)}))})),this.isCloudinaryOnly){var e=document.getElementById("cld-bypass-cloudinary-only");e.addEventListener("change",function(t){this.modal.dataset.cloudinaryOnly=!e.checked}.bind(this))}},closeModal:function(){document.body.style.removeProperty("overflow"),this.modal.style.visibility="hidden",this.modal.style.opacity="0"},openModal:function(){document.body.style.overflow="hidden",this.modal.style.visibility="visible",this.modal.style.opacity="1"},submit:function(){var t,e,o,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";wp.ajax.send({url:CLD_Deactivate.endpoint,data:{reason:this.reason,more:null===(t=this.more)||void 0===t?void 0:t.value,report:null===(e=this.report)||void 0===e?void 0:e.checked,contact:null===(o=this.contact)||void 0===o?void 0:o.checked,email:this.email,dataHandling:n},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",CLD_Deactivate.nonce)}}).always((function(){window.location.reload()}))},init:function(){this.isCloudinaryOnly=!!this.modal.dataset.cloudinaryOnly,this.addEvents()}};a.init(),e.default=a},17:function(t,e,o){var n=o(11);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?n(t,e):void 0}},t.exports.default=t.exports,t.exports.__esModule=!0},39:function(t,e,o){var n=o(11);t.exports=function(t){if(Array.isArray(t))return n(t)},t.exports.default=t.exports,t.exports.__esModule=!0},40:function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.default=t.exports,t.exports.__esModule=!0},41:function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.default=t.exports,t.exports.__esModule=!0},9:function(t,e,o){var n=o(39),i=o(40),a=o(17),r=o(41);t.exports=function(t){return n(t)||i(t)||a(t)||r()},t.exports.default=t.exports,t.exports.__esModule=!0}});