[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/com_menus/js/ -> admin-item-edit_modules-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    Joomla = window.Joomla || {};
   9  
  10    (function () {
  11      var options = Joomla.getOptions('menus-edit-modules');
  12  
  13      if (options) {
  14        window.viewLevels = options.viewLevels;
  15        window.menuId = parseInt(options.itemId, 10);
  16      }
  17  
  18      var baseLink = 'index.php?option=com_modules&client_id=0&task=module.edit&tmpl=component&view=module&layout=modal&id=';
  19      var assigned1 = document.getElementById('jform_toggle_modules_assigned1');
  20      var assigned0 = document.getElementById('jform_toggle_modules_assigned0');
  21      var published1 = document.getElementById('jform_toggle_modules_published1');
  22      var published0 = document.getElementById('jform_toggle_modules_published0');
  23      var linkElements = [].slice.call(document.getElementsByClassName('module-edit-link'));
  24      var elements = [].slice.call(document.querySelectorAll('#moduleEditModal .modal-footer .btn'));
  25  
  26      if (assigned1) {
  27        assigned1.addEventListener('click', function () {
  28          var list = [].slice.call(document.querySelectorAll('tr.no'));
  29          list.forEach(function (item) {
  30            item.classList.add('table-row');
  31            item.classList.remove('hidden');
  32          });
  33        });
  34      }
  35  
  36      if (assigned0) {
  37        assigned0.addEventListener('click', function () {
  38          var list = [].slice.call(document.querySelectorAll('tr.no'));
  39          list.forEach(function (item) {
  40            item.classList.add('hidden');
  41            item.classList.remove('table-row');
  42          });
  43        });
  44      }
  45  
  46      if (published1) {
  47        published1.addEventListener('click', function () {
  48          var list = [].slice.call(document.querySelectorAll('.table tr.unpublished'));
  49          list.forEach(function (item) {
  50            item.classList.add('table-row');
  51            item.classList.remove('hidden');
  52          });
  53        });
  54      }
  55  
  56      if (published0) {
  57        published0.addEventListener('click', function () {
  58          var list = [].slice.call(document.querySelectorAll('.table tr.unpublished'));
  59          list.forEach(function (item) {
  60            item.classList.add('hidden');
  61            item.classList.remove('table-row');
  62          });
  63        });
  64      }
  65  
  66      if (linkElements.length) {
  67        linkElements.forEach(function (linkElement) {
  68          linkElement.addEventListener('click', function (_ref) {
  69            var target = _ref.target;
  70            var link = baseLink + target.getAttribute('data-module-id');
  71            var modal = document.getElementById('moduleEditModal');
  72            var body = modal.querySelector('.modal-body');
  73            var iFrame = document.createElement('iframe');
  74            iFrame.src = link;
  75            iFrame.setAttribute('class', 'class="iframe jviewport-height70"');
  76            body.innerHTML = '';
  77            body.appendChild(iFrame);
  78            modal.open();
  79          });
  80        });
  81      }
  82  
  83      if (elements.length) {
  84        elements.forEach(function (element) {
  85          element.addEventListener('click', function (_ref2) {
  86            var target = _ref2.target;
  87            var dataTarget = target.getAttribute('data-bs-target');
  88  
  89            if (dataTarget) {
  90              var iframe = document.querySelector('#moduleEditModal iframe');
  91              var iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
  92              iframeDocument.querySelector(dataTarget).click();
  93            }
  94          });
  95        });
  96      }
  97    })();
  98  
  99  })();


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