Allow Password Remembering

Removes autocomplete="off" attributes

  1. // Allow Password Remembering
  2. // version 0.1
  3. // 2005-04-06
  4. // Copyright (c) 2005, Julien Couvreur
  5. // Released under the GPL license
  6. // http://www.gnu.org/copyleft/gpl.html
  7. // Based on the remember password bookmarklet:
  8. // http://www.squarefree.com/bookmarklets/forms.html#remember_password
  9. // --------------------------------------------------------------------
  10. //
  11. // This is a Greasemonkey user script.
  12. //
  13. // To install, you need Greasemonkey: http://greasemonkey.mozdev.org/
  14. // Then restart Firefox and revisit this script.
  15. // Under Tools, there will be a new menu item to "Install User Script".
  16. // Accept the default configuration and install.
  17. // If you want, you can configure the Included and Excluded pages in
  18. // the GreaseMonkey configuration.
  19. //
  20. // To uninstall, go to Tools/Manage User Scripts,
  21. // select "Allow Password Remembering", and click Uninstall.
  22. //
  23. // --------------------------------------------------------------------
  24. //
  25. // WHAT IT DOES:
  26. // Sites can direct the browser not to save some password fields (for
  27. // increased security). They do it by tagging the password field with
  28. // autocomplete="off", in the HTML. "Allow Password Remembering" removes
  29. // these tags, so that the user can decide which password the browser
  30. // should save.
  31. //
  32. // --------------------------------------------------------------------
  33. //
  34. // ==UserScript==
  35. // @name Allow Password Remembering
  36. // @namespace http://blog.monstuff.com/archives/cat_greasemonkey.html
  37. // @description Removes autocomplete="off" attributes
  38. // @include *
  39. // @version 1.0
  40. // ==/UserScript==
  41.  
  42. // Updated (2005/09/09):
  43. // Included Mark Pilgrim's fix for DeerPark:
  44. // must access element.attributes as an array of objects and use .name and .value properties, can't shortcut with element.attributes['autocomplete']
  45.  
  46.  
  47. var allowAutoComplete = function(element) {
  48. var iAttrCount = element.attributes.length;
  49. for (var i = 0; i < iAttrCount; i++) {
  50. var oAttr = element.attributes[i];
  51. if (oAttr.name == 'autocomplete') {
  52. oAttr.value = 'on';
  53. break;
  54. }
  55. }
  56. }
  57.  
  58. var forms = document.getElementsByTagName('form');
  59. for (var i = 0; i < forms.length; i++)
  60. {
  61. var form = forms[i];
  62. var elements = form.elements;
  63.  
  64. allowAutoComplete(form);
  65.  
  66. for (var j = 0; j < elements.length; j++)
  67. {
  68. allowAutoComplete(elements[j]);
  69. }
  70. }
  71.