Password Revealer

Shows passwords on mouse hover or focus

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name           Password Revealer
// @namespace      http://userscripts.org/users/23652
// @description    Shows passwords on mouse hover or focus
// @include        http://*
// @include        https://*
// @include        file:///*
// @exclude        file:///*/perf.html*
// @copyright      JoeSimmons
// @version        1.0.51
// @license        GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
// ==/UserScript==
(function() {




    var show_only_on_click = false; // only show passwords when you click on the field





    var handlers = [];

    function toText(e) {
        e = e.target;

        if (e.tagName === 'INPUT' && e.type === 'password') {
            // save the cursor position
            e.caretStart = e.selectionStart;
            e.caretEnd = e.selectionEnd;

            // switch it to text, but make it remember it was a password type
            e.type = 'text';
            e.oldType = 'password';

            // the selection range gets reset when we switch its type, so let's fix it
            e.setSelectionRange(e.caretStart, e.caretEnd);
        }
    }

    function toPassword(e) {
        e = e.target;

        if (e.tagName === 'INPUT' && e.oldType === 'password') {
            // save the cursor position
            e.caretStart = e.selectionStart;
            e.caretEnd = e.selectionEnd;

            // switch it to a password field
            e.type = 'password';

            // the selection range gets reset when we switch its type, so let's fix it
            e.setSelectionRange(e.caretStart, e.caretEnd);
            e.setSelectionRange(e.caretStart, e.caretEnd);

            // let's clean up our now-unused properties
            delete e.caretStart;
            delete e.caretEnd;
            delete e.oldType;
        }
    }

    function addHandlers() {
        var fields = document.querySelectorAll('input[type="password"]'), i, field;

        for (i = 0; field = fields[i]; i += 1) {
            if (handlers.indexOf(field) === -1) {
                field.addEventListener('focus', toText, false);
                field.addEventListener('blur', toPassword, false);
                handlers.push(field);
            }
        }
    }

    if (show_only_on_click === false) {
        window.addEventListener('mouseover', toText, false);
        window.addEventListener('mouseout', toPassword, false);
    } else {
        window.setInterval(addHandlers, 1000);
    }

}());