CoreFiles by mySites.guru
passwordview.es6.js75 lines, 2,487 bytes, from Joomla_4.0.0-beta7-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta6
md5
5c3fdd5a2079c8ef42cc95218e10a64e
sha1
9bb087c0e74585eb33009bad40ccadf4dd6894c2
sha256
1759ddc650e356800af15b6c73cfa40bc5263414a7edc9a14376b046d6fe5bce
/**
* 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) {
        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');
          }
        });
      }

      const modifyButton = input.parentNode.querySelector('.input-password-modify');

      if (modifyButton) {
        modifyButton.addEventListener('click', () => {
          const lock = !modifyButton.classList.contains('locked');

          if (lock === true) {
            // Add lock
            modifyButton.classList.add('locked'); // Reset value to empty string

            input.value = ''; // Disable the field

            input.setAttribute('disabled', ''); // Update the text

            modifyButton.innerText = Joomla.Text._('JMODIFY');
          } else {
            // Remove lock
            modifyButton.classList.remove('locked'); // Disable the field

            input.removeAttribute('disabled'); // Focus the input field

            input.focus(); // Update the text

            modifyButton.innerText = Joomla.Text._('JCANCEL');
          }
        });
      }
    });
  });
})(document);

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