Show Password Pro.

Double click to switch password field: YELLOW (pop up tooltip with password); BULE (mouse over to show password); NORMAL (hide password);

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        Show Password Pro.
// @namespace   ShowPassword
// @description Double click to switch password field: YELLOW (pop up tooltip with password); BULE (mouse over to show password); NORMAL (hide password);
// @include     *
// @version     2015.10.11.05
// @author      OscarKoo
// @grant       none
// @run-at      document-end
// ==/UserScript==

(function(document) {
    var delay = 333;

    var index = 0;
    var getCacheKey = function(target) {
        var key = 'data-okspId';
        var value;
        if (!(value = target.getAttribute(key))) {
            target.setAttribute(key, (value = target.id || target.name || ++index));
        }
        return 'okShowPasswordMode_' + value;
    };

    var getMode = function(target) {
        var mode = localStorage.getItem(getCacheKey(target));
        if (!mode || !(mode = parseInt(mode, 10)) || mode < 1 || mode > 3)
            mode = 1;
        return mode;
    };

    var setMode = function(target, mode) {
        if (!(mode = parseInt(mode, 10)) || mode < 1 || mode > 3)
            mode = 1;
        localStorage.setItem(getCacheKey(target), mode);
        return mode;
    };

    function onInput(e) {
        var target = e.target;
        target.title = target.value;
        return false;
    }

    function onMouseOver(e) {
        var target = e.target;
        target.type = 'text';
        target.focus();
        target.selectionStart = target.selectionEnd = target.value.length;
        return false;
    }

    function onMouseOut(e) {
        var target = e.target;
        setTimeout(function() {
            target.blur();
            target.type = 'password';
        }, delay);
        return false;
    }

    function switchMode(target, mode, isClick) {
        target.title = '';
        target.type = 'password';
        target.style.border = '';
        target.removeEventListener('input', onInput);
        target.removeEventListener('mouseover', onMouseOver);
        target.removeEventListener('mouseout', onMouseOut);
        switch (mode) {
            case 1:
                target.style.border = '2px solid #FFCC00';
                target.addEventListener('input', onInput);
                target.title = target.value;
                break;
            case 2:
                target.style.border = '2px solid #3399FF';
                target.addEventListener('mouseover', onMouseOver);
                target.addEventListener('mouseout', onMouseOut);
                if (isClick) target.type = 'text';
                else target.blur();
                break;
        }
    }

    function onDblClick(e) {
        var target = e.target;
        var mode = getMode(target);
        mode = setMode(target, ++mode);
        switchMode(target, mode, true);
    }

    (function() {
        var pwdList = document.querySelectorAll('input[type=password]');
        for (var i = 0; i < pwdList.length; i++) {
            var target = pwdList[i];
            target.addEventListener('dblclick', onDblClick);
            var mode = getMode(target);
            setMode(target, mode);
            switchMode(target, mode);
        }
    })();
})(document);