芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/www/media/plg_installer_webinstaller/js/client-es5.min.js
!function(){"use strict";if(!Joomla)throw new Error("Joomla API is not properly initialised");var e,t={button:["type"],input:["type","name","placeholder","inputmode"],select:["name"],option:["value","selected"]},n={view:"dashboard",id:0,ordering:"",version:"current",list:0,options:Joomla.getOptions("plg_installer_webinstaller",{})},o=function(){function e(){}var o=e.prototype;return o.initialise=function(){var e=this;n.loaded=1,document.getElementById("uploadform-web-cancel").addEventListener("click",(function(){document.getElementById("uploadform-web").classList.add("hidden"),n.list&&document.querySelector(".list-view")&&document.querySelector(".list-view").click()})),document.getElementById("uploadform-web-install").addEventListener("click",(function(){4===n.options.installFrom?e.submitButtonUrl():e.submitButtonWeb()})),this.loadweb(n.options.base_url+"index.php?format=json&option=com_apps&view=dashboard"),this.clickforlinks()},o.loadweb=function(o){var i=this;if(!o)return!1;var l=new RegExp(n.options.base_url),r=new RegExp("^index.php");if(!l.test(o)&&!r.test(o))return window.open(o,"_blank"),!1;var a=o+"&product="+n.options.product+"&release="+n.options.release+"&dev_level="+n.options.dev_level+"&list="+(n.list?"list":"grid")+"&lang="+n.options.language,d=document.getElementById("com-apps-ordering"),s=document.getElementById("com-apps-filter-joomla-version");return""!==n.ordering&&d&&d.value&&(n.ordering=d.value,a+="&ordering="+n.ordering),""!==n.version&&s&&s.value&&(n.version=s.value,a+="&filter_version="+n.version),e.showLoadingLayer(),new Promise((function(o,l){Joomla.request({url:a,onSuccess:function(l){var r;try{r=JSON.parse(l)}catch(e){throw new Error("Failed to parse JSON")}document.getElementById("web-loader")&&document.getElementById("web-loader").classList.add("hidden"),document.getElementById("jed-container").innerHTML=Joomla.sanitizeHtml(r.data.html,t),document.getElementById("com-apps-searchbox").addEventListener("keypress",(function(e){13===e.which&&i.initiateSearch()})),document.getElementById("search-extensions").addEventListener("click",(function(){i.initiateSearch()})),document.getElementById("search-reset").addEventListener("click",(function(){document.getElementById("com-apps-searchbox").value="",i.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"));var a=document.getElementById("com-apps-ordering"),d=document.getElementById("com-apps-filter-joomla-version");a&&a.addEventListener("change",(function(){var e=a.selectedIndex;n.ordering=a.options[e].value,i.installfromwebajaxsubmit()})),d&&d.addEventListener("change",(function(){var e=d.selectedIndex;n.version=d.options[e].value,i.installfromwebajaxsubmit()})),""!==n.options.installfrom_url&&e.installfromweb(n.options.installfrom_url),o()},onError:function(e){var t=document.getElementById("web-loader-error"),n=document.getElementById("web-loader");e.responseText&&t&&(t.innerHTML=Joomla.sanitizeHtml(e.responseText)),n&&(n.classList.add("hidden"),t.classList.remove("hidden")),Joomla.renderMessages({danger:[Joomla.Text._("PLG_INSTALLER_WEBINSTALLER_INSTALL_WEB_LOADING_ERROR")]},"#web-loader-error"),l()}})})).finally((function(){var t=document.getElementById("joomlaapsinstallatinput");if(t&&(t.value=n.options.installat_url),i.clickforlinks(),e.clicker(),"extension"!==n.view&&[].slice.call(document.querySelectorAll("div.load-extension")).forEach((function(e){e.addEventListener("click",(function(t){t.preventDefault(),i.processLinkClick(e.getAttribute("data-url"))})),e.setAttribute("href","#")})),"extension"===n.view){var o=document.getElementById("install-extension"),l=document.getElementById("install-extension-from-external");o&&o.addEventListener("click",(function(){e.installfromweb(o.getAttribute("data-downloadurl"),o.getAttribute("data-name")),document.getElementById("uploadform-web-install").scrollIntoView({behavior:"smooth",block:"start"})})),l&&l.addEventListener("click",(function(){var e=l.getAttribute("data-downloadurl");!0===window.confirm(Joomla.Text._("PLG_INSTALLER_WEBINSTALLER_REDIRECT_TO_EXTERNAL_SITE_TO_INSTALL").replace("[SITEURL]",e))&&(document.getElementById("adminForm").setAttribute("action",e),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())}))}n.list&&document.querySelector(".list-view")&&document.querySelector(".list-view").click(),e.hideLoadingLayer()})),!0},o.clickforlinks=function(){var e=this;[].slice.call(document.querySelectorAll("a.transcode")).forEach((function(t){var n=t.getAttribute("href");t.addEventListener("click",(function(t){t.preventDefault(),e.processLinkClick(n)})),t.setAttribute("href","#")}))},o.initiateSearch=function(){document.getElementById("search-reset").removeAttribute("disabled"),n.view="dashboard",this.installfromwebajaxsubmit()},o.installfromwebajaxsubmit=function(){var e="&view="+n.view;(n.id&&(e+="&id="+n.id),document.getElementById("com-apps-searchbox").value)&&(e+="&filter_search="+encodeURI(document.getElementById("com-apps-searchbox").value.toLowerCase().replace(/ +/g,"_").replace(/[^a-z0-9-_]/g,"").trim()));var t=document.getElementById("com-apps-ordering"),o=document.getElementById("com-apps-filter-joomla-version");""!==n.ordering&&t&&t.value&&(n.ordering=t.value),n.ordering&&(e+="&ordering="+n.ordering),""!==n.version&&o&&o.value&&(n.version=o.value),n.version&&(e+="&filter_version="+n.version),this.loadweb(n.options.base_url+"index.php?format=json&option=com_apps"+e)},o.processLinkClick=function(e){var t=new RegExp(n.options.base_url),o=new RegExp("^index.php");t.test(e)||o.test(e)?(n.view=e.replace(/^.+[&?]view=(\w+).*$/,"$1"),"dashboard"===n.view?n.id=0:"category"===n.view&&(n.id=e.replace(/^.+[&?]id=(\d+).*$/,"$1")),this.loadweb(n.options.base_url+e)):this.loadweb(e)},e.showLoadingLayer=function(){document.getElementById("web").appendChild(document.createElement("joomla-core-loader"))},e.hideLoadingLayer=function(){var e=document.querySelector("#web joomla-core-loader");e.parentNode.removeChild(e)},e.clicker=function(){document.querySelector(".grid-view")&&document.querySelector(".grid-view").addEventListener("click",(function(){n.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",(function(){n.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")}))},e.installfromweb=function(e,t){return void 0===t&&(t=null),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)},o.submitButtonUrl=function(){var e=document.getElementById("adminForm");if(""===e.install_url.value||"http://"===e.install_url.value||"https://"===e.install_url.value)Joomla.renderMessages({warning:[Joomla.Text._("COM_INSTALLER_MSG_INSTALL_ENTER_A_URL")]});else{var t=document.getElementById("loading");t&&t.classList.remove("hidden"),e.installtype.value="url",e.submit()}},o.submitButtonWeb=function(){var e=document.getElementById("adminForm");""!==e.install_url.value||"http://"!==e.install_url.value||"https://"!==e.install_url.value?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())},e}();customElements.whenDefined("joomla-tab").then((function(){var t=document.getElementById("myTab").querySelector("button[aria-controls=web]");t&&(n.options.installfromon&&t.click(),t.hasAttribute("aria-expanded")&&"true"===t.getAttribute("aria-expanded")&&!e&&(e=new o).initialise(),""!==n.options.installfrom_url&&t.click(),t.addEventListener("joomla.tab.shown",(function(){e||(e=new o).initialise()})))}))}();