<% apply_behaviour('#password_label',%{ const offString ="Don't show what I type", onString ="Show what I type"; var a = document.createElement("a"); this.appendChild(document.createTextNode(" (")); this.appendChild(a); this.appendChild(document.createTextNode(")"));
function isShowing(){return $('user_password').type =='text';} function mirror_password(){ $('user_password_confirmation').value =$F('user_password');} function mirror_password_conditional(){if(isShowing()) mirror_password();} function toggle_confirmation(mirrorPassword){ $('confirmation').toggle(); $('user_password').type = isShowing()?'password':'text'; a.innerHTML = isShowing()? offString : onString; $('confirm_password').value = isShowing()?'false':'true'; if(mirrorPassword) mirror_password(); }