From 54cb38694fcd585314cf6d46b3a3655e70acc7d4 Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Tue, 21 Jul 2020 11:20:51 +0300 Subject: [PATCH 01/16] Split installer plugin JS --- .../com_installer/tmpl/install/default.php | 1 - .../com_installer/js/installer.es6.js | 193 ----------------- .../js/packageinstaller.es6.js | 204 ++++++++++++++++++ .../packageinstaller/packageinstaller.php | 8 + .../packageinstaller/tmpl/default.php | 8 +- 5 files changed, 218 insertions(+), 196 deletions(-) create mode 100644 build/media_source/plg_installer_packageinstaller/js/packageinstaller.es6.js diff --git a/administrator/components/com_installer/tmpl/install/default.php b/administrator/components/com_installer/tmpl/install/default.php index c265c2f553c64..b09fdb7a2b260 100644 --- a/administrator/components/com_installer/tmpl/install/default.php +++ b/administrator/components/com_installer/tmpl/install/default.php @@ -20,7 +20,6 @@ Text::script('NOTICE'); Text::script('MESSAGE'); -Text::script('PLG_INSTALLER_PACKAGEINSTALLER_NO_PACKAGE'); Text::script('PLG_INSTALLER_FOLDERINSTALLER_NO_INSTALL_PATH'); Text::script('PLG_INSTALLER_URLINSTALLER_NO_URL'); Text::script('COM_INSTALLER_MSG_INSTALL_ENTER_A_URL'); diff --git a/build/media_source/com_installer/js/installer.es6.js b/build/media_source/com_installer/js/installer.es6.js index dd1b4718b517d..c99d137790dde 100644 --- a/build/media_source/com_installer/js/installer.es6.js +++ b/build/media_source/com_installer/js/installer.es6.js @@ -8,25 +8,7 @@ Joomla = window.Joomla || {}; ((Joomla) => { 'use strict'; - const installPackageButtonId = 'installbutton_package'; - document.addEventListener('DOMContentLoaded', () => { - Joomla.submitbuttonpackage = () => { - const form = document.getElementById('adminForm'); - - // do field validation - if (form.install_package.value === '') { - Joomla.renderMessages({ warning: [Joomla.JText._('PLG_INSTALLER_PACKAGEINSTALLER_NO_PACKAGE')] }); - } else if (form.install_package.files[0].size > form.max_upload_size.value) { - Joomla.renderMessages({ warning: [Joomla.JText._('COM_INSTALLER_MSG_WARNINGS_UPLOADFILETOOBIG')] }); - } else { - Joomla.displayLoader(); - - form.installtype.value = 'upload'; - form.submit(); - } - }; - Joomla.submitbuttonfolder = () => { const form = document.getElementById('adminForm'); @@ -117,180 +99,5 @@ Joomla = window.Joomla || {}; loading.classList.add('hidden'); loading.style.marginTop = '-10px'; } - - document.getElementById(installPackageButtonId).addEventListener('click', (event) => { - event.preventDefault(); - Joomla.submitbuttonpackage(); - }); }); })(Joomla); - -document.addEventListener('DOMContentLoaded', () => { - if (typeof FormData === 'undefined') { - document.querySelector('#legacy-uploader').classList.remove('hidden'); - document.querySelector('#uploader-wrapper').classList.add('hidden'); - return; - } - - let uploading = false; - const dragZone = document.querySelector('#dragarea'); - const fileInput = document.querySelector('#install_package'); - const fileSizeMax = document.querySelector('#max_upload_size').value; - const button = document.querySelector('#select-file-button'); - const returnUrl = document.querySelector('#installer-return').value; - const progress = document.getElementById('upload-progress'); - const progressBar = progress.querySelectorAll('.bar')[0]; - const percentage = progress.querySelectorAll('.uploading-number')[0]; - let uploadUrl = 'index.php?option=com_installer&task=install.ajax_upload'; - - function showError(res) { - dragZone.setAttribute('data-state', 'pending'); - let message = Joomla.JText._('PLG_INSTALLER_PACKAGEINSTALLER_UPLOAD_ERROR_UNKNOWN'); - if (res == null) { - message = Joomla.JText._('PLG_INSTALLER_PACKAGEINSTALLER_UPLOAD_ERROR_EMPTY'); - } else if (typeof res === 'string') { - // Let's remove unnecessary HTML - message = res.replace(/(<([^>]+)>|\s+)/g, ' '); - } else if (res.message) { - ({ message } = res); - } - Joomla.renderMessages({ error: [message] }); - } - - if (returnUrl) { - uploadUrl += `&return=${returnUrl}`; - } - - button.addEventListener('click', () => { - fileInput.click(); - }); - - fileInput.addEventListener('change', () => { - if (uploading) { - return; - } - Joomla.submitbuttonpackage(); - }); - - dragZone.addEventListener('dragenter', (event) => { - event.preventDefault(); - event.stopPropagation(); - - dragZone.classList.add('hover'); - - return false; - }); - - // Notify user when file is over the drop area - dragZone.addEventListener('dragover', (event) => { - event.preventDefault(); - event.stopPropagation(); - - dragZone.classList.add('hover'); - - return false; - }); - - dragZone.addEventListener('dragleave', (event) => { - event.preventDefault(); - event.stopPropagation(); - dragZone.classList.remove('hover'); - - return false; - }); - - dragZone.addEventListener('drop', (event) => { - event.preventDefault(); - event.stopPropagation(); - - if (uploading) { - return; - } - - dragZone.classList.remove('hover'); - - const files = event.target.files || event.dataTransfer.files; - - if (!files.length) { - return; - } - - const file = files[0]; - const data = new FormData(); - - if (file.size > fileSizeMax) { - Joomla.renderMessages({ warning: [Joomla.JText._('COM_INSTALLER_MSG_WARNINGS_UPLOADFILETOOBIG')] }); - return; - } - - data.append('install_package', file); - data.append('installtype', 'upload'); - dragZone.setAttribute('data-state', 'uploading'); - progressBar.setAttribute('aria-valuenow', 0); - - uploading = true; - progressBar.style.width = 0; - percentage.textContent = '0'; - - // Upload progress - const progressCallback = (evt) => { - if (evt.lengthComputable) { - const percentComplete = evt.loaded / evt.total; - const number = Math.round(percentComplete * 100); - progressBar.css('width', `${number}%`); - progressBar.setAttribute('aria-valuenow', number); - percentage.textContent = `${number}`; - if (number === 100) { - dragZone.setAttribute('data-state', 'installing'); - } - } - }; - - Joomla.request({ - url: uploadUrl, - method: 'POST', - perform: true, - data, - headers: { 'Content-Type': 'false' }, - uploadProgressCallback: progressCallback, - onSuccess: (response) => { - if (!response) { - showError(response); - return; - } - - let res; - - try { - res = JSON.parse(response); - } catch (e) { - showError(e); - - return; - } - - if (!res.success && !res.data) { - showError(res); - - return; - } - - // Always redirect that can show message queue from session - if (res.data.redirect) { - window.location.href = res.data.redirect; - } else { - window.location.href = 'index.php?option=com_installer&view=install'; - } - }, - onError: (error) => { - uploading = false; - if (error.status === 200) { - const res = error.responseText || error.responseJSON; - showError(res); - } else { - showError(error.statusText); - } - }, - }); - }); -}); diff --git a/build/media_source/plg_installer_packageinstaller/js/packageinstaller.es6.js b/build/media_source/plg_installer_packageinstaller/js/packageinstaller.es6.js new file mode 100644 index 0000000000000..a55cac457612a --- /dev/null +++ b/build/media_source/plg_installer_packageinstaller/js/packageinstaller.es6.js @@ -0,0 +1,204 @@ +/** + * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +Joomla = window.Joomla || {}; + +((Joomla) => { + 'use strict'; + + document.addEventListener('DOMContentLoaded', () => { + Joomla.submitbuttonpackage = () => { + const form = document.getElementById('adminForm'); + + // do field validation + if (form.install_package.value === '') { + Joomla.renderMessages({ warning: [Joomla.Text._('PLG_INSTALLER_PACKAGEINSTALLER_NO_PACKAGE')] }); + } else if (form.install_package.files[0].size > form.max_upload_size.value) { + Joomla.renderMessages({ warning: [Joomla.Text._('COM_INSTALLER_MSG_WARNINGS_UPLOADFILETOOBIG')] }); + } else { + const loading = document.getElementById('loading'); + if (loading) { + loading.classList.remove('hidden'); + } + + form.installtype.value = 'upload'; + form.submit(); + } + }; + + if (typeof FormData === 'undefined') { + document.querySelector('#legacy-uploader').classList.remove('hidden'); + document.querySelector('#uploader-wrapper').classList.add('hidden'); + return; + } + + let uploading = false; + const dragZone = document.querySelector('#dragarea'); + const fileInput = document.querySelector('#install_package'); + const fileSizeMax = document.querySelector('#max_upload_size').value; + const button = document.querySelector('#select-file-button'); + const returnUrl = document.querySelector('#installer-return').value; + const progress = document.getElementById('upload-progress'); + const progressBar = progress.querySelectorAll('.bar')[0]; + const percentage = progress.querySelectorAll('.uploading-number')[0]; + let uploadUrl = 'index.php?option=com_installer&task=install.ajax_upload'; + + function showError(res) { + dragZone.setAttribute('data-state', 'pending'); + let message = Joomla.Text._('PLG_INSTALLER_PACKAGEINSTALLER_UPLOAD_ERROR_UNKNOWN'); + if (res == null) { + message = Joomla.Text._('PLG_INSTALLER_PACKAGEINSTALLER_UPLOAD_ERROR_EMPTY'); + } else if (typeof res === 'string') { + // Let's remove unnecessary HTML + message = res.replace(/(<([^>]+)>|\s+)/g, ' '); + } else if (res.message) { + ({ message } = res); + } + Joomla.renderMessages({ error: [message] }); + } + + if (returnUrl) { + uploadUrl += `&return=${returnUrl}`; + } + + button.addEventListener('click', () => { + fileInput.click(); + }); + + fileInput.addEventListener('change', () => { + if (uploading) { + return; + } + Joomla.submitbuttonpackage(); + }); + + dragZone.addEventListener('dragenter', (event) => { + event.preventDefault(); + event.stopPropagation(); + + dragZone.classList.add('hover'); + + return false; + }); + + // Notify user when file is over the drop area + dragZone.addEventListener('dragover', (event) => { + event.preventDefault(); + event.stopPropagation(); + + dragZone.classList.add('hover'); + + return false; + }); + + dragZone.addEventListener('dragleave', (event) => { + event.preventDefault(); + event.stopPropagation(); + dragZone.classList.remove('hover'); + + return false; + }); + + dragZone.addEventListener('drop', (event) => { + event.preventDefault(); + event.stopPropagation(); + + if (uploading) { + return; + } + + dragZone.classList.remove('hover'); + + const files = event.target.files || event.dataTransfer.files; + + if (!files.length) { + return; + } + + const file = files[0]; + const data = new FormData(); + + if (file.size > fileSizeMax) { + Joomla.renderMessages({ warning: [Joomla.Text._('COM_INSTALLER_MSG_WARNINGS_UPLOADFILETOOBIG')] }); + return; + } + + data.append('install_package', file); + data.append('installtype', 'upload'); + dragZone.setAttribute('data-state', 'uploading'); + progressBar.setAttribute('aria-valuenow', 0); + + uploading = true; + progressBar.style.width = 0; + percentage.textContent = '0'; + + // Upload progress + const progressCallback = (evt) => { + if (evt.lengthComputable) { + const percentComplete = evt.loaded / evt.total; + const number = Math.round(percentComplete * 100); + progressBar.css('width', `${number}%`); + progressBar.setAttribute('aria-valuenow', number); + percentage.textContent = `${number}`; + if (number === 100) { + dragZone.setAttribute('data-state', 'installing'); + } + } + }; + + Joomla.request({ + url: uploadUrl, + method: 'POST', + perform: true, + data, + headers: { 'Content-Type': 'false' }, + uploadProgressCallback: progressCallback, + onSuccess: (response) => { + if (!response) { + showError(response); + return; + } + + let res; + + try { + res = JSON.parse(response); + } catch (e) { + showError(e); + + return; + } + + if (!res.success && !res.data) { + showError(res); + + return; + } + + // Always redirect that can show message queue from session + if (res.data.redirect) { + window.location.href = res.data.redirect; + } else { + window.location.href = 'index.php?option=com_installer&view=install'; + } + }, + onError: (error) => { + uploading = false; + if (error.status === 200) { + const res = error.responseText || error.responseJSON; + showError(res); + } else { + showError(error.statusText); + } + }, + }); + }); + + document.getElementById('installbutton_package').addEventListener('click', (event) => { + event.preventDefault(); + Joomla.submitbuttonpackage(); + }); + }); +})(Joomla); diff --git a/plugins/installer/packageinstaller/packageinstaller.php b/plugins/installer/packageinstaller/packageinstaller.php index 90ab9de684e44..8378f786c8bf2 100644 --- a/plugins/installer/packageinstaller/packageinstaller.php +++ b/plugins/installer/packageinstaller/packageinstaller.php @@ -20,6 +20,14 @@ */ class PlgInstallerPackageInstaller extends CMSPlugin { + /** + * Application object + * + * @var \Joomla\CMS\Application\CMSApplication + * @since __DEPLOY_VERSION__ + */ + protected $app; + /** * Load the language file on instantiation. * diff --git a/plugins/installer/packageinstaller/tmpl/default.php b/plugins/installer/packageinstaller/tmpl/default.php index 4d06754313f4c..5fe7ed7746d12 100644 --- a/plugins/installer/packageinstaller/tmpl/default.php +++ b/plugins/installer/packageinstaller/tmpl/default.php @@ -9,18 +9,22 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\Filesystem\FilesystemHelper; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; +/** @var PlgInstallerPackageInstaller $this */ + HTMLHelper::_('form.csrf'); +Text::script('PLG_INSTALLER_PACKAGEINSTALLER_NO_PACKAGE'); Text::script('PLG_INSTALLER_PACKAGEINSTALLER_UPLOAD_ERROR_UNKNOWN'); Text::script('PLG_INSTALLER_PACKAGEINSTALLER_UPLOAD_ERROR_EMPTY'); Text::script('COM_INSTALLER_MSG_WARNINGS_UPLOADFILETOOBIG'); -$return = Factory::getApplication()->input->getBase64('return'); +$this->app->getDocument()->getWebAssetManager()->registerAndUseScript('plg_installer_packageinstaller.packageinstaller', 'plg_installer_packageinstaller/packageinstaller.js'); + +$return = $this->app->input->getBase64('return'); $maxSizeBytes = FilesystemHelper::fileUploadMaxSize(false); $maxSize = HTMLHelper::_('number.bytes', $maxSizeBytes); ?> From 5f6429318927889fba0aa0e3ac9276e99ba76b18 Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Tue, 21 Jul 2020 11:29:25 +0300 Subject: [PATCH 02/16] Remove unused function --- .../com_installer/js/installer.es6.js | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/build/media_source/com_installer/js/installer.es6.js b/build/media_source/com_installer/js/installer.es6.js index c99d137790dde..dd01e98822384 100644 --- a/build/media_source/com_installer/js/installer.es6.js +++ b/build/media_source/com_installer/js/installer.es6.js @@ -66,21 +66,6 @@ Joomla = window.Joomla || {}; } }; - Joomla.submitbuttonUpload = () => { - const form = document.getElementById('uploadForm'); - - // do field validation - if (form.install_package.value === '') { - Joomla.renderMessages({ warning: [Joomla.JText._('COM_INSTALLER_MSG_INSTALL_PLEASE_SELECT_A_PACKAGE')] }); - } else if (form.install_package.files[0].size > form.max_upload_size.value) { - Joomla.renderMessages({ warning: [Joomla.JText._('COM_INSTALLER_MSG_WARNINGS_UPLOADFILETOOBIG')] }); - } else { - Joomla.displayLoader(); - - form.submit(); - } - }; - Joomla.displayLoader = () => { const loading = document.getElementById('loading'); if (loading) { From c4c799bcc817e47737be3f3a0533ff085f8baa17 Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Tue, 21 Jul 2020 11:40:34 +0300 Subject: [PATCH 03/16] Split installer plugin JS --- .../com_installer/js/installer.es6.js | 14 --------- .../js/folderinstaller.es6.js | 29 +++++++++++++++++++ .../folderinstaller/folderinstaller.php | 8 +++++ .../folderinstaller/tmpl/default.php | 8 +++-- 4 files changed, 42 insertions(+), 17 deletions(-) create mode 100644 build/media_source/plg_installer_folderinstaller/js/folderinstaller.es6.js diff --git a/build/media_source/com_installer/js/installer.es6.js b/build/media_source/com_installer/js/installer.es6.js index dd01e98822384..31e5bcbcf95fd 100644 --- a/build/media_source/com_installer/js/installer.es6.js +++ b/build/media_source/com_installer/js/installer.es6.js @@ -9,20 +9,6 @@ Joomla = window.Joomla || {}; 'use strict'; document.addEventListener('DOMContentLoaded', () => { - Joomla.submitbuttonfolder = () => { - const form = document.getElementById('adminForm'); - - // do field validation - if (form.install_directory.value === '') { - Joomla.renderMessages({ warning: [Joomla.JText._('PLG_INSTALLER_FOLDERINSTALLER_NO_INSTALL_PATH')] }); - } else { - Joomla.displayLoader(); - - form.installtype.value = 'folder'; - form.submit(); - } - }; - Joomla.submitbuttonurl = () => { const form = document.getElementById('adminForm'); diff --git a/build/media_source/plg_installer_folderinstaller/js/folderinstaller.es6.js b/build/media_source/plg_installer_folderinstaller/js/folderinstaller.es6.js new file mode 100644 index 0000000000000..0ac86db7a08b9 --- /dev/null +++ b/build/media_source/plg_installer_folderinstaller/js/folderinstaller.es6.js @@ -0,0 +1,29 @@ +/** + * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +Joomla = window.Joomla || {}; + +((Joomla) => { + 'use strict'; + + document.addEventListener('DOMContentLoaded', () => { + Joomla.submitbuttonfolder = () => { + const form = document.getElementById('adminForm'); + + // do field validation + if (form.install_directory.value === '') { + Joomla.renderMessages({ warning: [Joomla.JText._('PLG_INSTALLER_FOLDERINSTALLER_NO_INSTALL_PATH')] }); + } else { + const loading = document.getElementById('loading'); + if (loading) { + loading.classList.remove('hidden'); + } + + form.installtype.value = 'folder'; + form.submit(); + } + }; + }); +})(Joomla); diff --git a/plugins/installer/folderinstaller/folderinstaller.php b/plugins/installer/folderinstaller/folderinstaller.php index 3bbb19c2d2a9b..9e5bb07f4c195 100644 --- a/plugins/installer/folderinstaller/folderinstaller.php +++ b/plugins/installer/folderinstaller/folderinstaller.php @@ -19,6 +19,14 @@ */ class PlgInstallerFolderInstaller extends CMSPlugin { + /** + * Application object. + * + * @var \Joomla\CMS\Application\CMSApplication + * @since __DEPLOY_VERSION__ + */ + protected $app; + /** * Load the language file on instantiation. * diff --git a/plugins/installer/folderinstaller/tmpl/default.php b/plugins/installer/folderinstaller/tmpl/default.php index 594657020aef7..3ccd084ba33d5 100644 --- a/plugins/installer/folderinstaller/tmpl/default.php +++ b/plugins/installer/folderinstaller/tmpl/default.php @@ -12,9 +12,11 @@ use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; -$app = Factory::getApplication(); -?> +/** @var PlgInstallerFolderInstaller $this */ + +$this->app->getDocument()->getWebAssetManager()->registerAndUseScript('plg_installer_folderinstaller.folderinstaller', 'plg_installer_folderinstaller/folderinstaller.js'); +?>
@@ -23,7 +25,7 @@
+ value="app->input->get('install_directory', $this->app->get('tmp_path')); ?>">

From 16591a71ecc037161fca18987080ce5a45e24fde Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Tue, 21 Jul 2020 11:49:32 +0300 Subject: [PATCH 04/16] Split installer plugin JS --- .../com_installer/tmpl/install/default.php | 2 -- .../com_installer/js/installer.es6.js | 14 --------- .../js/urlinstaller.js | 29 +++++++++++++++++++ .../folderinstaller/tmpl/default.php | 3 +- .../packageinstaller/tmpl/default.php | 1 - .../installer/urlinstaller/tmpl/default.php | 7 ++++- .../installer/urlinstaller/urlinstaller.php | 8 +++++ 7 files changed, 45 insertions(+), 19 deletions(-) create mode 100644 build/media_source/plg_installer_urlinstaller/js/urlinstaller.js diff --git a/administrator/components/com_installer/tmpl/install/default.php b/administrator/components/com_installer/tmpl/install/default.php index b09fdb7a2b260..96f28d1319806 100644 --- a/administrator/components/com_installer/tmpl/install/default.php +++ b/administrator/components/com_installer/tmpl/install/default.php @@ -20,8 +20,6 @@ Text::script('NOTICE'); Text::script('MESSAGE'); -Text::script('PLG_INSTALLER_FOLDERINSTALLER_NO_INSTALL_PATH'); -Text::script('PLG_INSTALLER_URLINSTALLER_NO_URL'); Text::script('COM_INSTALLER_MSG_INSTALL_ENTER_A_URL'); /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ diff --git a/build/media_source/com_installer/js/installer.es6.js b/build/media_source/com_installer/js/installer.es6.js index 31e5bcbcf95fd..e81dbf4a60422 100644 --- a/build/media_source/com_installer/js/installer.es6.js +++ b/build/media_source/com_installer/js/installer.es6.js @@ -9,20 +9,6 @@ Joomla = window.Joomla || {}; 'use strict'; document.addEventListener('DOMContentLoaded', () => { - Joomla.submitbuttonurl = () => { - const form = document.getElementById('adminForm'); - - // do field validation - if (form.install_url.value === '' || form.install_url.value === 'http://' || form.install_url.value === 'https://') { - Joomla.renderMessages({ warning: [Joomla.JText._('PLG_INSTALLER_URLINSTALLER_NO_URL')] }); - } else { - Joomla.displayLoader(); - - form.installtype.value = 'url'; - form.submit(); - } - }; - Joomla.submitbutton4 = () => { const form = document.getElementById('adminForm'); diff --git a/build/media_source/plg_installer_urlinstaller/js/urlinstaller.js b/build/media_source/plg_installer_urlinstaller/js/urlinstaller.js new file mode 100644 index 0000000000000..2c1986c340d28 --- /dev/null +++ b/build/media_source/plg_installer_urlinstaller/js/urlinstaller.js @@ -0,0 +1,29 @@ +/** + * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +Joomla = window.Joomla || {}; + +((Joomla) => { + 'use strict'; + + document.addEventListener('DOMContentLoaded', () => { + Joomla.submitbuttonurl = () => { + const form = document.getElementById('adminForm'); + + // do field validation + if (form.install_url.value === '' || form.install_url.value === 'http://' || form.install_url.value === 'https://') { + Joomla.renderMessages({ warning: [Joomla.Text._('PLG_INSTALLER_URLINSTALLER_NO_URL')] }); + } else { + const loading = document.getElementById('loading'); + if (loading) { + loading.classList.remove('hidden'); + } + + form.installtype.value = 'url'; + form.submit(); + } + }; + }); +})(Joomla); diff --git a/plugins/installer/folderinstaller/tmpl/default.php b/plugins/installer/folderinstaller/tmpl/default.php index 3ccd084ba33d5..3cc0d104096a7 100644 --- a/plugins/installer/folderinstaller/tmpl/default.php +++ b/plugins/installer/folderinstaller/tmpl/default.php @@ -9,11 +9,12 @@ defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; /** @var PlgInstallerFolderInstaller $this */ +Text::script('PLG_INSTALLER_FOLDERINSTALLER_NO_INSTALL_PATH'); + $this->app->getDocument()->getWebAssetManager()->registerAndUseScript('plg_installer_folderinstaller.folderinstaller', 'plg_installer_folderinstaller/folderinstaller.js'); ?> diff --git a/plugins/installer/packageinstaller/tmpl/default.php b/plugins/installer/packageinstaller/tmpl/default.php index 5fe7ed7746d12..1ac5ca9a3851b 100644 --- a/plugins/installer/packageinstaller/tmpl/default.php +++ b/plugins/installer/packageinstaller/tmpl/default.php @@ -28,7 +28,6 @@ $maxSizeBytes = FilesystemHelper::fileUploadMaxSize(false); $maxSize = HTMLHelper::_('number.bytes', $maxSizeBytes); ?> -
diff --git a/plugins/installer/urlinstaller/tmpl/default.php b/plugins/installer/urlinstaller/tmpl/default.php index 78fa227bdbdac..f7f0a8cb9eaf9 100644 --- a/plugins/installer/urlinstaller/tmpl/default.php +++ b/plugins/installer/urlinstaller/tmpl/default.php @@ -11,8 +11,13 @@ use Joomla\CMS\Language\Text; -?> +/** @var PlgInstallerUrlInstaller $this */ + +Text::script('PLG_INSTALLER_FOLDERINSTALLER_NO_INSTALL_PATH'); +$this->app->getDocument()->getWebAssetManager()->registerAndUseScript('plg_installer_urlinstaller.urlinstaller', 'plg_installer_urlinstaller/urlinstaller.js'); + +?>
diff --git a/plugins/installer/urlinstaller/urlinstaller.php b/plugins/installer/urlinstaller/urlinstaller.php index 80d1f9234875d..05a67df93c50d 100644 --- a/plugins/installer/urlinstaller/urlinstaller.php +++ b/plugins/installer/urlinstaller/urlinstaller.php @@ -19,6 +19,14 @@ */ class PlgInstallerUrlInstaller extends CMSPlugin { + /** + * Application object. + * + * @var \Joomla\CMS\Application\CMSApplication + * @since __DEPLOY_VERSION__ + */ + protected $app; + /** * Load the language file on instantiation. * From 3cdabf720894ff7b8e4131c729dbe522e4b46f7c Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Tue, 21 Jul 2020 11:55:28 +0300 Subject: [PATCH 05/16] Rename file --- .../js/{urlinstaller.js => urlinstaller.es6.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename build/media_source/plg_installer_urlinstaller/js/{urlinstaller.js => urlinstaller.es6.js} (100%) diff --git a/build/media_source/plg_installer_urlinstaller/js/urlinstaller.js b/build/media_source/plg_installer_urlinstaller/js/urlinstaller.es6.js similarity index 100% rename from build/media_source/plg_installer_urlinstaller/js/urlinstaller.js rename to build/media_source/plg_installer_urlinstaller/js/urlinstaller.es6.js From bd8ab004a1f1151b42aa321d5e8178ad053b74f2 Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Tue, 21 Jul 2020 11:55:46 +0300 Subject: [PATCH 06/16] Correct string --- plugins/installer/urlinstaller/tmpl/default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/installer/urlinstaller/tmpl/default.php b/plugins/installer/urlinstaller/tmpl/default.php index f7f0a8cb9eaf9..5396719bd99d3 100644 --- a/plugins/installer/urlinstaller/tmpl/default.php +++ b/plugins/installer/urlinstaller/tmpl/default.php @@ -13,7 +13,7 @@ /** @var PlgInstallerUrlInstaller $this */ -Text::script('PLG_INSTALLER_FOLDERINSTALLER_NO_INSTALL_PATH'); +Text::script('PLG_INSTALLER_URLINSTALLER_NO_URL'); $this->app->getDocument()->getWebAssetManager()->registerAndUseScript('plg_installer_urlinstaller.urlinstaller', 'plg_installer_urlinstaller/urlinstaller.js'); From cec2cbd4490b48ff03131b1d5bd77a81f52b1ce7 Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Tue, 21 Jul 2020 11:57:36 +0300 Subject: [PATCH 07/16] Replace JText --- .../plg_installer_folderinstaller/js/folderinstaller.es6.js | 2 +- .../media_source/plg_installer_webinstaller/js/client.es6.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/media_source/plg_installer_folderinstaller/js/folderinstaller.es6.js b/build/media_source/plg_installer_folderinstaller/js/folderinstaller.es6.js index 0ac86db7a08b9..45392262cb5c0 100644 --- a/build/media_source/plg_installer_folderinstaller/js/folderinstaller.es6.js +++ b/build/media_source/plg_installer_folderinstaller/js/folderinstaller.es6.js @@ -14,7 +14,7 @@ Joomla = window.Joomla || {}; // do field validation if (form.install_directory.value === '') { - Joomla.renderMessages({ warning: [Joomla.JText._('PLG_INSTALLER_FOLDERINSTALLER_NO_INSTALL_PATH')] }); + Joomla.renderMessages({ warning: [Joomla.Text._('PLG_INSTALLER_FOLDERINSTALLER_NO_INSTALL_PATH')] }); } else { const loading = document.getElementById('loading'); if (loading) { diff --git a/build/media_source/plg_installer_webinstaller/js/client.es6.js b/build/media_source/plg_installer_webinstaller/js/client.es6.js index 502072e8e303b..19e7c588634a0 100644 --- a/build/media_source/plg_installer_webinstaller/js/client.es6.js +++ b/build/media_source/plg_installer_webinstaller/js/client.es6.js @@ -195,7 +195,7 @@ if (!Joomla) { if (installExtensionFromExternalButton) { installExtensionFromExternalButton.addEventListener('click', () => { const redirectUrl = installExtensionFromExternalButton.getAttribute('data-downloadurl'); - const redirectConfirm = window.confirm(Joomla.JText._('PLG_INSTALLER_WEBINSTALLER_REDIRECT_TO_EXTERNAL_SITE_TO_INSTALL').replace('[SITEURL]', redirectUrl)); + const redirectConfirm = window.confirm(Joomla.Text._('PLG_INSTALLER_WEBINSTALLER_REDIRECT_TO_EXTERNAL_SITE_TO_INSTALL').replace('[SITEURL]', redirectUrl)); if (redirectConfirm !== true) { return; @@ -332,7 +332,7 @@ if (!Joomla) { */ static installfromweb(installUrl, name = null) { if (!installUrl) { - Joomla.renderMessages({ warning: [Joomla.JText._('PLG_INSTALLER_WEBINSTALLER_CANNOT_INSTALL_EXTENSION_IN_PLUGIN')] }); + Joomla.renderMessages({ warning: [Joomla.Text._('PLG_INSTALLER_WEBINSTALLER_CANNOT_INSTALL_EXTENSION_IN_PLUGIN')] }); return false; } From 17a1c868dc81c5c2dc53be09e4df096518e28b18 Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Wed, 22 Jul 2020 08:42:02 +0300 Subject: [PATCH 08/16] Disable language autoloading, clean up strings --- administrator/language/en-GB/com_installer.ini | 11 ----------- .../language/en-GB/plg_installer_webinstaller.ini | 6 ++++++ .../installer/folderinstaller/folderinstaller.php | 11 +++-------- .../installer/packageinstaller/packageinstaller.php | 11 +++-------- plugins/installer/urlinstaller/urlinstaller.php | 11 +++-------- plugins/installer/webinstaller/tmpl/default.php | 11 +++++------ plugins/installer/webinstaller/webinstaller.php | 13 ++++--------- 7 files changed, 24 insertions(+), 50 deletions(-) diff --git a/administrator/language/en-GB/com_installer.ini b/administrator/language/en-GB/com_installer.ini index 2633ea4af1f28..a4b236e30785e 100644 --- a/administrator/language/en-GB/com_installer.ini +++ b/administrator/language/en-GB/com_installer.ini @@ -83,9 +83,6 @@ COM_INSTALLER_INSTALL_BUTTON="Install" COM_INSTALLER_INSTALL_CHECKSUM_WRONG="The checksum verification failed. Please make sure you are using the correct update server!" COM_INSTALLER_INSTALL_DIRECTORY="Install Folder" COM_INSTALLER_INSTALL_ERROR="Error installing %s" -COM_INSTALLER_INSTALL_FROM_DIRECTORY="Install from Folder" -COM_INSTALLER_INSTALL_FROM_URL="Install from URL" -COM_INSTALLER_INSTALL_FROM_WEB="Install from Web" COM_INSTALLER_INSTALL_LANGUAGE_SUCCESS="Installation of the %s language was successful." COM_INSTALLER_INSTALL_SUCCESS="Installation of the %s was successful." COM_INSTALLER_INSTALL_URL="Install URL" @@ -282,14 +279,6 @@ COM_INSTALLER_VALUE_SUPPORTED_MISSING="Download Key invalid" COM_INSTALLER_VALUE_SUPPORTED_SELECT="- Select Download Key -" COM_INSTALLER_VALUE_SUPPORTED_SUPPORTED="Download Key supported" COM_INSTALLER_VALUE_TYPE_SELECT="- Select Type -" -COM_INSTALLER_WEBINSTALLER_INSTALL_OBSOLETE="The Install from Web plugin needs to be updated." -COM_INSTALLER_WEBINSTALLER_INSTALL_UPDATE_AVAILABLE="There is a new update available for the Install from Web plugin. It is advisable that you update as soon as possible." -COM_INSTALLER_WEBINSTALLER_INSTALL_WEB_CONFIRM="Please confirm the installation by selecting the Install button" -COM_INSTALLER_WEBINSTALLER_INSTALL_WEB_CONFIRM_NAME="Extension Name" -COM_INSTALLER_WEBINSTALLER_INSTALL_WEB_CONFIRM_URL="Install from" -COM_INSTALLER_WEBINSTALLER_INSTALL_WEB_LOADING="Loading ..." -COM_INSTALLER_WEBINSTALLER_INSTALL_WEB_LOADING_ERROR="Can't connect to the Joomla! server. Please try again later." -COM_INSTALLER_WEBINSTALLER_LOAD_APPS="Select to load extensions browser" COM_INSTALLER_XML_DESCRIPTION="Installer component for adding, removing and upgrading extensions" ; Alternate language strings for the rules form field diff --git a/administrator/language/en-GB/plg_installer_webinstaller.ini b/administrator/language/en-GB/plg_installer_webinstaller.ini index dc9ea88c4d930..6c4b9ba7d0dee 100644 --- a/administrator/language/en-GB/plg_installer_webinstaller.ini +++ b/administrator/language/en-GB/plg_installer_webinstaller.ini @@ -5,6 +5,12 @@ PLG_INSTALLER_WEBINSTALLER="Installer - Install from Web" PLG_INSTALLER_WEBINSTALLER_CANNOT_INSTALL_EXTENSION_IN_PLUGIN="This extension cannot be installed via the install from web system. Please visit the developer's website to purchase/download." +PLG_INSTALLER_WEBINSTALLER_INSTALL_WEB_CONFIRM="Please confirm the installation by selecting the Install button" +PLG_INSTALLER_WEBINSTALLER_INSTALL_WEB_CONFIRM_NAME="Extension Name" +PLG_INSTALLER_WEBINSTALLER_INSTALL_WEB_CONFIRM_URL="Install from" +PLG_INSTALLER_WEBINSTALLER_INSTALL_WEB_LOADING="Loading ..." +PLG_INSTALLER_WEBINSTALLER_INSTALL_WEB_LOADING_ERROR="Can't connect to the Joomla! server. Please try again later." ; The [SITEURL] placeholder should not be translated as it is used in the JavaScript API to insert the correct URL PLG_INSTALLER_WEBINSTALLER_REDIRECT_TO_EXTERNAL_SITE_TO_INSTALL="You will be redirected to the following link to complete the registration/purchase: [SITEURL]" +PLG_INSTALLER_WEBINSTALLER_TAB_LABEL="Install from Web" PLG_INSTALLER_WEBINSTALLER_XML_DESCRIPTION="This plugin allows you to install directly from the Joomla! Extension Directory." diff --git a/plugins/installer/folderinstaller/folderinstaller.php b/plugins/installer/folderinstaller/folderinstaller.php index 9e5bb07f4c195..33f5921543e14 100644 --- a/plugins/installer/folderinstaller/folderinstaller.php +++ b/plugins/installer/folderinstaller/folderinstaller.php @@ -27,14 +27,6 @@ class PlgInstallerFolderInstaller extends CMSPlugin */ protected $app; - /** - * Load the language file on instantiation. - * - * @var boolean - * @since 3.6.0 - */ - protected $autoloadLanguage = true; - /** * Textfield or Form of the Plugin. * @@ -44,6 +36,9 @@ class PlgInstallerFolderInstaller extends CMSPlugin */ public function onInstallerAddInstallationTab() { + // Load language files + $this->loadLanguage(); + $tab = array(); $tab['name'] = 'folder'; $tab['label'] = Text::_('PLG_INSTALLER_FOLDERINSTALLER_TEXT'); diff --git a/plugins/installer/packageinstaller/packageinstaller.php b/plugins/installer/packageinstaller/packageinstaller.php index 8378f786c8bf2..c5a8c479ce17a 100644 --- a/plugins/installer/packageinstaller/packageinstaller.php +++ b/plugins/installer/packageinstaller/packageinstaller.php @@ -28,14 +28,6 @@ class PlgInstallerPackageInstaller extends CMSPlugin */ protected $app; - /** - * Load the language file on instantiation. - * - * @var boolean - * @since 3.6.0 - */ - protected $autoloadLanguage = true; - /** * Textfield or Form of the Plugin. * @@ -45,6 +37,9 @@ class PlgInstallerPackageInstaller extends CMSPlugin */ public function onInstallerAddInstallationTab() { + // Load language files + $this->loadLanguage(); + $tab = array(); $tab['name'] = 'package'; $tab['label'] = Text::_('PLG_INSTALLER_PACKAGEINSTALLER_UPLOAD_PACKAGE_FILE'); diff --git a/plugins/installer/urlinstaller/urlinstaller.php b/plugins/installer/urlinstaller/urlinstaller.php index 05a67df93c50d..665111170c3a3 100644 --- a/plugins/installer/urlinstaller/urlinstaller.php +++ b/plugins/installer/urlinstaller/urlinstaller.php @@ -27,14 +27,6 @@ class PlgInstallerUrlInstaller extends CMSPlugin */ protected $app; - /** - * Load the language file on instantiation. - * - * @var boolean - * @since 3.6.0 - */ - protected $autoloadLanguage = true; - /** * Textfield or Form of the Plugin. * @@ -44,6 +36,9 @@ class PlgInstallerUrlInstaller extends CMSPlugin */ public function onInstallerAddInstallationTab() { + // Load language files + $this->loadLanguage(); + $tab = array(); $tab['name'] = 'url'; $tab['label'] = Text::_('PLG_INSTALLER_URLINSTALLER_TEXT'); diff --git a/plugins/installer/webinstaller/tmpl/default.php b/plugins/installer/webinstaller/tmpl/default.php index d3bf09680aede..092cbf5ec2d60 100644 --- a/plugins/installer/webinstaller/tmpl/default.php +++ b/plugins/installer/webinstaller/tmpl/default.php @@ -16,24 +16,23 @@ $dir = $this->isRTL() ? ' dir="ltr"' : ''; ?> -
-

+

From 13856565e95a701551adf79e0cbde315d4601e3f Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Wed, 22 Jul 2020 09:21:10 +0300 Subject: [PATCH 11/16] Use static alert --- .../components/com_installer/tmpl/install/default.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/administrator/components/com_installer/tmpl/install/default.php b/administrator/components/com_installer/tmpl/install/default.php index 9ce12fb8c5d89..cf480503879e2 100644 --- a/administrator/components/com_installer/tmpl/install/default.php +++ b/administrator/components/com_installer/tmpl/install/default.php @@ -44,7 +44,10 @@ - enqueueMessage(Text::_('COM_INSTALLER_NO_INSTALLATION_PLUGINS_FOUND'), 'warning'); ?> +
+ + +
ftp) : ?> From 25f1f75cd95efb056e21d09098949e689ff6556b Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Wed, 22 Jul 2020 09:26:26 +0300 Subject: [PATCH 12/16] Add core.js dependency --- plugins/installer/folderinstaller/tmpl/default.php | 3 ++- plugins/installer/packageinstaller/tmpl/default.php | 3 ++- plugins/installer/urlinstaller/tmpl/default.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/installer/folderinstaller/tmpl/default.php b/plugins/installer/folderinstaller/tmpl/default.php index 3cc0d104096a7..c3c6f2e1229cf 100644 --- a/plugins/installer/folderinstaller/tmpl/default.php +++ b/plugins/installer/folderinstaller/tmpl/default.php @@ -15,7 +15,8 @@ Text::script('PLG_INSTALLER_FOLDERINSTALLER_NO_INSTALL_PATH'); -$this->app->getDocument()->getWebAssetManager()->registerAndUseScript('plg_installer_folderinstaller.folderinstaller', 'plg_installer_folderinstaller/folderinstaller.js'); +$this->app->getDocument()->getWebAssetManager() + ->registerAndUseScript('plg_installer_folderinstaller.folderinstaller', 'plg_installer_folderinstaller/folderinstaller.js', [], [], ['core']); ?> diff --git a/plugins/installer/packageinstaller/tmpl/default.php b/plugins/installer/packageinstaller/tmpl/default.php index 1ac5ca9a3851b..d3bd5b7aa6852 100644 --- a/plugins/installer/packageinstaller/tmpl/default.php +++ b/plugins/installer/packageinstaller/tmpl/default.php @@ -22,7 +22,8 @@ Text::script('PLG_INSTALLER_PACKAGEINSTALLER_UPLOAD_ERROR_EMPTY'); Text::script('COM_INSTALLER_MSG_WARNINGS_UPLOADFILETOOBIG'); -$this->app->getDocument()->getWebAssetManager()->registerAndUseScript('plg_installer_packageinstaller.packageinstaller', 'plg_installer_packageinstaller/packageinstaller.js'); +$this->app->getDocument()->getWebAssetManager() + ->registerAndUseScript('plg_installer_packageinstaller.packageinstaller', 'plg_installer_packageinstaller/packageinstaller.js', [], [], ['core']); $return = $this->app->input->getBase64('return'); $maxSizeBytes = FilesystemHelper::fileUploadMaxSize(false); diff --git a/plugins/installer/urlinstaller/tmpl/default.php b/plugins/installer/urlinstaller/tmpl/default.php index 5396719bd99d3..cf308532c03ca 100644 --- a/plugins/installer/urlinstaller/tmpl/default.php +++ b/plugins/installer/urlinstaller/tmpl/default.php @@ -15,7 +15,8 @@ Text::script('PLG_INSTALLER_URLINSTALLER_NO_URL'); -$this->app->getDocument()->getWebAssetManager()->registerAndUseScript('plg_installer_urlinstaller.urlinstaller', 'plg_installer_urlinstaller/urlinstaller.js'); +$this->app->getDocument()->getWebAssetManager() + ->registerAndUseScript('plg_installer_urlinstaller.urlinstaller', 'plg_installer_urlinstaller/urlinstaller.js', [], [], ['core']); ?> From e108c062229dd47cc84ac185dd88e7882e9a8560 Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Wed, 22 Jul 2020 09:57:24 +0300 Subject: [PATCH 13/16] CS --- build/media_source/com_installer/js/installer.es6.js | 6 ++---- .../js/folderinstaller.es6.js | 4 ++-- .../js/packageinstaller.es6.js | 2 +- .../plg_installer_urlinstaller/js/urlinstaller.es6.js | 8 ++++---- .../plg_installer_webinstaller/js/client.es6.js | 4 ++-- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/build/media_source/com_installer/js/installer.es6.js b/build/media_source/com_installer/js/installer.es6.js index 67e3b9b09f464..8ca5d517becf6 100644 --- a/build/media_source/com_installer/js/installer.es6.js +++ b/build/media_source/com_installer/js/installer.es6.js @@ -3,9 +3,7 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -Joomla = window.Joomla || {}; - -((Joomla) => { +(() => { 'use strict'; document.addEventListener('DOMContentLoaded', () => { @@ -21,4 +19,4 @@ Joomla = window.Joomla || {}; loading.style.marginTop = '-10px'; } }); -})(Joomla); +})(); diff --git a/build/media_source/plg_installer_folderinstaller/js/folderinstaller.es6.js b/build/media_source/plg_installer_folderinstaller/js/folderinstaller.es6.js index 45392262cb5c0..da9f4e3341ea0 100644 --- a/build/media_source/plg_installer_folderinstaller/js/folderinstaller.es6.js +++ b/build/media_source/plg_installer_folderinstaller/js/folderinstaller.es6.js @@ -16,8 +16,8 @@ Joomla = window.Joomla || {}; if (form.install_directory.value === '') { Joomla.renderMessages({ warning: [Joomla.Text._('PLG_INSTALLER_FOLDERINSTALLER_NO_INSTALL_PATH')] }); } else { - const loading = document.getElementById('loading'); - if (loading) { + const loading = document.getElementById('loading'); + if (loading) { loading.classList.remove('hidden'); } diff --git a/build/media_source/plg_installer_packageinstaller/js/packageinstaller.es6.js b/build/media_source/plg_installer_packageinstaller/js/packageinstaller.es6.js index a55cac457612a..2d0226ec75889 100644 --- a/build/media_source/plg_installer_packageinstaller/js/packageinstaller.es6.js +++ b/build/media_source/plg_installer_packageinstaller/js/packageinstaller.es6.js @@ -9,7 +9,7 @@ Joomla = window.Joomla || {}; 'use strict'; document.addEventListener('DOMContentLoaded', () => { - Joomla.submitbuttonpackage = () => { + Joomla.submitbuttonpackage = () => { const form = document.getElementById('adminForm'); // do field validation diff --git a/build/media_source/plg_installer_urlinstaller/js/urlinstaller.es6.js b/build/media_source/plg_installer_urlinstaller/js/urlinstaller.es6.js index 2c1986c340d28..75c76ee7530bd 100644 --- a/build/media_source/plg_installer_urlinstaller/js/urlinstaller.es6.js +++ b/build/media_source/plg_installer_urlinstaller/js/urlinstaller.es6.js @@ -16,10 +16,10 @@ Joomla = window.Joomla || {}; if (form.install_url.value === '' || form.install_url.value === 'http://' || form.install_url.value === 'https://') { Joomla.renderMessages({ warning: [Joomla.Text._('PLG_INSTALLER_URLINSTALLER_NO_URL')] }); } else { - const loading = document.getElementById('loading'); - if (loading) { - loading.classList.remove('hidden'); - } + const loading = document.getElementById('loading'); + if (loading) { + loading.classList.remove('hidden'); + } form.installtype.value = 'url'; form.submit(); diff --git a/build/media_source/plg_installer_webinstaller/js/client.es6.js b/build/media_source/plg_installer_webinstaller/js/client.es6.js index 3a87f0a23aeb7..4fdd0fe616083 100644 --- a/build/media_source/plg_installer_webinstaller/js/client.es6.js +++ b/build/media_source/plg_installer_webinstaller/js/client.es6.js @@ -367,7 +367,7 @@ if (!Joomla) { form.installtype.value = 'url'; form.submit(); } - }; + } submitButtonWeb() { const form = document.getElementById('adminForm'); @@ -382,7 +382,7 @@ if (!Joomla) { form.installtype.value = 'web'; form.submit(); } - }; + } } document.addEventListener('DOMContentLoaded', () => { From aa3c82f2232ccda8e2b938843cfb3debd7c6eb67 Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Wed, 22 Jul 2020 09:59:46 +0300 Subject: [PATCH 14/16] CS --- .../plg_installer_urlinstaller/js/urlinstaller.es6.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/media_source/plg_installer_urlinstaller/js/urlinstaller.es6.js b/build/media_source/plg_installer_urlinstaller/js/urlinstaller.es6.js index 75c76ee7530bd..0ee602dc49195 100644 --- a/build/media_source/plg_installer_urlinstaller/js/urlinstaller.es6.js +++ b/build/media_source/plg_installer_urlinstaller/js/urlinstaller.es6.js @@ -19,7 +19,7 @@ Joomla = window.Joomla || {}; const loading = document.getElementById('loading'); if (loading) { loading.classList.remove('hidden'); - } + } form.installtype.value = 'url'; form.submit(); From f9ad2c41b6bc276d69280c8525ed080101909192 Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Wed, 22 Jul 2020 10:19:53 +0300 Subject: [PATCH 15/16] Hound --- build/media_source/plg_installer_webinstaller/js/client.es6.js | 1 + 1 file changed, 1 insertion(+) diff --git a/build/media_source/plg_installer_webinstaller/js/client.es6.js b/build/media_source/plg_installer_webinstaller/js/client.es6.js index 4fdd0fe616083..cf1798acf7f28 100644 --- a/build/media_source/plg_installer_webinstaller/js/client.es6.js +++ b/build/media_source/plg_installer_webinstaller/js/client.es6.js @@ -352,6 +352,7 @@ if (!Joomla) { return true; } + // eslint-disable-next-line class-methods-use-this submitButtonUrl() { const form = document.getElementById('adminForm'); From 080e1efc0c6b63355d8f04d5e7bb0ee7d48c84e5 Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Wed, 22 Jul 2020 11:23:56 +0300 Subject: [PATCH 16/16] Defer --- plugins/installer/folderinstaller/tmpl/default.php | 8 +++++++- plugins/installer/packageinstaller/tmpl/default.php | 8 +++++++- plugins/installer/urlinstaller/tmpl/default.php | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/plugins/installer/folderinstaller/tmpl/default.php b/plugins/installer/folderinstaller/tmpl/default.php index c3c6f2e1229cf..fb0efe5f1090e 100644 --- a/plugins/installer/folderinstaller/tmpl/default.php +++ b/plugins/installer/folderinstaller/tmpl/default.php @@ -16,7 +16,13 @@ Text::script('PLG_INSTALLER_FOLDERINSTALLER_NO_INSTALL_PATH'); $this->app->getDocument()->getWebAssetManager() - ->registerAndUseScript('plg_installer_folderinstaller.folderinstaller', 'plg_installer_folderinstaller/folderinstaller.js', [], [], ['core']); + ->registerAndUseScript( + 'plg_installer_folderinstaller.folderinstaller', + 'plg_installer_folderinstaller/folderinstaller.js', + [], + ['defer' => true], + ['core'] + ); ?> diff --git a/plugins/installer/packageinstaller/tmpl/default.php b/plugins/installer/packageinstaller/tmpl/default.php index d3bd5b7aa6852..6721472871ebe 100644 --- a/plugins/installer/packageinstaller/tmpl/default.php +++ b/plugins/installer/packageinstaller/tmpl/default.php @@ -23,7 +23,13 @@ Text::script('COM_INSTALLER_MSG_WARNINGS_UPLOADFILETOOBIG'); $this->app->getDocument()->getWebAssetManager() - ->registerAndUseScript('plg_installer_packageinstaller.packageinstaller', 'plg_installer_packageinstaller/packageinstaller.js', [], [], ['core']); + ->registerAndUseScript( + 'plg_installer_packageinstaller.packageinstaller', + 'plg_installer_packageinstaller/packageinstaller.js', + [], + ['defer' => true], + ['core'] + ); $return = $this->app->input->getBase64('return'); $maxSizeBytes = FilesystemHelper::fileUploadMaxSize(false); diff --git a/plugins/installer/urlinstaller/tmpl/default.php b/plugins/installer/urlinstaller/tmpl/default.php index cf308532c03ca..38072ecd5ced6 100644 --- a/plugins/installer/urlinstaller/tmpl/default.php +++ b/plugins/installer/urlinstaller/tmpl/default.php @@ -16,7 +16,7 @@ Text::script('PLG_INSTALLER_URLINSTALLER_NO_URL'); $this->app->getDocument()->getWebAssetManager() - ->registerAndUseScript('plg_installer_urlinstaller.urlinstaller', 'plg_installer_urlinstaller/urlinstaller.js', [], [], ['core']); + ->registerAndUseScript('plg_installer_urlinstaller.urlinstaller', 'plg_installer_urlinstaller/urlinstaller.js', [], ['defer' => true], ['core']); ?>