[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/com_modules/js/ -> admin-select-modal.js (source)

   1  /**
   2   * @copyright  (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
   3   * @license    GNU General Public License version 2 or later; see LICENSE.txt
   4   */
   5  (document => {
   6  
   7    document.addEventListener('DOMContentLoaded', () => {
   8      const elems = document.querySelectorAll('#new-modules-list a.select-link');
   9      elems.forEach(elem => {
  10        elem.addEventListener('click', ({
  11          currentTarget,
  12          target
  13        }) => {
  14          let targetElem = currentTarget; // There is some bug with events in iframe where currentTarget is "null"
  15          // => prevent this here by bubble up
  16  
  17          if (!targetElem) {
  18            targetElem = target;
  19  
  20            if (targetElem && !targetElem.classList.contains('select-link')) {
  21              targetElem = targetElem.parentNode;
  22            }
  23          }
  24  
  25          const functionName = targetElem.getAttribute('data-function');
  26  
  27          if (functionName && typeof window.parent[functionName] === 'function') {
  28            window.parent[functionName](targetElem);
  29          }
  30        });
  31      });
  32    });
  33  })(document);


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer