1(function() { 2 function bindToggle(toggleId, fieldId) { 3 var toggle = document.getElementById(toggleId); 4 var field = document.getElementById(fieldId); 5 if (!toggle || !field) return; 6 toggle.addEventListener('click', function() { 7 field.setAttribute('type', field.getAttribute('type') === 'password' ? 'text' : 'password'); 8 this.classList.toggle('bi-eye'); 9 }); 10 } 11 12 function initStrengthMeter(inputId, containerId) { 13 var input = document.getElementById(inputId); 14 var container = document.getElementById(containerId); 15 if (!input || !container) return; 16 17 var fill = container.querySelector('.cleanlogin-strength-fill'); 18 var label = container.querySelector('.cleanlogin-strength-label'); 19 20 input.addEventListener('input', function() { 21 var val = this.value; 22 23 fill.className = 'cleanlogin-strength-fill'; 24 if (!val) { label.textContent = ''; return; } 25 26 var score = 0; 27 if (val.length >= 8) score++; 28 if (/[a-z]/.test(val) && /[A-Z]/.test(val)) score++; 29 if (/\d/.test(val)) score++; 30 if (/[^a-zA-Z0-9]/.test(val)) score++; 31 if (score === 0) score = 1; 32 33 var labels = [ 34 '', 35 container.dataset.labelWeak, 36 container.dataset.labelFair, 37 container.dataset.labelGood, 38 container.dataset.labelStrong 39 ]; 40 41 fill.classList.add('strength-' + score); 42 label.textContent = labels[score] || ''; 43 label.style.color = { 1: '#e74c3c', 2: '#e67e22', 3: '#f1c40f', 4: '#27ae60' }[score]; 44 }); 45 } 46 47 bindToggle('togglePassword', 'pwd'); 48 bindToggle('togglePassword', 'pass1'); 49 bindToggle('togglePassword2', 'pass2'); 50 initStrengthMeter('pass1', 'cleanlogin-strength-meter'); 51})();
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.