[ 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) 2021 Open Source Matters, Inc. <https://www.joomla.org> 6 * @license GNU General Public License version 2 or later; see LICENSE.txt 7 */ 8 9 /** 10 * Toggles the display of inline help DIVs 11 * 12 * @param {String} toggleClass The class name of the DIVs to toggle display for 13 */ 14 Joomla.toggleInlineHelp = function (toggleClass) { 15 [].slice.call(document.querySelectorAll("div." + toggleClass)).forEach(function (elDiv) { 16 // Toggle the visibility of the node by toggling the 'd-none' Bootstrap class. 17 elDiv.classList.toggle('d-none'); // The ID of the description whose visibility is toggled. 18 19 var myId = elDiv.id; // The ID of the control described by this node (same ID, minus the '-desc' suffix). 20 21 var controlId = myId ? myId.substr(0, myId.length - 5) : null; // Get the control described by this node. 22 23 var elControl = controlId ? document.getElementById(controlId) : null; // Is this node hidden? 24 25 var isHidden = elDiv.classList.contains('d-none'); // If we do not have a control we will exit early 26 27 if (!controlId || !elControl) { 28 return; 29 } // Unset the aria-describedby attribute in the control when the description is hidden and vice–versa. 30 31 32 if (isHidden && elControl.hasAttribute('aria-describedby')) { 33 elControl.removeAttribute('aria-describedby'); 34 } else if (!isHidden) { 35 elControl.setAttribute('aria-describedby', myId); 36 } 37 }); 38 }; // Initialisation. Clicking on anything with the button-inlinehelp class will toggle the inline help. 39 40 41 [].slice.call(document.querySelectorAll('.button-inlinehelp')).forEach(function (elToggler) { 42 var _elToggler$dataset$cl; 43 44 // The class of the DIVs to toggle visibility on is defined by the data-class attribute of the click target. 45 var toggleClass = (_elToggler$dataset$cl = elToggler.dataset.class) != null ? _elToggler$dataset$cl : 'hide-aware-inline-help'; 46 var collection = document.getElementsByClassName(toggleClass); // no description => hide inlinehelp button 47 48 if (collection.length === 0) { 49 elToggler.classList.add('d-none'); 50 return; 51 } // Add the click handler. 52 53 54 elToggler.addEventListener('click', function (event) { 55 event.preventDefault(); 56 Joomla.toggleInlineHelp(toggleClass); 57 }); 58 }); 59 60 })();
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 |