Last active
January 23, 2017 18:31
-
-
Save disrupted/dfdf4f51fb216c866ef82c0088ba15db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Force Autocomplete | |
// @description enable autocomplete for all HTML input fields | |
// @author disrupted | |
// @version 0.1 | |
// @match http://*/* | |
// @grant none | |
// ==/UserScript== | |
var initialDelay = 2000; // adjust to make it work with all websites | |
// ================================================================= | |
(function() { | |
'use strict'; | |
var counter = 0; | |
window.addEventListener('load', function() { | |
setTimeout(function() { | |
var forms = document.getElementsByTagName('form'); | |
for (var i = 0; i < forms.length; i++) { | |
forms[i].autocomplete = 'on'; | |
} | |
var inputfields = document.getElementsByTagName('input'); | |
for (var j = 0; j < inputfields.length; j++) { | |
if (inputfields[j].getAttribute('autocomplete') == 'off') { | |
inputfields[j].autocomplete = 'on'; | |
var oldPlaceholder = inputfields[j].getAttribute('placeholder'); | |
inputfields[j].placeholder = oldPlaceholder + ' + autocomplete'; | |
counter++; | |
} | |
} | |
if (counter !== 0) { | |
console.log('[Userjs] forcing autocomplete for ' + counter + ' input fields.'); | |
} | |
}, initialDelay); | |
}, false); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment