CoreFiles by mySites.guru
admin-modules-modal.es6.js49 lines, 1,517 bytes, from Joomla_4.0.0-alpha12-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha11
md5
d79123b666b045728219631095f0cbf8
sha1
5e0d0fbfb6a47e9daadb9c80adde644141184e5c
sha256
83fe7ba287f24c1add28045a066e8f20c2ccd2fcc79014c2461a782424b22eaf
/**
* 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
 */
Joomla = window.Joomla || {};

(document => {
  'use strict';

  document.addEventListener('DOMContentLoaded', () => {
    window.jSelectModuleType = () => {
      const elements = document.querySelectorAll('#moduleDashboardAddModal .modal-footer .btn');

      if (elements.length) {
        elements.forEach(button => {
          button.classList.remove('hidden');
        });
      }
    };

    const buttons = document.querySelectorAll('#moduleDashboardAddModal .modal-footer .btn');

    if (buttons.length) {
      buttons.forEach(button => {
        button.addEventListener('click', event => {
          let elem = event.currentTarget; // There is some bug with events in iframe where currentTarget is "null"
          // => prevent this here by bubble up

          if (!elem) {
            elem = event.target;
          }

          const clicktarget = elem.getAttribute('data-target');

          if (clicktarget) {
            const iframe = document.querySelector('#moduleDashboardAddModal iframe');
            const content = iframe.contentDocument || iframe.contentWindow.document;
            content.querySelector(clicktarget).click();
          }
        });
      });
    }
  });
})(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.