CoreFiles by mySites.guru
passwordview.es6.js47 lines, 1,495 bytes, from Joomla_4.0.0-alpha12-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha11
md5
76b2fd422724b565956c2d5da4f9e519
sha1
cabf103ec01be32a5904b6e5fabaf32071b3b0aa
sha256
638dd39a8bab3618265de5cc636b67e859340170981af36c88f23e089a1f8ed1
/**
* PLEASE DO NOT MODIFY THIS FILE. WORK ON THE ES6 VERSION.
* OTHERWISE YOUR CHANGES WILL BE REPLACED ON THE NEXT BUILD.
**/

/**
 * @copyright   Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
 * @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 inputGroup = input.parentNode.querySelector('.input-password-toggle');

      if (!inputGroup) {
        return;
      }

      inputGroup.addEventListener('click', e => {
        const {
          target
        } = e;
        const srText = target.previousSibling;

        if (target.classList.contains('icon-eye')) {
          // Update the icon class
          target.classList.remove('icon-eye');
          target.classList.add('icon-eye-close'); // Update the input type

          input.type = 'text'; // Update the text for screenreaders

          srText.innerText = Joomla.JText._('JSHOW');
        } else if (target.classList.contains('icon-eye-close')) {
          // Update the icon class
          target.classList.add('icon-eye');
          target.classList.remove('icon-eye-close'); // Update the input type

          input.type = 'password'; // Update the text for screenreaders

          srText.innerText = Joomla.JText._('JHIDE');
        }
      });
    });
  });
})(document);

The same content is in 2 releases, Joomla 4.0.0-alpha11 to 4.0.0-alpha12. See them all, or every version of this file.