Show Password on MouseOver

Show password when mouseover a password field

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name          Show Password on MouseOver
// @namespace     MickyFoley
// @description   Show password when mouseover a password field
// @version       1.1
// @author        MickyFoley
// @license       free
// @include       *
// @grant         none
// ==/UserScript==

(function() {
  function showPassword(event) {
    const target = event.target;
    if (target.matches('input[type="password"]')) {
      target.type = 'text';

      // Use MutationObserver to prevent interference
      const observer = new MutationObserver(mutations => {
        for (const mutation of mutations) {
          if (mutation.attributeName === 'type' && target.type !== 'text') {
            target.type = 'text';
          }
        }
      });

      observer.observe(target, { attributes: true });

      const restoreType = () => {
        observer.disconnect();
        target.type = 'password';
        target.removeEventListener('mouseleave', restoreType);
      };

      target.addEventListener('mouseleave', restoreType, { once: true });
    }
  }

  document.addEventListener('mouseover', showPassword, true);
})();