| 1 |
let TF_License;((t,e,i)=>{"use strict";TF_License={el:null,init(){if(this.el||(this.el=i.tfId("license-modal")),this.el){const t=themify_js_vars.license,e=this.el.querySelector('[name="themify_username"]'),i=this.el.querySelector('[name="updater_licence"]');e&&(e.value=t.username||"",i.value=t.key||"")}else{this.el=i.createElement("div");const t=themify_js_vars.license,e=i.createElement("h2"),s=i.createElement("p"),n=i.createElement("p"),a=i.createElement("p"),h=i.createElement("p"),o=i.createElement("span"),c=i.createElement("span"),r=i.createElement("input"),m=i.createElement("input"),_=i.createElement("a"),f=i.createElement("a"),u=i.createElement("i"),l=i.tfId("themify")||i.body;this.el.className="themify-modal tf_opacity tf_hide",this.el.id="license-modal",e.innerHTML=t.title,s.innerHTML=t.link,o.textContent=t.labels.name,c.textContent=t.labels.key,_.textContent=t.labels.update,m.value=t.key||"",r.value=t.username||"",r.name="themify_username",m.name="updater_licence",r.type=m.type="text",r.autocomplete=m.autocomplete="off",c.className=o.className="label",f.href=_.href="#",_.className="update-license button big-button themify_button",f.className="close",u.className="tf_close",n.append(o,r),a.append(c,m),h.appendChild(_),f.appendChild(u),this.el.append(e,s,n,a,h,f),f.tfOn("click",(t=>{t.preventDefault(),t.stopPropagation(),this.close()})),l.appendChild(this.el)}return this.show()},show(){return new Promise((t=>{this.el.classList.contains("tf_opacity")?(this.el.classList.remove("tf_hide"),requestAnimationFrame((()=>{this.el.tfOn("transitionend",t,{passive:!0,once:!0}).classList.remove("tf_opacity")}))):t()}))},close(){return new Promise((t=>{this.el.tfOn("transitionend",(e=>{this.el.classList.add("tf_hide"),t()}),{passive:!0,once:!0}).classList.add("tf_opacity")}))},async update(){await t.loadJs(t.url+"js/admin/notification",!!e.TF_Notification);try{const e=this.el.querySelector('[name="themify_username"]').value,i=this.el.querySelector('[name="updater_licence"]').value,s={action:"themify_update_license",nonce:themify_js_vars.nonce,themify_username:e,updater_licence:i};if(""===e||""===i)throw Error(themify_js_vars.empty_li);const n=await t.fetch(s);if(!n.success)throw Error(n.data);await this.close()}catch(t){throw TF_Notification.showHide("error",t,3e3),t}}}})(Themify,window,document); |