Current File : /home/pacjaorg/public_html/kmm/media/plg_installer_webinstaller/js/client.min.js
/**
 * @copyright  (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */if(!Joomla)throw new Error("Joomla API is not properly initialised");const allowList={button:["type"],input:["type","name","placeholder","inputmode"],select:["name"],option:["value","selected"]},webInstallerOptions={view:"dashboard",id:0,ordering:"",version:"current",list:0,options:Joomla.getOptions("plg_installer_webinstaller",{})};let instance;class WebInstaller{initialise(){webInstallerOptions.loaded=1,document.getElementById("uploadform-web-cancel").addEventListener("click",()=>{document.getElementById("uploadform-web").classList.add("hidden"),webInstallerOptions.list&&document.querySelector(".list-view")&&document.querySelector(".list-view").click()}),document.getElementById("uploadform-web-install").addEventListener("click",()=>{webInstallerOptions.options.installFrom===4?this.submitButtonUrl():this.submitButtonWeb()}),this.loadweb(`${webInstallerOptions.options.base_url}index.php?format=json&option=com_apps&view=dashboard`),this.clickforlinks()}loadweb(e){if(!e)return!1;const t=new RegExp(webInstallerOptions.options.base_url),o=/^index\.php/;if(!(t.test(e)||o.test(e)))return window.open(e,"_blank"),!1;let s=`${e}&product=${webInstallerOptions.options.product}&release=${webInstallerOptions.options.release}&dev_level=${webInstallerOptions.options.dev_level}&list=${webInstallerOptions.list?"list":"grid"}&lang=${webInstallerOptions.options.language}`;const u=document.getElementById("com-apps-ordering"),p=document.getElementById("com-apps-filter-joomla-version");return webInstallerOptions.ordering!==""&&u&&u.value&&(webInstallerOptions.ordering=u.value,s+=`&ordering=${webInstallerOptions.ordering}`),webInstallerOptions.version!==""&&p&&p.value&&(webInstallerOptions.version=p.value,s+=`&filter_version=${webInstallerOptions.version}`),WebInstaller.showLoadingLayer(),new Promise((d,n)=>{Joomla.request({url:s,onSuccess:i=>{let l;try{l=JSON.parse(i)}catch{throw new Error("Failed to parse JSON")}document.getElementById("web-loader")&&document.getElementById("web-loader").classList.add("hidden");const a=document.getElementById("jed-container");a.innerHTML=Joomla.sanitizeHtml(l.data.html,allowList),document.getElementById("com-apps-searchbox").addEventListener("keypress",({which:r})=>{r===13&&this.initiateSearch()}),document.getElementById("search-extensions").addEventListener("click",()=>{this.initiateSearch()}),document.getElementById("search-reset").addEventListener("click",()=>{const r=document.getElementById("com-apps-searchbox");r.value="",this.initiateSearch(),document.getElementById("search-reset").setAttribute("disabled","disabled")}),document.getElementById("com-apps-searchbox").value===""&&document.getElementById("search-reset").setAttribute("disabled","disabled"),document.getElementById("search-reset").innerHTML=Joomla.sanitizeHtml(Joomla.Text._("JSEARCH_FILTER_CLEAR"));const c=document.getElementById("com-apps-ordering"),m=document.getElementById("com-apps-filter-joomla-version");c&&c.addEventListener("change",()=>{const r=c.selectedIndex;webInstallerOptions.ordering=c.options[r].value,this.installfromwebajaxsubmit()}),m&&m.addEventListener("change",()=>{const r=m.selectedIndex;webInstallerOptions.version=m.options[r].value,this.installfromwebajaxsubmit()}),webInstallerOptions.options.installfrom_url!==""&&WebInstaller.installfromweb(webInstallerOptions.options.installfrom_url),d()},onError:i=>{const l=document.getElementById("web-loader-error"),a=document.getElementById("web-loader");i.responseText&&l&&(l.innerHTML=Joomla.sanitizeHtml(i.responseText)),a&&(a.classList.add("hidden"),l.classList.remove("hidden")),Joomla.renderMessages({danger:[Joomla.Text._("PLG_INSTALLER_WEBINSTALLER_INSTALL_WEB_LOADING_ERROR")]},"#web-loader-error"),n()}})}).finally(()=>{const d=document.getElementById("joomlaapsinstallatinput");if(d&&(d.value=webInstallerOptions.options.installat_url),this.clickforlinks(),WebInstaller.clicker(),webInstallerOptions.view!=="extension"&&[].slice.call(document.querySelectorAll("div.load-extension")).forEach(n=>{n.addEventListener("click",i=>{i.preventDefault(),this.processLinkClick(n.getAttribute("data-url"))}),n.setAttribute("href","#")}),webInstallerOptions.view==="extension"){const n=document.getElementById("install-extension"),i=document.getElementById("install-extension-from-external");n&&n.addEventListener("click",()=>{WebInstaller.installfromweb(n.getAttribute("data-downloadurl"),n.getAttribute("data-name")),document.getElementById("uploadform-web-install").scrollIntoView({behavior:"smooth",block:"start"})}),i&&i.addEventListener("click",()=>{const l=i.getAttribute("data-downloadurl");window.confirm(Joomla.Text._("PLG_INSTALLER_WEBINSTALLER_REDIRECT_TO_EXTERNAL_SITE_TO_INSTALL").replace("[SITEURL]",l))===!0&&(document.getElementById("adminForm").setAttribute("action",l),document.querySelector("input[name=task]").setAttribute("disabled",!0),document.querySelector("input[name=install_directory]").setAttribute("disabled",!0),document.querySelector("input[name=install_url]").setAttribute("disabled",!0),document.querySelector("input[name=installtype]").setAttribute("disabled",!0),document.querySelector("input[name=filter_search]").setAttribute("disabled",!0),document.getElementById("adminForm").submit())})}webInstallerOptions.list&&document.querySelector(".list-view")&&document.querySelector(".list-view").click(),WebInstaller.hideLoadingLayer()}),!0}clickforlinks(){[].slice.call(document.querySelectorAll("a.transcode")).forEach(e=>{const t=e.getAttribute("href");e.addEventListener("click",o=>{o.preventDefault(),this.processLinkClick(t)}),e.setAttribute("href","#")})}initiateSearch(){document.getElementById("search-reset").removeAttribute("disabled"),webInstallerOptions.view="dashboard",this.installfromwebajaxsubmit()}installfromwebajaxsubmit(){let e=`&view=${webInstallerOptions.view}`;if(webInstallerOptions.id&&(e+=`&id=${webInstallerOptions.id}`),document.getElementById("com-apps-searchbox").value){const s=encodeURI(document.getElementById("com-apps-searchbox").value.toLowerCase().replace(/ +/g,"_").replace(/[^a-z0-9-_]/g,"").trim());e+=`&filter_search=${s}`}const t=document.getElementById("com-apps-ordering"),o=document.getElementById("com-apps-filter-joomla-version");webInstallerOptions.ordering!==""&&t&&t.value&&(webInstallerOptions.ordering=t.value),webInstallerOptions.ordering&&(e+=`&ordering=${webInstallerOptions.ordering}`),webInstallerOptions.version!==""&&o&&o.value&&(webInstallerOptions.version=o.value),webInstallerOptions.version&&(e+=`&filter_version=${webInstallerOptions.version}`),this.loadweb(`${webInstallerOptions.options.base_url}index.php?format=json&option=com_apps${e}`)}processLinkClick(e){const t=new RegExp(webInstallerOptions.options.base_url),o=/^index\.php/;t.test(e)||o.test(e)?(webInstallerOptions.view=e.replace(/^.+[&?]view=(\w+).*$/,"$1"),webInstallerOptions.view==="dashboard"?webInstallerOptions.id=0:webInstallerOptions.view==="category"&&(webInstallerOptions.id=e.replace(/^.+[&?]id=(\d+).*$/,"$1")),this.loadweb(webInstallerOptions.options.base_url+e)):this.loadweb(e)}static showLoadingLayer(){document.getElementById("web").appendChild(document.createElement("joomla-core-loader"))}static hideLoadingLayer(){const e=document.querySelector("#web joomla-core-loader");e.parentNode.removeChild(e)}static clicker(){document.querySelector(".grid-view")&&document.querySelector(".grid-view").addEventListener("click",()=>{webInstallerOptions.list=0,document.querySelector(".list-container").classList.add("hidden"),document.querySelector(".grid-container").classList.remove("hidden"),document.getElementById("btn-list-view").classList.remove("active"),document.getElementById("btn-grid-view").classList.remove("active")}),document.querySelector(".list-view")&&document.querySelector(".list-view").addEventListener("click",()=>{webInstallerOptions.list=1,document.querySelector(".grid-container").classList.add("hidden"),document.querySelector(".list-container").classList.remove("hidden"),document.getElementById("btn-grid-view").classList.remove("active"),document.getElementById("btn-list-view").classList.add("active")})}static installfromweb(e,t=null){return e?(document.getElementById("install_url").value=e,document.getElementById("uploadform-web-url").innerText=e,t?(document.getElementById("uploadform-web-name").innerText=t,document.getElementById("uploadform-web-name-label").classList.remove("hidden")):document.getElementById("uploadform-web-name-label").classList.add("hidden"),document.getElementById("uploadform-web").classList.remove("hidden"),!0):(Joomla.renderMessages({warning:[Joomla.Text._("PLG_INSTALLER_WEBINSTALLER_CANNOT_INSTALL_EXTENSION_IN_PLUGIN")]}),!1)}submitButtonUrl(){const e=document.getElementById("adminForm");if(e.install_url.value===""||e.install_url.value==="http://"||e.install_url.value==="https://")Joomla.renderMessages({warning:[Joomla.Text._("COM_INSTALLER_MSG_INSTALL_ENTER_A_URL")]});else{const t=document.getElementById("loading");t&&t.classList.remove("hidden"),e.installtype.value="url",e.submit()}}submitButtonWeb(){const e=document.getElementById("adminForm");e.install_url.value!==""||e.install_url.value!=="http://"||e.install_url.value!=="https://"?this.submitButtonUrl():e.install_url.value===""?Joomla.renderMessages({warning:[Joomla.apps.options.btntxt]}):(document.querySelector("#appsloading").classList.remove("hidden"),e.installtype.value="web",e.submit())}}customElements.whenDefined("joomla-tab").then(()=>{const e=document.getElementById("myTab").querySelector("button[aria-controls=web]");e&&(webInstallerOptions.options.installfromon&&e.click(),e.hasAttribute("aria-expanded")&&e.getAttribute("aria-expanded")==="true"&&!instance&&(instance=new WebInstaller,instance.initialise()),webInstallerOptions.options.installfrom_url!==""&&e.click(),e.addEventListener("joomla.tab.shown",()=>{instance||(instance=new WebInstaller,instance.initialise())}))});
Site is undergoing maintenance

PACJA Events

Maintenance mode is on

Site will be available soon. Thank you for your patience!