pietro.giucastro / Show passwords in asterisks (*) (Always visible version)

// ==UserScript==
// @name         Show passwords in asterisks (*) (Always visible version)
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  This script lets you see the passwords hidden by asterisks.
// @author       pietrogiucastro@alice.it
// @match        https://*
// @match        http://*
// @match        https://*/*
// @match        http://*/*
// ==/UserScript==

(function() {
    'use strict';

    var classname = 'tms-showpass';

    var css = '.'+classname+' { background: rgba(255, 204, 25, 0.6) !important; border: 1px solid orange !important; }',
        head = document.head || document.getElementsByTagName('head')[0],
        style = document.createElement('style');

    style.type = 'text/css';
    if (style.styleSheet){
        style.styleSheet.cssText = css;
    } else {
        style.appendChild(document.createTextNode(css));
    }

    head.appendChild(style);


    function showPasswords() {
        var inputs = document.querySelectorAll('input[type=password]');

        if (inputs.length) inputs.forEach(input => {
            input.type='text';
            input.className += ' ' + classname;
        });
    }

    !function main() {
        showPasswords();
        setInterval(showPasswords, 1000);
    }();
})();