PageSourceSearch

https://www.audiologyonline.com/js/password-toggle.js?1775827676

js audiologyonline.com collected 2026-10-01 11:53:40 UTC 2,182 bytes, 66 lines download raw bytes

1/**
2 * Password Toggle Functionality
3 * Centralized JavaScript for show/hide password functionality
4 */
5
6// Initialize all password toggle buttons on the page
7function initAllPasswordToggles() {
8	// Find all password toggle buttons
9	const toggleButtons = document.querySelectorAll('.password-toggle-btn');
10	
11	toggleButtons.forEach(function(button) {
12		// Remove any existing event listeners to prevent duplicates
13		button.removeEventListener('click', handlePasswordToggle);
14		button.addEventListener('click', handlePasswordToggle);
15	});
16}
17
18// Handle password toggle click
19function handlePasswordToggle(event) {
20	const button = event.currentTarget;
21	
22	// Find the password field - it should be the previous input sibling or nearby
23	const formGroup = button.closest('.form-group') || button.parentElement;
24	const passwordField = formGroup.querySelector('input[type="password"], input[type="text"]');
25	
26	if (!passwordField) {
27		console.error('Password field not found for toggle button', button.id);
28		return;
29	}
30	
31	// Toggle the input type
32	const type = passwordField.getAttribute('type') === 'password' ? 'text' : 'password';
33	passwordField.setAttribute('type', type);
34	
35	// Toggle icon and aria-label
36	const icon = button.querySelector('.glyphicon');
37	if (type === 'text') {
38		icon.classList.remove('glyphicon-eye-open');
39		icon.classList.add('glyphicon-eye-close');
40		button.setAttribute('aria-label', 'Hide password');
41	} else {
42		icon.classList.remove('glyphicon-eye-close');
43		icon.classList.add('glyphicon-eye-open');
44		button.setAttribute('aria-label', 'Show password');
45	}
46}
47
48// Auto-initialize password toggles on page load
49document.addEventListener('DOMContentLoaded', function() {
50	initAllPasswordToggles();
51});
52
53// Re-initialize password toggles when modals are shown
54$(document).ready(function() {
55	// Re-initialize when any modal is shown
56	$('#loginModal, #portalLoginModal, #portalLoginModalLocal').on('shown.bs.modal', function() {
57		initAllPasswordToggles();
58	});
59	
60	// Re-initialize when dynamic content is added
61	$(document).on('DOMNodeInserted', function(e) {
62		if ($(e.target).find('.password-toggle-btn').length > 0) {
63			initAllPasswordToggles();
64		}
65	});
66});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.