双击显示密码明文 dbclick 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 双击显示密码明文 dbclick 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. (function () {
  13. 'use strict';
  14. let timeout;
  15. document.addEventListener("dblclick", e => {
  16. const ev = e.target;
  17. if (ev.nodeName === "INPUT" && ev.getAttribute("type") === "password") {
  18. ev.setAttribute("type", "password_zykj");
  19. //失去焦点恢复加密
  20. ev.onblur = () => ev.setAttribute("type", "password");
  21. //清除之前的定时器
  22. clearTimeout(timeout);
  23. //定时5秒后恢复加密
  24. timeout = setTimeout(() => {
  25. ev.setAttribute("type", "password")
  26. }, 5000);
  27. }
  28. })
  29. })();

QingJ © 2025

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