CoreFiles by mySites.guru
admin-modules-modal.js53 lines, 1,916 bytes, from Joomla_4.0.0-alpha5-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha3
md5
4482d0fe2216dd6522445beb74a39d55
sha1
902223ac77c941b1101340526417396a0ee85a5d
sha256
1a8d01e5440fbe6117203e743beb94567497dcb61305dcb9fba15b118e0a421d
/**
* 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 - 2018 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

document.addEventListener('DOMContentLoaded', function () {
  'use strict';

  /** Get the elements * */

  var modulesLinks = [].slice.call(document.querySelectorAll('.js-module-insert'));
  var positionsLinks = [].slice.call(document.querySelectorAll('.js-position-insert'));

  /** Assign listener for click event (for single module insertion) * */
  modulesLinks.forEach(function (modulesLink) {
    modulesLink.addEventListener('click', function (event) {
      event.preventDefault();
      var type = event.target.getAttribute('data-module');
      var name = event.target.getAttribute('data-title');
      var editor = event.target.getAttribute('data-editor');

      // Insert the short tag in the editor
      window.parent.Joomla.editors.instances[editor].replaceSelection('{loadmodule ' + type + ',' + name + '}');

      // Close the modal
      if (window.parent.Joomla.Modal) {
        window.parent.Joomla.Modal.getCurrent().close();
      }
    });
  });

  /** Assign listener for click event (for position insertion) * */
  positionsLinks.forEach(function (positionsLink) {
    positionsLink.addEventListener('click', function (event) {
      event.preventDefault();
      var position = event.target.getAttribute('data-position');
      var editor = event.target.getAttribute('data-editor');

      // Insert the short tag in the editor
      window.parent.Joomla.editors.instances[editor].replaceSelection('{loadposition ' + position + '}');

      // Close the modal
      if (window.parent.Joomla.Modal) {
        window.parent.Joomla.Modal.getCurrent().close();
      }
    });
  });
});

No other release has this exact content. See every version of this file.