-
Notifications
You must be signed in to change notification settings - Fork 0
/
enable-autocomplete.user.js
31 lines (27 loc) · 1.18 KB
/
enable-autocomplete.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
// ==UserScript==
// @name Enable autocomplete
// @description Removes the autocomplete attribute from form input elements
// @namespace https://joshenders.com
// @version 1.0.1
// @author Josh Enders <[email protected]>
// @updateURL https://raw.githubusercontent.com/joshenders/userscript-enable-autocomplete/master/enable-autocomplete.user.js
// @downloadURL https://raw.githubusercontent.com/joshenders/userscript-enable-autocomplete/master/enable-autocomplete.user.js
// @grant none
// @match *://*/*
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
function removeAttribute(element) {
let attribute = element.getAttributeNode('autocomplete');
if (attribute !== null) {
element.removeAttributeNode(attribute);
}
}
function removeAllAutocompleteAttributes(elements) {
for (let i = 0; i < elements.length; i++) {
removeAttribute(elements[i]);
}
}
removeAllAutocompleteAttributes(document.querySelectorAll('input'))
})();