[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/com_finder/js/ -> finder-edit-es5.js (source)

   1  (function () {
   2    'use strict';
   3  
   4    /**
   5     * @copyright  (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
   6     * @license    GNU General Public License version 2 or later; see LICENSE.txt
   7     */
   8    Joomla = window.Joomla || {};
   9  
  10    (function () {
  11      document.addEventListener('DOMContentLoaded', function () {
  12        // Handle toggle all
  13        [].slice.call(document.querySelectorAll('.filter-toggle-all')).forEach(function (button) {
  14          button.addEventListener('click', function () {
  15            [].slice.call(document.querySelectorAll('.filter-node')).forEach(function (node) {
  16              node.click();
  17            });
  18          });
  19        }); // Update the count
  20  
  21        [].slice.call(document.querySelectorAll('.filter-node')).forEach(function () {
  22          var count = document.getElementById('jform_map_count');
  23  
  24          if (count) {
  25            count.value = document.querySelectorAll('input[type="checkbox"]:checked').length;
  26          }
  27        });
  28        Array.from(document.querySelectorAll('.js-filter')).forEach(function (button) {
  29          button.addEventListener('click', function (event) {
  30            var btn = event.currentTarget;
  31            Array.from(document.querySelectorAll("." + btn.dataset.id)).map(function (el) {
  32              return el.click();
  33            });
  34          });
  35        }); // Expand/collapse
  36  
  37        var expandAccordion = document.getElementById('expandAccordion');
  38  
  39        if (expandAccordion) {
  40          expandAccordion.addEventListener('click', function (event) {
  41            event.preventDefault();
  42            var elements;
  43  
  44            if (event.target.innerText === Joomla.Text._('COM_FINDER_FILTER_SHOW_ALL')) {
  45              event.target.innerText = Joomla.Text._('COM_FINDER_FILTER_HIDE_ALL');
  46              elements = [].slice.call(document.querySelectorAll('.accordion-button.collapsed'));
  47            } else {
  48              event.target.innerText = Joomla.Text._('COM_FINDER_FILTER_SHOW_ALL');
  49              elements = [].slice.call(document.querySelectorAll('.accordion-button:not(.collapsed)'));
  50            }
  51  
  52            if (elements) {
  53              elements.forEach(function (element) {
  54                element.click();
  55              });
  56            }
  57          });
  58        }
  59      });
  60    })();
  61  
  62  })();


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