CoreFiles by mySites.guru
passwordview.es6.js49 lines, 1,575 bytes, from Joomla_4.0.0-beta6-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta5
md5
7f94196b59b67a29d9065d2450ba88d9
sha1
57b93d6d4b01be246ecf1f0e8b5d0101d8b5d70d
sha256
96a4bcdbeac448cf065192f53e878e9754ce145d05949a84fd4768285cc4a91f
/**
* PLEASE DO NOT MODIFY THIS FILE. WORK ON THE ES6 VERSION.
* OTHERWISE YOUR CHANGES WILL BE REPLACED ON THE NEXT BUILD.
**/

/**
 * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
(document => {
  'use strict';

  document.addEventListener('DOMContentLoaded', () => {
    [].slice.call(document.querySelectorAll('input[type="password"]')).forEach(input => {
      const toggleButton = input.parentNode.querySelector('.input-password-toggle');

      if (!toggleButton) {
        return;
      }

      toggleButton.addEventListener('click', () => {
        const icon = toggleButton.firstElementChild;
        const srText = toggleButton.lastElementChild;

        if (input.type === 'password') {
          // Update the icon class
          icon.classList.remove('icon-eye');
          icon.classList.add('icon-eye-slash'); // Update the input type

          input.type = 'text'; // Focus the input field

          input.focus(); // Update the text for screenreaders

          srText.innerText = Joomla.Text._('JHIDEPASSWORD');
        } else if (input.type === 'text') {
          // Update the icon class
          icon.classList.add('icon-eye');
          icon.classList.remove('icon-eye-slash'); // Update the input type

          input.type = 'password'; // Focus the input field

          input.focus(); // Update the text for screenreaders

          srText.innerText = Joomla.Text._('JSHOWPASSWORD');
        }
      });
    });
  });
})(document);

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