diff --git a/administrator/components/com_banners/src/View/Banners/HtmlView.php b/administrator/components/com_banners/src/View/Banners/HtmlView.php index 9d6108a4bdb76..6c23dde369712 100644 --- a/administrator/components/com_banners/src/View/Banners/HtmlView.php +++ b/administrator/components/com_banners/src/View/Banners/HtmlView.php @@ -195,7 +195,11 @@ protected function addToolbar(): void && $user->authorise('core.edit.state', 'com_banners') ) { $childBar->popupButton('batch', 'JTOOLBAR_BATCH') - ->selector('collapseModal') + ->popupType('inline') + ->textHeader(Text::_('COM_BANNERS_BATCH_OPTIONS')) + ->url('#joomla-dialog-batch') + ->modalWidth('800px') + ->modalHeight('fit-content') ->listCheck(true); } } diff --git a/administrator/components/com_banners/tmpl/banners/default.php b/administrator/components/com_banners/tmpl/banners/default.php index d5eaca038ecb5..bda322fb40d58 100644 --- a/administrator/components/com_banners/tmpl/banners/default.php +++ b/administrator/components/com_banners/tmpl/banners/default.php @@ -182,15 +182,7 @@ && $user->authorise('core.edit', 'com_banners') && $user->authorise('core.edit.state', 'com_banners') ) : ?> - Text::_('COM_BANNERS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ], - $this->loadTemplate('batch_body') - ); ?> + diff --git a/administrator/components/com_banners/tmpl/banners/default_batch_body.php b/administrator/components/com_banners/tmpl/banners/default_batch_body.php index 66d0ca9f02e4a..244ff787d625e 100644 --- a/administrator/components/com_banners/tmpl/banners/default_batch_body.php +++ b/administrator/components/com_banners/tmpl/banners/default_batch_body.php @@ -12,6 +12,7 @@ use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Multilanguage; +use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; /** @var \Joomla\Component\Banners\Administrator\View\Banners\HtmlView $this */ @@ -19,7 +20,6 @@ $published = (int) $this->state->get('filter.published'); ?> -
@@ -45,3 +45,8 @@
+
+ + + +
diff --git a/administrator/components/com_banners/tmpl/banners/default_batch_footer.php b/administrator/components/com_banners/tmpl/banners/default_batch_footer.php deleted file mode 100644 index d1282ec1246fe..0000000000000 --- a/administrator/components/com_banners/tmpl/banners/default_batch_footer.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('_JEXEC') or die; - -use Joomla\CMS\Language\Text; - -/** @var \Joomla\Component\Banners\Administrator\View\Banners\HtmlView $this */ - -?> - - diff --git a/administrator/components/com_contact/src/View/Contacts/HtmlView.php b/administrator/components/com_contact/src/View/Contacts/HtmlView.php index 6d46155b55aed..0729e44c4f542 100644 --- a/administrator/components/com_contact/src/View/Contacts/HtmlView.php +++ b/administrator/components/com_contact/src/View/Contacts/HtmlView.php @@ -188,7 +188,11 @@ protected function addToolbar() && $user->authorise('core.edit.state', 'com_contact') ) { $childBar->popupButton('batch', 'JTOOLBAR_BATCH') - ->selector('collapseModal') + ->popupType('inline') + ->textHeader(Text::_('COM_CONTACT_BATCH_OPTIONS')) + ->url('#joomla-dialog-batch') + ->modalWidth('800px') + ->modalHeight('fit-content') ->listCheck(true); } } diff --git a/administrator/components/com_contact/tmpl/contacts/default.php b/administrator/components/com_contact/tmpl/contacts/default.php index c3a5ba73f1ebd..23ce7a5d46920 100644 --- a/administrator/components/com_contact/tmpl/contacts/default.php +++ b/administrator/components/com_contact/tmpl/contacts/default.php @@ -190,15 +190,7 @@ && $user->authorise('core.edit', 'com_contact') && $user->authorise('core.edit.state', 'com_contact') ) : ?> - Text::_('COM_CONTACT_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer'), - ], - $this->loadTemplate('batch_body') - ); ?> + diff --git a/administrator/components/com_contact/tmpl/contacts/default_batch_body.php b/administrator/components/com_contact/tmpl/contacts/default_batch_body.php index b62c65b9bdc7c..29e9a5e97f049 100644 --- a/administrator/components/com_contact/tmpl/contacts/default_batch_body.php +++ b/administrator/components/com_contact/tmpl/contacts/default_batch_body.php @@ -11,6 +11,7 @@ defined('_JEXEC') or die; use Joomla\CMS\Language\Multilanguage; +use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; $published = (int) $this->state->get('filter.published'); @@ -52,3 +53,8 @@ +
+ + + +
diff --git a/administrator/components/com_contact/tmpl/contacts/default_batch_footer.php b/administrator/components/com_contact/tmpl/contacts/default_batch_footer.php deleted file mode 100644 index 440ed84e4008b..0000000000000 --- a/administrator/components/com_contact/tmpl/contacts/default_batch_footer.php +++ /dev/null @@ -1,21 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('_JEXEC') or die; - -use Joomla\CMS\Language\Text; - -?> - - diff --git a/administrator/components/com_fields/src/View/Fields/HtmlView.php b/administrator/components/com_fields/src/View/Fields/HtmlView.php index 9e39fa46c0a8a..d22c0d7f26a72 100644 --- a/administrator/components/com_fields/src/View/Fields/HtmlView.php +++ b/administrator/components/com_fields/src/View/Fields/HtmlView.php @@ -175,7 +175,11 @@ protected function addToolbar() // Add a batch button if ($canDo->get('core.create') && $canDo->get('core.edit') && $canDo->get('core.edit.state')) { $childBar->popupButton('batch', 'JTOOLBAR_BATCH') - ->selector('collapseModal') + ->popupType('inline') + ->textHeader(Text::_('COM_FIELDS_VIEW_FIELDS_BATCH_OPTIONS')) + ->url('#joomla-dialog-batch') + ->modalWidth('800px') + ->modalHeight('fit-content') ->listCheck(true); } } diff --git a/administrator/components/com_fields/src/View/Groups/HtmlView.php b/administrator/components/com_fields/src/View/Groups/HtmlView.php index a445fac094129..ea9926f0607bb 100644 --- a/administrator/components/com_fields/src/View/Groups/HtmlView.php +++ b/administrator/components/com_fields/src/View/Groups/HtmlView.php @@ -177,7 +177,11 @@ protected function addToolbar() // Add a batch button if ($canDo->get('core.create') && $canDo->get('core.edit') && $canDo->get('core.edit.state')) { $childBar->popupButton('batch', 'JTOOLBAR_BATCH') - ->selector('collapseModal') + ->popupType('inline') + ->textHeader(Text::_('COM_FIELDS_VIEW_GROUPS_BATCH_OPTIONS')) + ->url('#joomla-dialog-batch') + ->modalWidth('800px') + ->modalHeight('fit-content') ->listCheck(true); } } diff --git a/administrator/components/com_fields/tmpl/fields/default.php b/administrator/components/com_fields/tmpl/fields/default.php index 020ffc76869b9..e44f3d0cc8d12 100644 --- a/administrator/components/com_fields/tmpl/fields/default.php +++ b/administrator/components/com_fields/tmpl/fields/default.php @@ -205,15 +205,7 @@ && $user->authorise('core.edit', $component) && $user->authorise('core.edit.state', $component) ) : ?> - Text::_('COM_FIELDS_VIEW_FIELDS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ], - $this->loadTemplate('batch_body') - ); ?> + diff --git a/administrator/components/com_fields/tmpl/fields/default_batch_body.php b/administrator/components/com_fields/tmpl/fields/default_batch_body.php index 5bfe7949720c1..2175b3b797f21 100644 --- a/administrator/components/com_fields/tmpl/fields/default_batch_body.php +++ b/administrator/components/com_fields/tmpl/fields/default_batch_body.php @@ -64,3 +64,8 @@ +
+ + + +
diff --git a/administrator/components/com_fields/tmpl/fields/default_batch_footer.php b/administrator/components/com_fields/tmpl/fields/default_batch_footer.php deleted file mode 100644 index b48333c6a5466..0000000000000 --- a/administrator/components/com_fields/tmpl/fields/default_batch_footer.php +++ /dev/null @@ -1,21 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('_JEXEC') or die; - -use Joomla\CMS\Language\Text; - -?> - - diff --git a/administrator/components/com_fields/tmpl/groups/default.php b/administrator/components/com_fields/tmpl/groups/default.php index d043bc7d3dfb1..7bf269c9c97b3 100644 --- a/administrator/components/com_fields/tmpl/groups/default.php +++ b/administrator/components/com_fields/tmpl/groups/default.php @@ -173,15 +173,7 @@ && $user->authorise('core.edit', $component) && $user->authorise('core.edit.state', $component) ) : ?> - Text::_('COM_FIELDS_VIEW_GROUPS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ], - $this->loadTemplate('batch_body') - ); ?> + diff --git a/administrator/components/com_fields/tmpl/groups/default_batch_body.php b/administrator/components/com_fields/tmpl/groups/default_batch_body.php index 4561bbdf1afc5..2b5ffb9c3cd03 100644 --- a/administrator/components/com_fields/tmpl/groups/default_batch_body.php +++ b/administrator/components/com_fields/tmpl/groups/default_batch_body.php @@ -11,6 +11,7 @@ defined('_JEXEC') or die; use Joomla\CMS\Language\Multilanguage; +use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; ?> @@ -30,3 +31,8 @@ +
+ + + +
diff --git a/administrator/components/com_fields/tmpl/groups/default_batch_footer.php b/administrator/components/com_fields/tmpl/groups/default_batch_footer.php deleted file mode 100644 index bc7cd3530c4e6..0000000000000 --- a/administrator/components/com_fields/tmpl/groups/default_batch_footer.php +++ /dev/null @@ -1,21 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('_JEXEC') or die; - -use Joomla\CMS\Language\Text; - -?> - - diff --git a/administrator/components/com_menus/src/View/Items/HtmlView.php b/administrator/components/com_menus/src/View/Items/HtmlView.php index f3c2f0d885c89..5f01072d44d69 100644 --- a/administrator/components/com_menus/src/View/Items/HtmlView.php +++ b/administrator/components/com_menus/src/View/Items/HtmlView.php @@ -355,9 +355,12 @@ protected function addToolbar() && $user->authorise('core.edit', 'com_menus') && $user->authorise('core.edit.state', 'com_menus') ) { - $childBar->popupButton('batch') - ->text('JTOOLBAR_BATCH') - ->selector('collapseModal') + $childBar->popupButton('batch', 'JTOOLBAR_BATCH') + ->popupType('inline') + ->textHeader(Text::_('COM_MENUS_BATCH_OPTIONS')) + ->url('#joomla-dialog-batch') + ->modalWidth('800px') + ->modalHeight('fit-content') ->listCheck(true); } } diff --git a/administrator/components/com_menus/tmpl/items/default.php b/administrator/components/com_menus/tmpl/items/default.php index 8abe15efd93e5..6e76fe5894fcb 100644 --- a/administrator/components/com_menus/tmpl/items/default.php +++ b/administrator/components/com_menus/tmpl/items/default.php @@ -269,15 +269,7 @@ authorise('core.create', 'com_menus') || $user->authorise('core.edit', 'com_menus')) : ?> - Text::_('COM_MENUS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ], - $this->loadTemplate('batch_body') - ); ?> + diff --git a/administrator/components/com_menus/tmpl/items/default_batch_body.php b/administrator/components/com_menus/tmpl/items/default_batch_body.php index eec75ecbfc1ec..7d0ee8fa7a24c 100644 --- a/administrator/components/com_menus/tmpl/items/default_batch_body.php +++ b/administrator/components/com_menus/tmpl/items/default_batch_body.php @@ -86,3 +86,11 @@ += 0 && $clientId == 1)) : ?> +
+ + + +
+ + diff --git a/administrator/components/com_menus/tmpl/items/default_batch_footer.php b/administrator/components/com_menus/tmpl/items/default_batch_footer.php deleted file mode 100644 index 4f2df096275cf..0000000000000 --- a/administrator/components/com_menus/tmpl/items/default_batch_footer.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('_JEXEC') or die; - -use Joomla\CMS\Factory; -use Joomla\CMS\Language\Text; - -$published = $this->state->get('filter.published'); -$clientId = $this->state->get('filter.client_id'); -$menuType = Factory::getApplication()->getUserState('com_menus.items.menutype', ''); -?> - -= 0 && $clientId == 1)) : ?> - - diff --git a/administrator/components/com_modules/src/View/Modules/HtmlView.php b/administrator/components/com_modules/src/View/Modules/HtmlView.php index 07a6a6db0f103..3a2a344ea3e18 100644 --- a/administrator/components/com_modules/src/View/Modules/HtmlView.php +++ b/administrator/components/com_modules/src/View/Modules/HtmlView.php @@ -218,7 +218,11 @@ protected function addToolbar() && $user->authorise('core.edit.state', 'com_modules') ) { $childBar->popupButton('batch', 'JTOOLBAR_BATCH') - ->selector('collapseModal') + ->popupType('inline') + ->textHeader(Text::_('COM_MODULES_BATCH_OPTIONS')) + ->url('#joomla-dialog-batch') + ->modalWidth('800px') + ->modalHeight('fit-content') ->listCheck(true); } diff --git a/administrator/components/com_modules/tmpl/modules/default.php b/administrator/components/com_modules/tmpl/modules/default.php index aefc841d067a9..0f4c86e86e2c0 100644 --- a/administrator/components/com_modules/tmpl/modules/default.php +++ b/administrator/components/com_modules/tmpl/modules/default.php @@ -203,15 +203,7 @@ && $user->authorise('core.edit', 'com_modules') && $user->authorise('core.edit.state', 'com_modules') ) : ?> - Text::_('COM_MODULES_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer'), - ], - $this->loadTemplate('batch_body') - ); ?> + diff --git a/administrator/components/com_modules/tmpl/modules/default_batch_body.php b/administrator/components/com_modules/tmpl/modules/default_batch_body.php index 65e161ed686a6..381a9aad488df 100644 --- a/administrator/components/com_modules/tmpl/modules/default_batch_body.php +++ b/administrator/components/com_modules/tmpl/modules/default_batch_body.php @@ -81,3 +81,8 @@ +
+ + + +
diff --git a/administrator/components/com_modules/tmpl/modules/default_batch_footer.php b/administrator/components/com_modules/tmpl/modules/default_batch_footer.php deleted file mode 100644 index 0a684547cb746..0000000000000 --- a/administrator/components/com_modules/tmpl/modules/default_batch_footer.php +++ /dev/null @@ -1,21 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('_JEXEC') or die; - -use Joomla\CMS\Language\Text; - -?> - - diff --git a/administrator/components/com_newsfeeds/src/View/Newsfeeds/HtmlView.php b/administrator/components/com_newsfeeds/src/View/Newsfeeds/HtmlView.php index b8fdb8c116321..e01ebf389f075 100644 --- a/administrator/components/com_newsfeeds/src/View/Newsfeeds/HtmlView.php +++ b/administrator/components/com_newsfeeds/src/View/Newsfeeds/HtmlView.php @@ -185,7 +185,11 @@ protected function addToolbar() && $user->authorise('core.edit.state', 'com_newsfeeds') ) { $childBar->popupButton('batch', 'JTOOLBAR_BATCH') - ->selector('collapseModal') + ->popupType('inline') + ->textHeader(Text::_('COM_NEWSFEEDS_BATCH_OPTIONS')) + ->url('#joomla-dialog-batch') + ->modalWidth('800px') + ->modalHeight('fit-content') ->listCheck(true); } } diff --git a/administrator/components/com_newsfeeds/tmpl/newsfeeds/default.php b/administrator/components/com_newsfeeds/tmpl/newsfeeds/default.php index 46b12cdd58e5b..77152aac015ca 100644 --- a/administrator/components/com_newsfeeds/tmpl/newsfeeds/default.php +++ b/administrator/components/com_newsfeeds/tmpl/newsfeeds/default.php @@ -181,15 +181,7 @@ && $user->authorise('core.edit', 'com_newsfeeds') && $user->authorise('core.edit.state', 'com_newsfeeds') ) : ?> - Text::_('COM_NEWSFEEDS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer'), - ], - $this->loadTemplate('batch_body') - ); ?> + diff --git a/administrator/components/com_newsfeeds/tmpl/newsfeeds/default_batch_body.php b/administrator/components/com_newsfeeds/tmpl/newsfeeds/default_batch_body.php index 0578eea2932b0..00db4d7e9324f 100644 --- a/administrator/components/com_newsfeeds/tmpl/newsfeeds/default_batch_body.php +++ b/administrator/components/com_newsfeeds/tmpl/newsfeeds/default_batch_body.php @@ -11,6 +11,7 @@ defined('_JEXEC') or die; use Joomla\CMS\Language\Multilanguage; +use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; $published = (int) $this->state->get('filter.published'); @@ -46,3 +47,8 @@ +
+ + + +
diff --git a/administrator/components/com_newsfeeds/tmpl/newsfeeds/default_batch_footer.php b/administrator/components/com_newsfeeds/tmpl/newsfeeds/default_batch_footer.php deleted file mode 100644 index f43ed8b7b5b8b..0000000000000 --- a/administrator/components/com_newsfeeds/tmpl/newsfeeds/default_batch_footer.php +++ /dev/null @@ -1,21 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('_JEXEC') or die; - -use Joomla\CMS\Language\Text; - -?> - - diff --git a/administrator/components/com_tags/src/View/Tags/HtmlView.php b/administrator/components/com_tags/src/View/Tags/HtmlView.php index 3ea735fbef7d7..a5bfc9040619f 100644 --- a/administrator/components/com_tags/src/View/Tags/HtmlView.php +++ b/administrator/components/com_tags/src/View/Tags/HtmlView.php @@ -175,7 +175,11 @@ protected function addToolbar() // Add a batch button if ($canDo->get('core.create') && $canDo->get('core.edit') && $canDo->get('core.edit.state')) { $childBar->popupButton('batch', 'JTOOLBAR_BATCH') - ->selector('collapseModal') + ->popupType('inline') + ->textHeader(Text::_('COM_TAGS_BATCH_OPTIONS')) + ->url('#joomla-dialog-batch') + ->modalWidth('800px') + ->modalHeight('fit-content') ->listCheck(true); } } diff --git a/administrator/components/com_tags/tmpl/tags/default.php b/administrator/components/com_tags/tmpl/tags/default.php index acb1905feacd5..cc850a2cf85e0 100644 --- a/administrator/components/com_tags/tmpl/tags/default.php +++ b/administrator/components/com_tags/tmpl/tags/default.php @@ -257,15 +257,7 @@ && $user->authorise('core.edit', 'com_tags') && $user->authorise('core.edit.state', 'com_tags') ) : ?> - Text::_('COM_TAGS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer'), - ], - $this->loadTemplate('batch_body') - ); ?> + diff --git a/administrator/components/com_tags/tmpl/tags/default_batch_body.php b/administrator/components/com_tags/tmpl/tags/default_batch_body.php index e0c8ffc4c0faa..ad996a4f58883 100644 --- a/administrator/components/com_tags/tmpl/tags/default_batch_body.php +++ b/administrator/components/com_tags/tmpl/tags/default_batch_body.php @@ -11,6 +11,7 @@ defined('_JEXEC') or die; use Joomla\CMS\Language\Multilanguage; +use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; ?> @@ -30,3 +31,8 @@ +
+ + + +
diff --git a/administrator/components/com_tags/tmpl/tags/default_batch_footer.php b/administrator/components/com_tags/tmpl/tags/default_batch_footer.php deleted file mode 100644 index c448ec1ba0dd8..0000000000000 --- a/administrator/components/com_tags/tmpl/tags/default_batch_footer.php +++ /dev/null @@ -1,21 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('_JEXEC') or die; - -use Joomla\CMS\Language\Text; - -?> - - diff --git a/administrator/components/com_users/src/View/Users/HtmlView.php b/administrator/components/com_users/src/View/Users/HtmlView.php index 9298ed0c5825d..eafa9c9f55daa 100644 --- a/administrator/components/com_users/src/View/Users/HtmlView.php +++ b/administrator/components/com_users/src/View/Users/HtmlView.php @@ -161,7 +161,11 @@ protected function addToolbar() && $user->authorise('core.edit.state', 'com_users') ) { $childBar->popupButton('batch', 'JTOOLBAR_BATCH') - ->selector('collapseModal') + ->popupType('inline') + ->textHeader(Text::_('COM_USERS_BATCH_OPTIONS')) + ->url('#joomla-dialog-batch') + ->modalWidth('800px') + ->modalHeight('fit-content') ->listCheck(true); } diff --git a/administrator/components/com_users/tmpl/users/default.php b/administrator/components/com_users/tmpl/users/default.php index 46e6d8f734b93..08bf5c876581e 100644 --- a/administrator/components/com_users/tmpl/users/default.php +++ b/administrator/components/com_users/tmpl/users/default.php @@ -214,15 +214,7 @@ && $loggeduser->authorise('core.edit', 'com_users') && $loggeduser->authorise('core.edit.state', 'com_users') ) : ?> - Text::_('COM_USERS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer'), - ], - $this->loadTemplate('batch_body') - ); ?> + diff --git a/administrator/components/com_users/tmpl/users/default_batch_body.php b/administrator/components/com_users/tmpl/users/default_batch_body.php index 4649e4271c0ce..c5b11db6cceea 100644 --- a/administrator/components/com_users/tmpl/users/default_batch_body.php +++ b/administrator/components/com_users/tmpl/users/default_batch_body.php @@ -64,3 +64,8 @@ +
+ + + +
diff --git a/administrator/components/com_users/tmpl/users/default_batch_footer.php b/administrator/components/com_users/tmpl/users/default_batch_footer.php deleted file mode 100644 index e8db055384e61..0000000000000 --- a/administrator/components/com_users/tmpl/users/default_batch_footer.php +++ /dev/null @@ -1,21 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('_JEXEC') or die; - -use Joomla\CMS\Language\Text; - -?> - - diff --git a/build/media_source/com_fields/js/admin-fields-default-batch.es6.js b/build/media_source/com_fields/js/admin-fields-default-batch.es6.js index 1b9319e130dc3..3d70d0d43d9f9 100644 --- a/build/media_source/com_fields/js/admin-fields-default-batch.es6.js +++ b/build/media_source/com_fields/js/admin-fields-default-batch.es6.js @@ -2,13 +2,15 @@ * @copyright (C) 2018 Open Source Matters, Inc. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -document.addEventListener('DOMContentLoaded', () => { - 'use strict'; +const setUp = (container) => { + const batchSelector = container.getElementById('batch-group-id'); + const batchCopyMove = container.getElementById('batch-copy-move'); - const batchSelector = document.getElementById('batch-group-id'); - const batchCopyMove = document.getElementById('batch-copy-move'); - batchCopyMove.classList.add('hidden'); + if (!container || !batchCopyMove) { + return; + } + batchCopyMove.classList.add('hidden'); batchSelector.addEventListener('change', () => { if (batchSelector.value === 'nogroup' || batchSelector.value !== '') { batchCopyMove.classList.remove('hidden'); @@ -16,4 +18,6 @@ document.addEventListener('DOMContentLoaded', () => { batchCopyMove.classList.add('hidden'); } }, false); -}); +}; +setUp(document); +document.addEventListener('joomla:loaded', ({ target }) => setUp(target));