CoreFiles by mySites.guru
passwordview.js61 lines, 1,468 bytes, from Joomla_4.0.0-alpha3-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha2
md5
496aa527066a871403d3442c4f58523f
sha1
871c518b79b064d7a50df475b4014bf0a425ade9
sha256
2af30b4bbb33e4bd750c71abcdbed030780fa62a8af4a6001e610cbbcfac10dc
/**
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
 * @license	    GNU General Public License version 2 or later; see LICENSE.txt
 */

/**
 * Field switcher
 */

(function() {
	'use strict';

	document.addEventListener('DOMContentLoaded', function() {

		var passwordInputs = document.getElementsByTagName('input');

		for (var i = 0, l = passwordInputs.length; i < l; i++) {

			if (passwordInputs[i].getAttribute('type') === 'password') {

				var inputGroup = passwordInputs[i].parentNode.querySelector('.input-group-addon');

				if (inputGroup) {
					inputGroup.addEventListener('click', function(e) {

						var target = this.querySelector('.fa'),
							input  = this.parentNode.querySelector('input'),
							srText = target.nextElementSibling;

						if (target.classList.contains('fa-eye')) {
							// Update the icon class
							target.classList.remove('fa-eye');
							target.classList.add('fa-eye-slash');

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

							// Updat the text for screenreaders
							srText.innerText = Joomla.JText._('JSHOW');
						}
						else {
							// Update the icon class
							target.classList.add('fa-eye');
							target.classList.remove('fa-eye-slash');

							// Update the input type
							input.type = 'password';

							// Updat the text for screenreaders
							srText.innerText = Joomla.JText._('JHIDE');
						}
					});
				}

			}

		}

	});

})();

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