Hacked By AnonymousFox
!function(e){var o={};function t(s){if(o[s])return o[s].exports;var n=o[s]={i:s,l:!1,exports:{}};return e[s].call(n.exports,n,n.exports,t),n.l=!0,n.exports}t.m=e,t.c=o,t.d=function(e,o,s){t.o(e,o)||Object.defineProperty(e,o,{enumerable:!0,get:s})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,o){if(1&o&&(e=t(e)),8&o)return e;if(4&o&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(t.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&o&&"string"!=typeof e)for(var n in e)t.d(s,n,function(o){return e[o]}.bind(null,n));return s},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,o){return Object.prototype.hasOwnProperty.call(e,o)},t.p="",t(t.s=2)}([,,function(e,o,t){e.exports=t(3)},function(e,o){var t=window.jQuery,s=window.documentor_admin_vars,n=s.__;function r(e){var o=Object.assign([],e),t={0:{name:"",docs:[]}};return o.forEach((function(e){t["".concat(e.post.cat_id)]||(t["".concat(e.post.cat_id)]={name:e.post.cat_name,docs:[]}),t[e.post.cat_id].docs.push(e)})),t}"undefined"!=typeof swal&&swal.setDefaults({animation:!1}),Vue.directive("sortable",{bind:function(e){var o=t(e);o.sortable({stop:function(e,o){var n=[];t(o.item.closest("ul")).children("li").each((function(e,o){n.push(t(o).data("id"))})),wp.ajax.post({action:"documentor_sortable_docs",ids:n,_wpnonce:s.nonce})},cursor:"move"}),o.on("mousedown",(function(){t(this).css("min-height",t(this).height())})),o.on("mouseup",(function(){t(this).css("min-height","")}))}}),new Vue({el:"#documentor-app",data:{editurl:"",viewurl:"",docs:[],categorized:[]},mounted:function(){var e=this,o=t(e.$el);this.editurl=s.editurl,this.viewurl=s.viewurl,t.get(ajaxurl,{action:"documentor_admin_get_docs",_wpnonce:s.nonce},(function(t){var s=t.data;o.find(".documentor").removeClass("not-loaded").addClass("loaded"),o.find(".spinner").remove(),o.find(".no-documentor").removeClass("not-loaded"),e.docs=Object.assign([],s),e.categorized=r(s)}))},methods:{onError:function(e){swal({title:"Error!",text:e.statusText||e.responseText||e,type:"error",closeOnConfirm:!0,customClass:"documentor-swal"}),console.log(e)},addDoc:function(){var e=this;this.docs=this.docs||[],swal({title:n.enter_doc_title,type:"input",showCancelButton:!0,closeOnConfirm:!1,showLoaderOnConfirm:!0,inputPlaceholder:n.enter_doc_title,customClass:"documentor-swal"},(function(o){if(!1===o)return swal.close(),!1;wp.ajax.send({data:{action:"documentor_create_doc",title:o,parent:0,_wpnonce:s.nonce},success:function(o){e.docs.unshift(o),e.categorized=r(e.docs),swal.close()},error:e.onError})}))},cloneDoc:function(e){var o=this;this.docs=this.docs||[],swal({title:n.enter_doc_title,type:"input",showCancelButton:!0,closeOnConfirm:!1,showLoaderOnConfirm:!0,inputPlaceholder:n.enter_doc_title,inputValue:n.clone_default_title.replace("%s",e.post.title),customClass:"documentor-swal"},(function(t){if(!1===t)return swal.close(),!1;wp.ajax.send({data:{action:"documentor_clone_doc",title:t,clone_from:e.post.id,_wpnonce:s.nonce},success:function(e){o.docs.unshift(e),o.categorized=r(o.docs),swal.close()},error:o.onError})}))},removeDoc:function(e,o){var t=this;swal({title:n.remove_doc_title,text:n.remove_doc_text,type:"warning",showCancelButton:!0,confirmButtonText:n.remove_doc_button_yes,closeOnConfirm:!1,showLoaderOnConfirm:!0,customClass:"documentor-swal"},(function(){t.removePost(e,o)}))},exportDoc:function(e){var o=this;swal({html:!0,title:n.clone_default_title.replace("%s","<strong>"+e.post.title+"</strong>"),text:n.export_doc_text,type:"info",showCancelButton:!0,confirmButtonText:n.export_doc_button_yes,closeOnConfirm:!1,customClass:"documentor-swal"},(function(){swal({html:!0,title:n.exporting_doc_title,text:'<div class="documentor-export-response">'+n.exporting_doc_text+'</div><div class="documentor-export-progress"><div class="documentor-export-progress-bar"></div></div>',type:"info",showCancelButton:!0,showConfirmButton:!1,closeOnCancel:!1,customClass:"documentor-swal"},(function(){i.close(),swal.close()}));var s=t(".documentor-export-response"),r=t(".documentor-export-progress .documentor-export-progress-bar"),c=0,i=new window.EventSource(ajaxurl+"?action=documentor_export_doc&doc_id="+e.post.id);i.onmessage=function(e){var o=JSON.parse(e.data);switch(console.log(o),o.action){case"message":c++,s.text(o.message),r.css("width",100*c/o.max_delta+"%");break;case"complete":i.close(),swal({html:!0,title:n.exported_doc_title,text:'<a class="button button-primary button-hero" href="'+o.message+'">'+n.exported_doc_download+"</a>",type:"success",showCancelButton:!0,showConfirmButton:!1,closeOnCancel:!1,cancelButtonText:n.exported_doc_cancel,customClass:"documentor-swal"},(function(){swal.close()}))}},i.onerror=function(){o.onError(this),i.close()}}))},addSection:function(e){var o=this;swal({title:n.enter_section_title,type:"input",showCancelButton:!0,closeOnConfirm:!1,showLoaderOnConfirm:!0,inputPlaceholder:n.enter_section_title,customClass:"documentor-swal"},(function(t){if(!1===t)return swal.close(),!1;(t=t.trim())&&wp.ajax.send({data:{action:"documentor_create_doc",title:t,parent:e.post.id,order:e.child.length,_wpnonce:s.nonce},success:function(o){e.child.push(o),swal.close()},error:o.onError})}))},removeSection:function(e,o){var t=this;swal({title:n.remove_section_title,text:n.remove_section_text,type:"warning",showCancelButton:!0,confirmButtonText:n.remove_section_button_yes,closeOnConfirm:!1,showLoaderOnConfirm:!0,customClass:"documentor-swal"},(function(){t.removePost(e,o)}))},addArticle:function(e,o){var r=o,c=this;swal({title:n.enter_doc_title,type:"input",showCancelButton:!0,closeOnConfirm:!1,showLoaderOnConfirm:!0,inputPlaceholder:n.enter_doc_title,customClass:"documentor-swal"},(function(o){if(!1===o)return swal.close(),!1;wp.ajax.send({data:{action:"documentor_create_doc",title:o,parent:e.post.id,status:"draft",order:e.child.length,_wpnonce:s.nonce},success:function(o){e.child.push(o);var s=t(r.target).closest(".section-title").next();s.hasClass("collapsed")&&s.removeClass("collapsed"),swal.close()},error:c.onError})}))},removeArticle:function(e,o){var t=this;swal({title:n.remove_article_title,text:n.remove_article_text,type:"warning",showCancelButton:!0,confirmButtonText:n.remove_article_button_yes,closeOnConfirm:!1,showLoaderOnConfirm:!0,customClass:"documentor-swal"},(function(){t.removePost(e,o)}))},removePost:function(e,o){var t=this,n=o[e].post.id;wp.ajax.send({data:{action:"documentor_remove_doc",id:n,_wpnonce:s.nonce},success:function(){t.docs=function e(o,t){for(var s=0;s<o.length;s++)o[s].post.id===t?o.splice(s,1):o[s].child&&o[s].child.length&&(o[s].child=e(o[s].child,t));return o}(t.docs,n),t.categorized=r(t.docs),swal.close()},error:t.onError})},toggleCollapse:function(e){t(e.target).siblings("ul.articles").toggleClass("collapsed")}}})}]);
Hacked By AnonymousFox1.0, Coded By AnonymousFox