[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/com_banners/js/ -> admin-banner-edit.js (source)

   1  /**
   2   * @copyright  (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
   3   * @license    GNU General Public License version 2 or later; see LICENSE.txt
   4   */
   5  (document => {
   6  
   7    const updateBannerFields = value => {
   8      const imgWrapper = document.getElementById('image');
   9      const custom = document.getElementById('custom');
  10  
  11      switch (value) {
  12        case '0':
  13          // Image
  14          imgWrapper.classList.remove('hidden');
  15          custom.classList.add('hidden');
  16          break;
  17  
  18        case '1':
  19          // Custom
  20          imgWrapper.classList.add('hidden');
  21          custom.classList.remove('hidden');
  22          break;
  23  
  24      }
  25    };
  26  
  27    document.addEventListener('DOMContentLoaded', () => {
  28      const jformType = document.getElementById('jform_type');
  29  
  30      if (jformType) {
  31        // Hide/show parameters initially
  32        updateBannerFields(jformType.value); // Hide/show parameters when the type has been selected
  33  
  34        jformType.addEventListener('change', ({
  35          target
  36        }) => {
  37          updateBannerFields(target.value);
  38        });
  39      }
  40    });
  41  })(document);


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