自动化显示密码

加入快捷键操作

  1. // ==UserScript==
  2. // @name 自动化显示密码
  3. // @description 加入快捷键操作
  4. // @namespace https://www.vpsoffers.net/plugins/auto-show-password.html
  5. // @homepageURL https://www.vpsoffers.net/plugins/auto-show-password.html
  6. // @version 0.5
  7. // @include *
  8. // @license *
  9. // @grant GM_addStyle
  10. // @grant GM_setValue
  11. // @grant GM_getValue
  12. // @run-at document-idle
  13. // @license AGPLv3
  14. // @author lcldh/ChatGPT
  15. // @match *://*/*
  16. // @grant none
  17. // ==/UserScript==
  18.  
  19. (function() {
  20. 'use strict';
  21.  
  22. // Replacement function
  23. function replacePasswords() {
  24. var inputs = document.getElementsByTagName("input");
  25.  
  26. for (var i = 0; i < inputs.length; i++) {
  27. var input = inputs[i];
  28.  
  29. if (input.type.toLowerCase() === "password") {
  30. try {
  31. input.type = "text";
  32. } catch (e) {
  33. var newInput, attributes;
  34.  
  35. newInput = document.createElement("input");
  36. attributes = input.attributes;
  37.  
  38. for (var j = 0; j < attributes.length; j++) {
  39. var attribute, name, value;
  40.  
  41. attribute = attributes[j];
  42. name = attribute.nodeName;
  43. value = attribute.nodeValue;
  44.  
  45. if ("type" !== name.toLowerCase() && "height" !== name && "width" !== name && !!value) {
  46. newInput[name] = value;
  47. }
  48. }
  49.  
  50. input.parentNode.replaceChild(newInput, input);
  51. }
  52. }
  53. }
  54. }
  55.  
  56. // Select the node that will be observed for mutations
  57. const targetNode = document.body;
  58.  
  59. // Options for the observer (which mutations to observe)
  60. const config = { attributes: true, childList: true, subtree: true };
  61.  
  62. // Callback function to execute when mutations are observed
  63. const callback = function(mutationsList, observer) {
  64. for(let mutation of mutationsList) {
  65. if (mutation.type === 'childList') {
  66. setTimeout(replacePasswords, 500);
  67. }
  68. }
  69. };
  70.  
  71. // Create an observer instance linked to the callback function
  72. const observer = new MutationObserver(callback);
  73.  
  74. // Start observing the target node for configured mutations
  75. observer.observe(targetNode, config);
  76.  
  77. // Execute the replacement once after the page is loaded
  78. window.addEventListener('DOMContentLoaded', () => {
  79. setTimeout(replacePasswords, 500);
  80. });
  81. })();

QingJ © 2025

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