CoreFiles by mySites.guru
admin-banner-edit.es6.js47 lines, 1,231 bytes, from Joomla_4.0.0-alpha8-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha7
md5
b2d2e7695abdc69cee1a9889863650ef
sha1
ccb0c3505a6478f8b8753bdba8cf404ace1f0031
sha256
0ca27fbe2504d695369a46e328365f151df10cd83fdd9e90aff2fe8073dd0673
/**
* 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 - 2019 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */
(document => {
  'use strict';

  const updateBannerFields = value => {
    const imgWrapper = document.getElementById('image');
    const custom = document.getElementById('custom');

    switch (value) {
      case '0':
        // Image
        imgWrapper.style.display = 'block';
        custom.style.display = 'none';
        break;

      case '1':
        // Custom
        imgWrapper.style.display = 'none';
        custom.style.display = 'block';
        break;

      default: // Do nothing

    }
  };

  document.addEventListener('DOMContentLoaded', () => {
    const jformType = document.getElementById('jform_type');

    if (jformType) {
      // Hide/show parameters initially
      updateBannerFields(jformType.value); // Hide/show parameters when the type has been selected

      jformType.addEventListener('change', event => {
        updateBannerFields(event.target.value);
      });
    }
  });
})(document);

The same content is in 6 releases, Joomla 4.0.0-alpha7 to 4.0.0-alpha12. See them all, or every version of this file.