Current File : /home/pacjaorg/.trash/media.1/com_cpanel/js/admin-cpanel-default.min.js |
/**
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/const debounce=(i,r=250,t)=>(...d)=>clearTimeout(t,t=setTimeout(i,r,...d));((i,r,t)=>{t.unpublishModule=e=>{const s="index.php?option=com_modules&task=modules.unpublish&format=json",o=e.getAttribute("data-module-id");t.request({url:`${s}&cid=${o}`,method:"POST",headers:{"Content-Type":"application/json"},onSuccess:()=>{const n=e.closest(".module-wrapper");n.parentNode.removeChild(n),t.renderMessages({message:[t.Text._("COM_CPANEL_UNPUBLISH_MODULE_SUCCESS")]})},onError:()=>{t.renderMessages({error:[t.Text._("COM_CPANEL_UNPUBLISH_MODULE_ERROR")]})}})};const d=()=>{const e=r.getElementById("content");e&&e.querySelectorAll(".unpublish-module").forEach(s=>{s.addEventListener("click",({target:o})=>t.unpublishModule(o))}),r.removeEventListener("DOMContentLoaded",d)};r.addEventListener("DOMContentLoaded",d),{$gridBox:null,gridAutoRows:0,gridRowGap:10,resizeGridItem(e,s,o){const n=e.querySelector(".card");if(n){const l=n.getBoundingClientRect().height+o,a=Math.ceil(l/(s+o));e.style.gridRowEnd=`span ${a}`}},resizeAllGridItems(){[].slice.call(this.$gridBox.children).forEach(s=>this.resizeGridItem(s,this.gridAutoRows,this.gridRowGap))},initialise(){this.$gridBox=r.querySelector("#cpanel-modules .card-columns");const e=i.getComputedStyle(this.$gridBox);this.gridAutoRows=parseInt(e.getPropertyValue("grid-auto-rows"),10)||this.gridAutoRows,this.gridRowGap=parseInt(e.getPropertyValue("grid-row-gap"),10)||this.gridRowGap,this.resizeAllGridItems(),i.addEventListener("load",()=>this.resizeAllGridItems()),i.addEventListener("joomla:menu-toggle",()=>{setTimeout(()=>this.resizeAllGridItems(),330)}),i.addEventListener("resize",debounce(()=>this.resizeAllGridItems(),50))}}.initialise()})(window,document,window.Joomla);