CoreFiles by mySites.guru
passwordview.js45 lines, 1,504 bytes, from Joomla_4.0.0-alpha11-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha10
md5
2c89675d8dec3e10c47fc35a7f38b80a
sha1
e89e203b460d8175807c64c2d1832160741191a3
sha256
592e8343748117c5810d16ccd69385f8548a5a1f156b47956eb534b11996cc77
/**
* 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
 */
(function (document) {
  'use strict';

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

      if (!inputGroup) {
        return;
      }

      inputGroup.addEventListener('click', function (e) {
        var target = e.target;
        var 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.