自动化显示密码

加入快捷键操作

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name 自动化显示密码
// @description  加入快捷键操作
// @namespace https://www.vpsoffers.net/plugins/auto-show-password.html
// @homepageURL https://www.vpsoffers.net/plugins/auto-show-password.html
// @version 0.5
// @include *
// @license *
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_getValue
// @run-at       document-idle
// @license      AGPLv3
// @author lcldh/ChatGPT
// @match *://*/*
// @grant none
// ==/UserScript==

(function() {
'use strict';

// Replacement function
function replacePasswords() {
var inputs = document.getElementsByTagName("input");

for (var i = 0; i < inputs.length; i++) {
var input = inputs[i];

if (input.type.toLowerCase() === "password") {
try {
input.type = "text";
} catch (e) {
var newInput, attributes;

newInput = document.createElement("input");
attributes = input.attributes;

for (var j = 0; j < attributes.length; j++) {
var attribute, name, value;

attribute = attributes[j];
name = attribute.nodeName;
value = attribute.nodeValue;

if ("type" !== name.toLowerCase() && "height" !== name && "width" !== name && !!value) {
newInput[name] = value;
}
}

input.parentNode.replaceChild(newInput, input);
}
}
}
}

// Select the node that will be observed for mutations
const targetNode = document.body;

// Options for the observer (which mutations to observe)
const config = { attributes: true, childList: true, subtree: true };

// Callback function to execute when mutations are observed
const callback = function(mutationsList, observer) {
for(let mutation of mutationsList) {
if (mutation.type === 'childList') {
setTimeout(replacePasswords, 500);
}
}
};

// Create an observer instance linked to the callback function
const observer = new MutationObserver(callback);

// Start observing the target node for configured mutations
observer.observe(targetNode, config);

// Execute the replacement once after the page is loaded
window.addEventListener('DOMContentLoaded', () => {
setTimeout(replacePasswords, 500);
});
})();