Greasy Fork

Greasy Fork is available in English.

密码查看器

密码查看器:针对于浏览器已经保存的密码进行查看,使用方法:1、点击油猴插件图标:密码-开启 - 密码-关闭 2、单手快捷键:“o”“p”

当前为 2021-12-29 提交的版本,查看 最新版本

// ==UserScript==
// @name         密码查看器
// @namespace    http://tampermonkey.net/
// @version      0.0.3
// @description  密码查看器:针对于浏览器已经保存的密码进行查看,使用方法:1、点击油猴插件图标:密码-开启 - 密码-关闭 2、单手快捷键:“o”“p”
// @author       wll
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js
// @icon         https://img-blog.csdnimg.cn/20181221195058594.gif
// @match        *://*/*
// @grant        GM_registerMenuCommand
// @run-at       document-start
// @note         授权联系:	[email protected]
// @note         版本更新	20-12-22 0.0.1	针对于浏览器已经保存的密码进行查看,使用方法:点击油猴插件图标:密码-开启 - 密码-关闭
// @note         版本更新	20-12-23 0.0.2	增加密码框自动识别,用于解密使用
// @note         版本更新	20-12-24 0.0.3	优化代码性能,增加单手快捷键:“o”“p”


// ==/UserScript==

(function() {
    'use strict';

    document.addEventListener("keypress", function(e) {
	    console.log("--->e.key:"+e.key);
		switch (e.key.toLowerCase()) {
			case "o":
			    $('input[type=password]').attr("type", "1");
				break;
            case "p":
			    $('input[type=1]').attr("type", "password");
				break;
		}
	});

    function initMenu(){
        if($('input[type=password]').length>0){
            GM_registerMenuCommand('密码-开启', () => {
                $('input[type=password]').attr("type", "1");
            });
            GM_registerMenuCommand('密码-关闭', () => {
                $('input[type=1]').attr("type", "password");
            });
        }
    }
	initMenu();

})();