CoreFiles by mySites.guru
passwordview.es6.js47 lines, 1,465 bytes, from Joomla_4.0.0-alpha10-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha9
md5
5494b19620807e8df6daf9d1dca90ef8
sha1
47026050c3c1e9086299e49636d078c00862885f
sha256
7c8aa49dd24fc20f3a1c144096965c6f4c570ca59457920ee1d590ec1b8f59ea
/**
* 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-group-prepend, .input-group-append');

      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 {
          // 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 4 releases, Joomla 4.0.0-alpha7 to 4.0.0-alpha10. See them all, or every version of this file.