CoreFiles by mySites.guru
passwordview.es6.js44 lines, 1,365 bytes, from Joomla_4.0.0-alpha6-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha5
md5
3f8b6163cc96581678cfe7804d4197ce
sha1
9ffab8bc98ae54548f698a22eec0d355522825cd
sha256
0760240a65d3851e4aec75f5f8969a23bd0be2e51fd10fe470b4e45965136565
/**
 * @copyright   Copyright (C) 2005 - 2018 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 2 releases, Joomla 4.0.0-alpha5 to 4.0.0-alpha6. See them all, or every version of this file.