🏠 Home 

Greasy Fork is available in English.

密码自动填充

禅道--懒人专用的密码填充插件


安装此脚本?
  1. // ==UserScript==
  2. // @name 密码自动填充
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.6.2
  5. // @description 禅道--懒人专用的密码填充插件
  6. // @author zeMing
  7. // @match *://*.project.#####chdu.com/*
  8. // @match *://*.project.#####chdu.com/user-login*
  9. // @icon https://cdn.#####chdu.com/webStatic/wechat-applets/nyt-static/xiao-sun.png
  10. // @license MIT
  11. // @grant GM_setValue
  12. // @grant GM_getValue
  13. // @grant GM_deleteValue
  14. // @grant GM_listValues
  15. // ==/UserScript==
  16. /*
  17. * 前言
  18. * 感谢使用,本脚本针对的是禅道的免登录密码自动填充。你作为使用者,应该具备一定的IT知识。
  19. * 代码的第7行、第8行代表的是脚本的运行网址。作者使用的为project.#####chdu.com所有的页面
  20. *
  21. * 你需要做的是:
  22. * 将代码的第7行、第8行进行修改,否则无法正常使用该脚本。(重要)!
  23. * 至于怎么修改,可百度@match规则。(重要)!
  24. *
  25. */
  26. /*
  27. 2023-11-08 1.[优化]: 代码重构、优化
  28. 2023-11-03 1.[优化]: 逻辑优化
  29. 2023-04-19 1.[新增]: 默认选中-保持登陆
  30. 2023-04-14 1.[修复]: 只在登陆页面加载脚本
  31. 2023-04-13 1.[新增]: 密码填充简易版
  32. */
  33. (function() {
  34. 'use strict';
  35. /* globals jQuery, $, waitForKeyElements */
  36. // 解构简易化,勿动
  37. const { log } = console
  38. let userInfo = {
  39. name: '',
  40. pass: '',
  41. }
  42. log('已加载自动填充密码脚本!')
  43. const userNameDom = document.querySelector('input[type="text"][name="account"]')
  44. const userPassDom = document.querySelector('input[type="password"][name="password"]')
  45. const keepLoginDom = document.querySelector('input[type="checkbox"][name="keepLogin[]"]') || document.getElementById("keepLoginon")
  46. const submitDom = document.getElementById("submit")
  47. submitDom && submitDom.addEventListener('click', function() {
  48. userInfo = {
  49. name: userNameDom.value,
  50. pass: userPassDom.value,
  51. }
  52. GM_setValue('userInfoKey', userInfo)
  53. })
  54. if (userNameDom || userPassDom) {
  55. const jsonUser = GM_getValue('userInfoKey')
  56. const keys = GM_listValues()
  57. if (!jsonUser) return
  58. let { name: storageName, pass: storagePass } = jsonUser || {}
  59. let { name, pass} = userInfo
  60. userNameDom.value = name || storageName
  61. userPassDom.value = pass || storagePass
  62. keepLoginDom.checked = keepLoginDom.checked || true
  63. if (name || pass) return
  64. submitDom.click()
  65. }
  66. })()