-
-
Couldn't load subscription status.
- Fork 3.7k
[4.0] drop jQuery #21575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.0] drop jQuery #21575
Changes from 3 commits
717ac55
fe08409
c9b40b8
569d068
0991f3f
8473b72
d872e48
4e9cff1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,16 +12,24 @@ | |
| use Joomla\CMS\Language\Text; | ||
| use Joomla\CMS\HTML\HTMLHelper; | ||
|
|
||
| JFactory::getDocument()->addScriptDeclaration(" | ||
| jQuery('#exampleModal').on('hide.bs.modal', function (e) { | ||
| $js = <<<JS | ||
|
||
| (function() { | ||
| var element = document.getElementById('exampleModal'); | ||
| if (element) { | ||
| element.addEventListener('hide.bs.modal', function() { | ||
| document.getElementById('batch-category-id').value = ''; | ||
| document.getElementById('batch-access').value = ''; | ||
| document.getElementById('batch-language-id').value = ''; | ||
| document.getElementById('batch-user-id').value = ''; | ||
| document.getElementById('batch-tag-id').value = ''; | ||
| document.getElementById('batch-workflowstage-id').value = ''; | ||
| }); | ||
| "); | ||
| } | ||
| })(); | ||
| JS; | ||
|
|
||
| // @todo move the script to a file | ||
| JFactory::getDocument()->addScriptDeclaration($js); | ||
|
|
||
| HTMLHelper::_('script', 'com_content/admin-articles-default-batch-footer.js', ['relative' => true, 'version' => 'auto']); | ||
| ?> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,20 +49,22 @@ | |
| HTMLHelper::_('sortablelist.sortable', 'articleList', 'adminForm', strtolower($listDirn), $saveOrderingUrl); | ||
| } | ||
|
|
||
| $js = " | ||
| ;(function($) | ||
| { | ||
| $(function() | ||
| { | ||
| $('.article-status').on('click', function(e) | ||
| { | ||
| e.stopPropagation(); | ||
| }); | ||
| $js = <<<JS | ||
| (function() { | ||
| document.addEventListener('DOMContentLoaded', function() { | ||
| var elements = [].slice.call(document.querySelectorAll('.article-status')); | ||
|
||
| elements.forEach(function (element) { | ||
| element.addEventListener('click', function(event) { | ||
| event.stopPropagation(); | ||
| }); | ||
| })(jQuery); | ||
| "; | ||
| }); | ||
| }); | ||
| })(); | ||
| JS; | ||
|
|
||
| \Joomla\CMS\Factory::getDocument()->addScriptDeclaration($js); | ||
| // @todo mode the script to a file | ||
| Factory::getDocument()->addScriptDeclaration($js); | ||
|
|
||
| ?> | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,22 +21,36 @@ | |
| Text::script('JGLOBAL_EXPAND_CATEGORIES'); | ||
| Text::script('JGLOBAL_COLLAPSE_CATEGORIES'); | ||
|
|
||
| Factory::getDocument()->addScriptDeclaration(" | ||
| jQuery(function($) { | ||
| $('.categories-list').find('[id^=category-btn-]').each(function(index, btn) { | ||
| var btn = $(btn); | ||
| btn.on('click', function() { | ||
| btn.find('span').toggleClass('icon-plus'); | ||
| btn.find('span').toggleClass('icon-minus'); | ||
| if (btn.attr('aria-label') === Joomla.JText._('JGLOBAL_EXPAND_CATEGORIES')) | ||
| { | ||
| btn.attr('aria-label', Joomla.JText._('JGLOBAL_COLLAPSE_CATEGORIES')); | ||
| } else { | ||
| btn.attr('aria-label', Joomla.JText._('JGLOBAL_EXPAND_CATEGORIES')); | ||
| } | ||
| }); | ||
| $js = <<<JS | ||
| (function() { | ||
| document.addEventListener('DOMContentLoaded', function() { | ||
| var categories = [].slice.call(document.querySelectorAll('.categories-list')); | ||
| categories.forEach(function(category) { | ||
| var buttons = [].slice.call(document.querySelectorAll('.categories-list')); | ||
|
||
| buttons.forEach(function(button) { | ||
| var span = button.querySelector('span'); | ||
| if(span) { | ||
| span.classList.toggle('icon-plus') | ||
| span.classList.toggle('icon-minus') | ||
| } | ||
| if (button.getAttribute('aria-label') === Joomla.JText._('JGLOBAL_EXPAND_CATEGORIES')) | ||
| { | ||
| button.setAttribute('aria-label', Joomla.JText._('JGLOBAL_COLLAPSE_CATEGORIES')); | ||
| } else { | ||
| button.setAttribute('aria-label', Joomla.JText._('JGLOBAL_EXPAND_CATEGORIES')); | ||
| } | ||
| }) | ||
| }) | ||
| }); | ||
| });"); | ||
| })(); | ||
| JS; | ||
|
|
||
| // @todo move script to a file | ||
| Factory::getDocument()->addScriptDeclaration($js); | ||
| ?> | ||
| <div class="com-content-categories categories-list"> | ||
| <?php | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove whitespace.