CoreFiles by mySites.guru
admin-modules-modal.js49 lines, 1,551 bytes, from Joomla_4.0.0-alpha12-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha11
md5
6869d938c61fbf0506a59518a97036c6
sha1
4e3e3f96b3ed98e1e449635c04f626a0f0451ade
sha256
819e867ab5c73059decc87c53f2a57ac9a3d9bf30199eca791a1c7f691351672
/**
* 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 || {};

(function (document) {
  'use strict';

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

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

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

    if (buttons.length) {
      buttons.forEach(function (button) {
        button.addEventListener('click', function (event) {
          var 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;
          }

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

          if (clicktarget) {
            var iframe = document.querySelector('#moduleDashboardAddModal iframe');
            var 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.