[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 (function () { 2 'use strict'; 3 4 /** 5 * @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org> 6 * @license GNU General Public License version 2 or later; see LICENSE.txt 7 */ 8 Joomla = window.Joomla || {}; 9 /** 10 * Method that switches a given class to the following elements of the element provided 11 * 12 * @param {HTMLElement} element The reference element 13 * @param {string} className The class name to be toggled 14 */ 15 16 Joomla.toggleAllNextElements = function (element, className) { 17 var getNextSiblings = function getNextSiblings(el) { 18 var siblings = []; 19 /* eslint-disable no-cond-assign,no-param-reassign */ 20 21 do { 22 siblings.push(el); 23 } while ((el = el.nextElementSibling) !== null); 24 /* eslint-enable no-cond-assign,no-param-reassign */ 25 26 27 return siblings; 28 }; 29 30 var followingElements = getNextSiblings(element); 31 32 if (followingElements.length) { 33 followingElements.forEach(function (elem) { 34 if (elem.classList.contains(className)) { 35 elem.classList.remove(className); 36 } else { 37 elem.classList.add(className); 38 } 39 }); 40 } 41 }; 42 43 (function () { 44 document.addEventListener('DOMContentLoaded', function () { 45 var dropDownBtn = document.getElementById('toolbar-status-group'); 46 47 if (!dropDownBtn) { 48 return; 49 } 50 51 var transitions = [].slice.call(dropDownBtn.querySelectorAll('.button-transition')); 52 var headline = dropDownBtn.querySelector('.button-transition-headline'); 53 var separator = dropDownBtn.querySelector('.button-transition-separator'); 54 var itemList = document.querySelector('table.itemList'); 55 var itemListRows = []; 56 var transitionIds = []; 57 58 if (itemList) { 59 itemListRows = [].slice.call(itemList.querySelectorAll('tbody tr')); 60 } 61 62 function enableTransitions() { 63 if (transitionIds.length) { 64 var availableTrans = transitionIds.shift(); 65 66 var _loop = function _loop() { 67 var compareTrans = transitionIds.shift(); 68 availableTrans = availableTrans.filter(function (id) { 69 return compareTrans.indexOf(id) !== -1; 70 }); 71 }; 72 73 while (transitionIds.length) { 74 _loop(); 75 } 76 77 if (availableTrans.length) { 78 if (headline) { 79 headline.classList.remove('d-none'); 80 } 81 82 if (separator) { 83 separator.classList.remove('d-none'); 84 } 85 } 86 87 availableTrans.forEach(function (trans) { 88 var elem = dropDownBtn.querySelector(".transition-" + trans); 89 90 if (elem) { 91 elem.parentNode.classList.remove('d-none'); 92 } 93 }); 94 } 95 } // check for common attributes for which the conditions for a transition are possible or not 96 // and save this information in a boolean variable. 97 98 99 function collectTransitions(row) { 100 transitionIds.push(row.getAttribute('data-transitions').split(',')); 101 } // listen to click event to get selected rows 102 103 104 if (itemList) { 105 itemList.addEventListener('click', function () { 106 transitions.forEach(function (trans) { 107 trans.parentNode.classList.add('d-none'); 108 }); 109 110 if (headline) { 111 headline.classList.add('d-none'); 112 } 113 114 if (separator) { 115 separator.classList.add('d-none'); 116 } 117 118 transitionIds = []; 119 itemListRows.forEach(function (el) { 120 var checkedBox = el.querySelector('input[type=checkbox]'); 121 122 if (checkedBox.checked) { 123 var parentTr = checkedBox.closest('tr'); 124 collectTransitions(parentTr); 125 } 126 }); 127 enableTransitions(); 128 }); 129 } 130 }); 131 })(); 132 133 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |