| Current Path : /home/juvelize/martine/tmp/install_61b0f5c54c150/media/js/vue/ |
| Current File : /home/juvelize/martine/tmp/install_61b0f5c54c150/media/js/vue/available_plugins.min.js |
jQuery(document).ready(function(e){if(e("#acym__plugin__available__application").length>0){new Vue({directives:{infiniteScroll:infiniteScroll},el:"#acym__plugin__available__application",data:{allPlugins:[],displayedPlugins:[1],search:acym_helper.getCookie("acym_available_plugins_search"),type:acym_helper.getCookie("acym_available_plugins_type"),level:acym_helper.getCookie("acym_available_plugins_level"),loading:!0,noPluginTodisplay:!1,typingTimer:"",doneTypingInterval:1e3,currentLevel:"",downloading:{},allPluginsInstalled:{},pageDisplay:1,busy:!1,installed:{}},mounted:function(){this.getAllPlugins().then(i=>{if(void 0!==(i=acym_helper.parseJson(i)).error)return acym_helperNotification.addNotification(i.error,"error"),!1;acym_helperBack.config_get("level").done(l=>{if(l.error)return acym_helperNotification.addNotification(l.message,"error"),!1;this.getAllPluginsInstalled().then(t=>{this.allPluginsInstalled=t.elements,this.currentLevel=l.data.value.toLowerCase(),this.allPlugins=i,i=i.map(e=>{e.description=e.description.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1<br />")}),this.setStatus(),this.resetDisplay(),e('[name="acym__plugins__level"], [name="acym__plugins__type"]').select2({theme:"foundation",width:"100%"}),0===this.displayedPlugins.length&&(this.noPluginTodisplay=!0),this.loading=!1,setTimeout(()=>{this.$forceUpdate(),acym_helperTooltip.setTooltip()},400)})})})},methods:{getAllPlugins(){if("joomla"===ACYM_CMS){let i=AJAX_URL_UPDATEME+"integrationv6&task=getAllPlugin&cms="+ACYM_CMS;return e.post(i)}if("wordpress"===ACYM_CMS)return Promise.resolve(e("#acym__plugin__available__plugins").val())},getAllPluginsInstalled(){let i=ACYM_AJAX_URL+"&ctrl=plugins&task=getAllPluginsAjax";return e.ajax({type:"POST",url:i,dataType:"json"})},download(i){if(this.downloading[i.image])return!0;this.downloading[i.image]=!0,this.downloading={...this.downloading};let l=ACYM_AJAX_URL+"&ctrl=plugins&task=download";e.ajax({url:l,type:"POST",data:{plugin:i}}).then(e=>{if((e=acym_helper.parseJson(e)).error)return acym_helperNotification.addNotification(e.message,"error"),this.downloading[i.image]=!1,this.downloading={...this.downloading},!1;acym_helperNotification.addNotification(e.message,"info"),this.downloading[i.image]=!1,this.installed[i.image]=!0})},resetDisplay(){this.pageDisplay=1,this.fillDisplayPlugins()},fillDisplayPlugins(){this.displayedPlugins=this.filter().slice(0,18*this.pageDisplay),this.displayedPlugins=[...this.displayedPlugins]},rightLevel(e){return"starter"===e||("essential"===e&&-1!==["essential","enterprise"].indexOf(this.currentLevel)||"enterprise"===e&&"enterprise"===this.currentLevel)},ucfirst:e=>void 0===e?"":e.charAt(0).toUpperCase()+e.slice(1),setStatus(){for(let e in this.allPlugins)this.downloading[this.allPlugins[e].image]=!1,this.installed[this.allPlugins[e].image]=this.isInstalled(this.allPlugins[e].name)},isInstalled(e){return void 0!==this.allPluginsInstalled.find(i=>i.title==e)},filter(){return this.allPlugins.filter(e=>-1!==e.level.toLowerCase().indexOf(this.level.toLowerCase())&&-1!==e.category.toLowerCase().indexOf(this.type.toLowerCase())&&-1!==e.name.toLowerCase().indexOf(this.search.toLowerCase()))},handlePluginsInstalled(e){return void 0===this.allPluginsInstalled?e:e.filter(e=>-1===this.allPluginsInstalled.map(i=>e.file_name.replace(".zip","")===i.folder_name).indexOf(!0))},loadMorePlugins(){this.pageDisplay++,this.fillDisplayPlugins()},imageUrl:e=>void 0===e?"":"joomla"===ACYM_CMS?(e=e.substring(0,e.indexOf(".")),AJAX_URL_UPDATEME+"integrationv6&task=getImage&plugin="+e):"wordpress"===ACYM_CMS?ACYM_MEDIA_URL+"images/plugins/"+e:void 0,isOverflown(e){return void 0===this.$refs.plugins||void 0===this.$refs.plugins[e]?"":this.$refs.plugins[e].scrollHeight>this.$refs.plugins[e].clientHeight?"acym__plugins__card__params_desc__overflown":""}},watch:{displayedPlugins(e,i){this.noPluginTodisplay=0===this.displayedPlugins.length&&1!==i[0]},search(e){clearTimeout(this.typingTimer),document.cookie="acym_available_plugins_search="+e+";",""===e?this.resetDisplay():this.typingTimer=setTimeout(()=>{this.resetDisplay()},this.doneTypingInterval)},type(){document.cookie="acym_available_plugins_type="+this.type+";",this.resetDisplay()},level(){document.cookie="acym_available_plugins_level="+this.level+";",this.resetDisplay()}}})}});