Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Autcomplete On - Greasemonkey extension

View autocomplete-on.user.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
// ==UserScript==
// @name Autocomplete On
// @namespace http://gist.github.com/gray
// @description Undo the disabling of autocomplete on forms and inputs.
// @include *
// ==/UserScript==
 
// Note: other solutions on userscripts.org don't properly handle dynamically
// inserted widgets. This solution uses the new MutationObserver DOM API.
 
function fixAutocomplete (elem) {
var tags = ['form', 'input'];
for (var i = tags.length - 1; i >= 0; i--) {
var elems = elem.getElementsByTagName(tags[i]);
if (! elems) next;
for (var j = elems.length - 1; j >= 0; j--) {
var attr = elems[j].autocomplete;
if (attr && 'off' == attr) {
elems[j].removeAttribute('autocomplete');
}
}
}
}
 
fixAutocomplete(document);
 
var observer = new MutationObserver(function(mutations) {
mutations.forEach( function (mutation) {
fixAutocomplete(mutation.target);
});
});
observer.observe(document, {
subtree: true,
childList: true,
attributes: true,
attributeFilter: ['autocomplete']
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.