CoreFiles by mySites.guru
finder-edit.js48 lines, 1,805 bytes, from Joomla_5.4.2-Stable-Full_Package.zip
Raw History Compare with 5.4.1
md5
847f7ef89d7508906168d6d44ab442ae
sha1
aa945771b25ebebc845e3589791e2f5a5feb7e4a
sha256
0704517b485e79eaaa79125f684c6b96224d667d891a4bd4a9de6c2b2e2f8a82
/**
 * @copyright  (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

Joomla = window.Joomla || {};
(() => {

  document.addEventListener('DOMContentLoaded', () => {
    // Handle toggle all
    document.querySelectorAll('.filter-toggle-all').forEach(button => {
      button.addEventListener('click', () => document.querySelectorAll('.filter-node').forEach(node => node.click()));
    });

    // Update the count
    document.querySelectorAll('.filter-node').forEach(() => {
      const count = document.getElementById('jform_map_count');
      if (count) {
        count.value = document.querySelectorAll('input[type="checkbox"]:checked').length;
      }
    });
    document.querySelectorAll('.js-filter').forEach(button => {
      button.addEventListener('click', event => {
        const btn = event.currentTarget;
        document.querySelectorAll(`.${btn.dataset.id}`).forEach(el => el.click());
      });
    });

    // Expand/collapse
    const expandAccordion = document.getElementById('expandAccordion');
    if (expandAccordion) {
      expandAccordion.addEventListener('click', event => {
        event.preventDefault();
        let elements;
        if (event.target.innerText === Joomla.Text._('COM_FINDER_FILTER_SHOW_ALL')) {
          event.target.innerText = Joomla.Text._('COM_FINDER_FILTER_HIDE_ALL');
          elements = document.querySelectorAll('.accordion-button.collapsed');
        } else {
          event.target.innerText = Joomla.Text._('COM_FINDER_FILTER_SHOW_ALL');
          elements = document.querySelectorAll('.accordion-button:not(.collapsed)');
        }
        if (elements) {
          elements.forEach(element => element.click());
        }
      });
    }
  });
})();

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.