[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/com_config/js/ -> config-filters.js (source)

   1  /**
   2   * @copyright   (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
   3   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   4   */
   5  const recursiveApplyChanges = id => {
   6    const childs = [].slice.call(document.querySelectorAll(`#filter-config select[data-parent="$id}"]`));
   7    childs.map(child => {
   8      recursiveApplyChanges(child.dataset.id);
   9      child.value = 'NONE';
  10      return child;
  11    });
  12  };
  13  
  14  const applyChanges = event => {
  15    const currentElement = event.currentTarget;
  16    const currentFilter = currentElement.options[currentElement.selectedIndex].value;
  17  
  18    if (currentFilter === 'NONE') {
  19      const childs = [].slice.call(document.querySelectorAll(`#filter-config select[data-parent="$currentElement.dataset.id}"]`));
  20  
  21      if (childs.length && window.confirm(Joomla.Text._('COM_CONFIG_TEXT_FILTERS_NOTE'))) {
  22        childs.map(child => {
  23          recursiveApplyChanges(child.dataset.id);
  24          child.value = 'NONE';
  25          return child;
  26        });
  27      }
  28    }
  29  };
  30  
  31  [].slice.call(document.querySelectorAll('#filter-config select')).map(select => select.addEventListener('change', applyChanges));


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