[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/com_modules/js/ -> admin-modules-modal-es5.js (source)

   1  (function () {
   2    'use strict';
   3  
   4    /**
   5      * @copyright  (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
   6      * @license    GNU General Public License version 2 or later; see LICENSE.txt
   7      */
   8    document.addEventListener('DOMContentLoaded', function () {
   9      var modulesLinks = [].slice.call(document.querySelectorAll('.js-module-insert'));
  10      var positionsLinks = [].slice.call(document.querySelectorAll('.js-position-insert')); // Assign listener for click event (for single module id insertion)
  11  
  12      modulesLinks.forEach(function (element) {
  13        element.addEventListener('click', function (event) {
  14          event.preventDefault();
  15          var modid = event.target.getAttribute('data-module');
  16          var editor = event.target.getAttribute('data-editor'); // Use the API
  17  
  18          if (window.parent.Joomla && window.parent.Joomla.editors && window.parent.Joomla.editors.instances && Object.prototype.hasOwnProperty.call(window.parent.Joomla.editors.instances, editor)) {
  19            window.parent.Joomla.editors.instances[editor].replaceSelection("{loadmoduleid " + modid + "}");
  20          }
  21  
  22          if (window.parent.Joomla.Modal) {
  23            window.parent.Joomla.Modal.getCurrent().close();
  24          }
  25        });
  26      }); // Assign listener for click event (for position insertion)
  27  
  28      positionsLinks.forEach(function (element) {
  29        element.addEventListener('click', function (event) {
  30          event.preventDefault();
  31          var position = event.target.getAttribute('data-position');
  32          var editor = event.target.getAttribute('data-editor'); // Use the API
  33  
  34          if (window.Joomla && window.Joomla.editors && Joomla.editors.instances && Object.prototype.hasOwnProperty.call(window.parent.Joomla.editors.instances, editor)) {
  35            window.parent.Joomla.editors.instances[editor].replaceSelection("{loadposition " + position + "}");
  36          }
  37  
  38          if (window.parent.Joomla.Modal) {
  39            window.parent.Joomla.Modal.getCurrent().close();
  40          }
  41        });
  42      });
  43    });
  44  
  45  })();


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer