[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/com_cpanel/js/ -> admin-add_module-es5.js (source)

   1  (function () {
   2    'use strict';
   3  
   4    /**
   5     * @copyright  (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
   6     * @license    GNU General Public License version 2 or later; see LICENSE.txt
   7     */
   8    (function (document) {
   9      document.addEventListener('DOMContentLoaded', function () {
  10        window.jSelectModuleType = function () {
  11          var elements = document.querySelectorAll('#moduleDashboardAddModal .modal-footer .btn.hidden');
  12  
  13          if (elements.length) {
  14            setTimeout(function () {
  15              elements.forEach(function (button) {
  16                button.classList.remove('hidden');
  17              });
  18            }, 1000);
  19          }
  20        };
  21  
  22        var buttons = document.querySelectorAll('#moduleDashboardAddModal .modal-footer .btn');
  23        var hideButtons = [];
  24        var isSaving = false;
  25  
  26        if (buttons.length) {
  27          buttons.forEach(function (button) {
  28            if (button.classList.contains('hidden')) {
  29              hideButtons.push(button);
  30            }
  31  
  32            button.addEventListener('click', function (event) {
  33              var elem = event.currentTarget; // There is some bug with events in iframe where currentTarget is "null"
  34              // => prevent this here by bubble up
  35  
  36              if (!elem) {
  37                elem = event.target;
  38              }
  39  
  40              if (elem) {
  41                var clickTarget = elem.dataset.bsTarget; // We remember to be in the saving process
  42  
  43                isSaving = clickTarget === '#saveBtn'; // Reset saving process, if e.g. the validation of the form fails
  44  
  45                setTimeout(function () {
  46                  isSaving = false;
  47                }, 1500);
  48                var iframe = document.querySelector('#moduleDashboardAddModal iframe');
  49                var content = iframe.contentDocument || iframe.contentWindow.document;
  50                var targetBtn = content.querySelector(clickTarget);
  51  
  52                if (targetBtn) {
  53                  targetBtn.click();
  54                }
  55              }
  56            });
  57          });
  58        }
  59  
  60        var elementH = document.querySelector('#moduleDashboardAddModal');
  61  
  62        if (elementH) {
  63          elementH.addEventListener('hide.bs.modal', function () {
  64            hideButtons.forEach(function (button) {
  65              button.classList.add('hidden');
  66            });
  67          });
  68          elementH.addEventListener('hidden.bs.modal', function () {
  69            if (isSaving) {
  70              setTimeout(function () {
  71                window.parent.location.reload();
  72              }, 1000);
  73            }
  74          });
  75        }
  76      });
  77    })(document);
  78  
  79  })();


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