CoreFiles by mySites.guru
admin-select-modal.js31 lines, 1,032 bytes, from Joomla_5.2.4-Stable-Full_Package.zip
Raw History Compare with 5.2.3
md5
282f055f4e22228163220ce6fc798921
sha1
91792c51877f3a1110ac9f897f7e8faf14e2fe1f
sha256
f75e576905286be98ce81078ca4138a813d4497cc7185b1ab4e81b6ca0d5c345
/**
 * @copyright  (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

(document => {

  document.addEventListener('DOMContentLoaded', () => {
    document.querySelectorAll('#new-modules-list a.select-link').forEach(elem => {
      elem.addEventListener('click', ({
        currentTarget,
        target
      }) => {
        let targetElem = currentTarget;

        // There is some bug with events in iframe where currentTarget is "null"
        // => prevent this here by bubble up
        if (!targetElem) {
          targetElem = target;
          if (targetElem && !targetElem.classList.contains('select-link')) {
            targetElem = targetElem.parentNode;
          }
        }
        const functionName = targetElem.getAttribute('data-function');
        if (functionName && typeof window.parent[functionName] === 'function') {
          window.parent[functionName](targetElem);
        }
      });
    });
  });
})(document);

The same content is in 132 releases, Joomla 5.1.0-beta2 to 6.2.1-rc1. See them all, or every version of this file.