双击显示密码double click show password

双击密码输入框显示密码明文,5秒后或者点击其他地方恢复加密 Double-click the password input box to display the password plaintext, after 5 seconds, or click elsewhere to restore the encryption

  1. // ==UserScript==
  2. // @name 双击显示密码double click show password
  3. // @namespace https://172hk.top/
  4. // @version 2024.03.13
  5. // @description 双击密码输入框显示密码明文,5秒后或者点击其他地方恢复加密 Double-click the password input box to display the password plaintext, after 5 seconds, or click elsewhere to restore the encryption
  6. // @author 朱颜科技
  7. // @match *://*/*
  8. // @icon https://hbimg.huabanimg.com/50c02765eb335ab6cafbb23cdcdd35dfb509698941e4-75uiH4_fw658
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15.  
  16. let timeout;
  17. document.addEventListener("dblclick", e => {
  18. const ev = e.target;
  19. if (ev.nodeName === "INPUT" && ev.getAttribute("type") === "password") {
  20. ev.setAttribute("type", "password_zykj");
  21. //失去焦点恢复加密
  22. ev.onblur = () => ev.setAttribute("type", "password");
  23. //清除之前的定时器
  24. clearTimeout(timeout);
  25. //定时5秒后恢复加密
  26. timeout = setTimeout(() => {
  27. ev.setAttribute("type", "password")
  28. }, 5000);
  29. }
  30. })
  31.  
  32. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址