Source for "Show Password onFocus"

By LouCypher
Has 84 other scripts.


// ==UserScript==
// @name          Show Password onFocus
// @namespace     http://zoolcar9.lhukie.net/
// @include       *
// @description	  Show password when focus on password field
// ==/UserScript==
// Changelog:
// - 20051010: used XPath;

(function() {
  var inputs, input;
  inputs = document.evaluate(
    '//input[@type="password"]',
    document,
    null,
    XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
    null);
  if(!inputs.snapshotLength) return;
  for(var i = 0; i < inputs.snapshotLength; i++) {
    input = inputs.snapshotItem(i);
    input.addEventListener('focus', function(event) {
      this.type = 'text';
    }, false);
    input.addEventListener('blur', function(event) {
      this.type = 'password';
    }, false);
  }
})();