CoreFiles by mySites.guru
passwordview.js59 lines, 1,423 bytes, from Joomla_4.0.0-alpha2-Alpha-Full_Package.zip
Raw History Compare with 3.10.0-alpha9
md5
b745b6d8902d1a204c33c60f58283c0c
sha1
17bab4ebc0de3ff4261e357c52400e255f593b5a
sha256
a621574adc132bbab51af45d8b6bc26b19cf98beb1ce3ec6cf06f03e99f6d351
/**
 * @copyright   Copyright (C) 2005 - 2017 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');

				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.