CoreFiles by mySites.guru
stats.js42 lines, 1,306 bytes, from Joomla_5.2.4-Stable-Full_Package.zip
Raw History Compare with 5.2.3
md5
abfa103656913a1db3d10f00b5a92715
sha1
f4f6e2fb00a01602d1f847077af75572783ce3bf
sha256
76b701e7ae079ebc39ed06adf390d6615733d633744b71069ab4bcc9af50a0ee
/**
 * @copyright  (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 * @since      3.5.0
 */
(document => {

  // Selectors used by this script
  const statsDataTogglerId = 'js-pstats-data-details-toggler';
  const statsDataDetailsId = 'js-pstats-data-details';
  const resetId = 'js-pstats-reset-uid';
  const uniqueIdFieldId = 'jform_params_unique_id';
  const onToggle = event => {
    event.preventDefault();
    const element = document.getElementById(statsDataDetailsId);
    if (element) {
      element.classList.toggle('d-none');
    }
  };
  const onReset = event => {
    event.preventDefault();
    document.getElementById(uniqueIdFieldId).value = '';
    Joomla.submitbutton('plugin.apply');
  };
  const onBoot = () => {
    // Toggle stats details
    const toggler = document.getElementById(statsDataTogglerId);
    if (toggler) {
      toggler.addEventListener('click', onToggle);
    }

    // Reset the unique id
    const reset = document.getElementById(resetId);
    if (reset) {
      reset.addEventListener('click', onReset);
    }

    // Cleanup
    document.removeEventListener('DOMContentLoaded', onBoot);
  };
  document.addEventListener('DOMContentLoaded', onBoot);
})(document, Joomla);

The same content is in 138 releases, Joomla 4.3.0-alpha1 to 6.0.0-alpha3. See them all, or every version of this file.