Skip to content

Instantly share code, notes, and snippets.

@dvdsmpsn
Created September 26, 2016 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvdsmpsn/0381470265fd2cad9d969e676eefc287 to your computer and use it in GitHub Desktop.
Save dvdsmpsn/0381470265fd2cad9d969e676eefc287 to your computer and use it in GitHub Desktop.
Toggle Passwords Bookmarklet
javascript:(function()%7B%0A%0A%09var F%2Cj%2Cf%2Ci%3B %0A%09F %3D document.forms%3B %0A%09for(j%3D0%3B j<F.length%3B %2B%2Bj) %7B %0A%09%09f %3D F%5Bj%5D%3B %0A%09%09for (i%3D0%3B i<f.length%3B %2B%2Bi) %7B %0A%09%09%09if (f%5Bi%5D.type.toLowerCase() %3D%3D "password") %7B%0A%09%09%09%09f%5Bi%5D.setAttribute("data-original-type"%2C"password")%3B%0A%09%09%09%09f%5Bi%5D.type %3D %27text%27%3B%0A%09%09%09%7Delse%7B%0A%09%09%09%09if (f%5Bi%5D.getAttribute("data-original-type") %3D%3D "password") %7B%0A%09%09%09%09%09f%5Bi%5D.type %3D %27password%27%3B%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D %0A%09%7D %0A%7D)()%3B
javascript:(function(){
var F,j,f,i;
F = document.forms;
for(j=0; j<F.length; ++j) {
f = F[j];
for (i=0; i<f.length; ++i) {
if (f[i].type.toLowerCase() == "password") {
f[i].setAttribute("data-original-type","password");
f[i].type = 'text';
}else{
if (f[i].getAttribute("data-original-type") == "password") {
f[i].type = 'password';
}
}
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment