CoreFiles by mySites.guru
admin-select-modal.es6.js36 lines, 1,176 bytes, from Joomla_4.0.0-alpha12-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha11
md5
3e844b6c5e95ad2c2e2b9b45cd0a47c4
sha1
b3b8b8ddcd58ed2b960816c2f1a71521e10ea4cf
sha256
d78671a2b8457b4eebb2388ac66b655d7be8f53ceeb8b2990f01940eeff9f921
/**
* PLEASE DO NOT MODIFY THIS FILE. WORK ON THE ES6 VERSION.
* OTHERWISE YOUR CHANGES WILL BE REPLACED ON THE NEXT BUILD.
**/

/**
 * @copyright  Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */
(document => {
  'use strict';

  document.addEventListener('DOMContentLoaded', () => {
    const elems = document.querySelectorAll('#new-modules-list a.select-link');
    elems.forEach(elem => {
      elem.addEventListener('click', event => {
        let targetElem = event.currentTarget; // There is some bug with events in iframe where currentTarget is "null"
        // => prevent this here by bubble up

        if (!targetElem) {
          targetElem = event.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 2 releases, Joomla 4.0.0-alpha11 to 4.0.0-alpha12. See them all, or every version of this file.