CoreFiles by mySites.guru
config-filters.js24 lines, 1,028 bytes, from Joomla_5.2.2-Stable-Full_Package.zip
Raw History Compare with 5.2.1
md5
418047362c48720368d7cf722ea2d1bd
sha1
8d16302f499bdb6b02f2797c4725ab65f413bb7e
sha256
15c1df6c661470c754f8ad4f5d9d1f4eb90955e917fc6165a1d9fe0ec2ee05a5
/**
 * @copyright   (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
const recursiveApplyChanges = id => {
  document.querySelectorAll(`#filter-config select[data-parent="${id}"]`).forEach(child => {
    recursiveApplyChanges(child.dataset.id);
    child.value = 'NONE';
  });
};
const applyChanges = event => {
  const currentElement = event.currentTarget;
  const currentFilter = currentElement.options[currentElement.selectedIndex].value;
  if (currentFilter === 'NONE') {
    const childs = document.querySelectorAll(`#filter-config select[data-parent="${currentElement.dataset.id}"]`);
    if (childs.length && window.confirm(Joomla.Text._('COM_CONFIG_TEXT_FILTERS_NOTE'))) {
      childs.forEach(child => {
        recursiveApplyChanges(child.dataset.id);
        child.value = 'NONE';
      });
    }
  }
};
document.querySelectorAll('#filter-config select').forEach(select => select.addEventListener('change', applyChanges));

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