Autocomplete On

By Matthew Schultz Last update Feb 5, 2009 — Installed 2,631 times. Daily Installs: 2, 3, 7, 3, 7, 1, 1, 5, 2, 2, 2, 5, 9, 4, 3, 5, 4, 5, 5, 4, 3, 3, 5, 8, 2, 5, 3, 2, 4, 6, 9, 4

There are 2 previous versions of this script.

// ==UserScript==
// @name	Autocomplete On
// @namespace	http://userscripts.org/scripts/show/7347
// @description	Searches for autocomplete attributes in the page and sets the value to on.
// @include	*
// ==/UserScript==

location.href = "javascript:(" + function() {
    function enableAutocomplete()
    {
        // Get all autocomplete attributes
        var oNodeSnapshot = document.evaluate('//@autocomplete', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null), numNodeValues = oNodeSnapshot.snapshotLength - 1;
        //Loop through all the attributes found in the snapshot
        for (var i = numNodeValues; i >= 0; i--) {
            //Get the attribute snapshot object and
            //Change the attribute value to "on"
            oNodeSnapshot.snapshotItem(i).nodeValue = 'on';
        }
    }
    function newSubmit()
    {
        enableAutocomplete();
        if (this._submit !== undefined) {
            this._submit();
        }
    }
    //override DOM submit
    HTMLFormElement.prototype._submit = HTMLFormElement.prototype.submit;
    HTMLFormElement.prototype.submit = newSubmit;
    //Run enable on form submit and page load
    window.addEventListener('submit', newSubmit, true);
    window.addEventListener('load', enableAutocomplete, false);
} + ")()";