-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathforce-form-autocomplete.user.js
More file actions
83 lines (69 loc) · 2.95 KB
/
force-form-autocomplete.user.js
File metadata and controls
83 lines (69 loc) · 2.95 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// ==UserScript==
// @name Force Forms AutoComplete
// @namespace https://github.com/yodog/userscripts
// @author RASG
// @version 2025.07.30.0043
// @description Forces the autocomplete attribute for all forms and input fields in the page
// @require http://code.jquery.com/jquery-3.7.1.min.js
// @require https://raw.github.com/odyniec/MonkeyConfig/master/monkeyconfig.js
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_addStyle
// @grant GM_registerMenuCommand
// @include http*://*
// @exclude http*://*.google.com/*
// @exclude http*://*.live.com/*
// @noframes
// ==/UserScript==
// -----------------------------------------------------------------------------
// PREVENT JQUERY CONFLICT
// -----------------------------------------------------------------------------
/* global $, jQuery */
this.$ = this.jQuery = jQuery.noConflict(true);
if (typeof $ == 'undefined') console.log('JQuery not found; The script will certainly fail');
// -----------------------------------------------------------------------------
// OPTIONS / CONFIG MENU
// -----------------------------------------------------------------------------
/* global MonkeyConfig */
try {
var cfg = new MonkeyConfig({
title: 'Config JQ_ForceAutoComplete',
menuCommand: true,
onSave: function() { togglePassword(); },
params: {
enable_field : { type: 'checkbox', default: true },
save_password : { type: 'checkbox', default: true },
show_password_as_clear_text : { type: 'checkbox', default: false }
}
});
console.log("MonkeyConfig loaded; The settings menu will be enabled");
}
catch(err) {
console.log("MonkeyConfig not loaded; The settings menu will be disabled");
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
var pwdfields = $('input:password');
function togglePassword() {
pwdfields = pwdfields.add( $('input:password') );
cfg.get('show_password_as_clear_text') ? pwdfields.attr('type', 'text') : pwdfields.attr('type', 'password');
};
function parse(element) {
if ( cfg.get("enable_field") ) {
$('input', element).andSelf().removeAttr("disabled readonly").removeProp("disabled readonly");
}
if ( cfg.get("save_password") ) {
$('input', element).andSelf().attr("autocomplete", "on").prop("autocomplete", "on");
}
togglePassword();
}
$(function() {
$("body").on("click focus load ready", "form, input" , function() {
parse(this)
});
});
// -----------------------------------------------------------------------------
// KNOWN FUNCTIONS THAT PREVENTS AUTOCOMPLETE FROM WORKING
// -----------------------------------------------------------------------------
unsafeWindow.C = function(G) { return false };