CoreFiles by mySites.guru
tour-edit.js36 lines, 1,539 bytes, from Joomla_5.2.2-Stable-Full_Package.zip
Raw History Compare with 5.2.1
md5
7918e2c57ca71effa7f3c9f637b39980
sha1
710925e578b59e00b898aa783a413b7e88e2c15b
sha256
a73fc5482de5f36edd8b1bcd9cb8759a741e3e64bc2670f0664d123575b5a95a
/**
 * @copyright  (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

(() => {

  // before 'joomla:showon-processed' is implemented in Showon we must use more frequent 'joomla:showon-show' and'joomla:showon-hide' events
  ['joomla:showon-show', 'joomla:showon-hide'].forEach(eventType => {
    document.addEventListener(eventType, () => {
      document.querySelectorAll('#guidedtour-dates-form fieldset').forEach(fieldset => {
        // Only hide fieldsets containing field control-group i.e. not radio selectors etc. that may use fieldsets
        if (fieldset.querySelectorAll(':scope .control-group').length === 0) {
          return;
        }
        const visibleChildren = fieldset.querySelectorAll(':scope .control-group:not(.hidden)');
        if (visibleChildren.length) {
          fieldset.classList.remove('hidden');
        } else {
          fieldset.classList.add('hidden');
        }
      });
      document.querySelectorAll('#guidedtour-dates-form joomla-tab-element').forEach(tabelement => {
        const tabLabel = document.querySelector(`button[aria-controls="${tabelement.id}"]`);
        if (tabLabel) {
          const visibleChildren = tabelement.querySelectorAll(':scope .control-group:not(.hidden)');
          if (visibleChildren.length) {
            tabLabel.removeAttribute('hidden');
          } else {
            tabLabel.setAttribute('hidden', 'hidden');
          }
        }
      });
    });
  });
})();

The same content is in 137 releases, Joomla 5.1.0-alpha4 to 6.3.0-alpha1. See them all, or every version of this file.