[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/com_finder/js/ -> finder-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  Joomla = window.Joomla || {};
   6  
   7  (() => {
   8  
   9    document.addEventListener('DOMContentLoaded', () => {
  10      // Handle toggle all
  11      [].slice.call(document.querySelectorAll('.filter-toggle-all')).forEach(button => {
  12        button.addEventListener('click', () => {
  13          [].slice.call(document.querySelectorAll('.filter-node')).forEach(node => {
  14            node.click();
  15          });
  16        });
  17      }); // Update the count
  18  
  19      [].slice.call(document.querySelectorAll('.filter-node')).forEach(() => {
  20        const count = document.getElementById('jform_map_count');
  21  
  22        if (count) {
  23          count.value = document.querySelectorAll('input[type="checkbox"]:checked').length;
  24        }
  25      });
  26      Array.from(document.querySelectorAll('.js-filter')).forEach(button => {
  27        button.addEventListener('click', event => {
  28          const btn = event.currentTarget;
  29          Array.from(document.querySelectorAll(`.$btn.dataset.id}`)).map(el => el.click());
  30        });
  31      }); // Expand/collapse
  32  
  33      const expandAccordion = document.getElementById('expandAccordion');
  34  
  35      if (expandAccordion) {
  36        expandAccordion.addEventListener('click', event => {
  37          event.preventDefault();
  38          let elements;
  39  
  40          if (event.target.innerText === Joomla.Text._('COM_FINDER_FILTER_SHOW_ALL')) {
  41            event.target.innerText = Joomla.Text._('COM_FINDER_FILTER_HIDE_ALL');
  42            elements = [].slice.call(document.querySelectorAll('.accordion-button.collapsed'));
  43          } else {
  44            event.target.innerText = Joomla.Text._('COM_FINDER_FILTER_SHOW_ALL');
  45            elements = [].slice.call(document.querySelectorAll('.accordion-button:not(.collapsed)'));
  46          }
  47  
  48          if (elements) {
  49            elements.forEach(element => {
  50              element.click();
  51            });
  52          }
  53        });
  54      }
  55    });
  56  })();


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