Double click toggles password to text field and back
当前为
// ==UserScript==
// @name Show Password on Double Click
// @namespace myfonj
// @description Double click toggles password to text field and back
// @include *
// @grant none
// @license CC0
// @version 2.0.1
// ==/UserScript==
// https://greasyfork.org/en/scripts/431017/versions/new
if(!document.body || !document.body.addEventListener) {
return
}
var swappedFields = new Map();
function swap(e) {
var t = e.target;
if(swappedFields.get(t) == true) {
t.type = 'password';
swappedFields.delete(t);
return
}
if ('INPUT' != t.tagName || 'password' != t.type) {
return
}
t.type = 'text';
swappedFields.set(t, true);
}
document.body.addEventListener('dblclick', swap, true);