Password Input Protector

try to protect your password input!

  1. // ==UserScript==
  2. // @name Password Input Protector
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description try to protect your password input!
  6. // @author HeziCyan
  7. // @include *
  8. // @icon https://www.google.com/s2/favicons?domain=219.58
  9. // @grant none
  10. // @license GPL
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. window.addEventListener('load', function() {
  17. let inputs = document.getElementsByTagName('input')
  18. let pass = new Array
  19. for (let input of inputs) {
  20. if (input.type === 'password') pass.push(input)
  21. }
  22.  
  23. const callback = function(mutationsList, observer) {
  24. for (let mutation of mutationsList) {
  25. if (mutation.type === 'attributes') {
  26. let target = mutation.target
  27. if (target.type !== 'password') {
  28. target.type = 'password'
  29. alert('请不要试图修改密码框的 type 属性!')
  30. }
  31. }
  32. }
  33. }
  34. const config = { attributes: true }
  35. let observer = new MutationObserver(callback)
  36. for (let ele of pass) observer.observe(ele, config)
  37. })
  38. })();

QingJ © 2025

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