CoreFiles by mySites.guru
stats.js49 lines, 1,347 bytes, from Joomla_4.0.0-alpha5-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha3
md5
7bd99c335fc4b6ca1ceae97c14649955
sha1
c62ab924a7838adfb765001021d02c07e4504505
sha256
c43ef022fb9b142b1fd47cd55e8a52658f1d7ebd21083654c07d7f648b66c1e9
/**
 * @copyright  Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 * @since      3.5.0
 */
((document) => {
  'use strict';

  // 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);

No other release has this exact content. See every version of this file.