🏠 返回首頁 

密码自动填充

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


Install this script?
// ==UserScript==
// @name         密码自动填充
// @namespace    http://tampermonkey.net/
// @version      0.6.2
// @description  禅道--懒人专用的密码填充插件
// @author       zeMing
// @match        *://*.project.#####chdu.com/*
// @match        *://*.project.#####chdu.com/user-login*
// @icon         https://cdn.#####chdu.com/webStatic/wechat-applets/nyt-static/xiao-sun.png
// @license      MIT
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_deleteValue
// @grant        GM_listValues
// ==/UserScript==
/*
*                  前言
* 感谢使用,本脚本针对的是禅道的免登录密码自动填充。你作为使用者,应该具备一定的IT知识。
* 代码的第7行、第8行代表的是脚本的运行网址。作者使用的为project.#####chdu.com所有的页面
*
* 你需要做的是:
* 将代码的第7行、第8行进行修改,否则无法正常使用该脚本。(重要)!
* 至于怎么修改,可百度@match规则。(重要)!
*
*/
/*
2023-11-08 1.[优化]: 代码重构、优化
2023-11-03 1.[优化]: 逻辑优化
2023-04-19 1.[新增]: 默认选中-保持登陆
2023-04-14 1.[修复]: 只在登陆页面加载脚本
2023-04-13 1.[新增]: 密码填充简易版
*/
(function() {
'use strict';
/* globals jQuery, $, waitForKeyElements */
// 解构简易化,勿动
const { log } = console
let userInfo = {
name: '',
pass: '',
}
log('已加载自动填充密码脚本!')
const userNameDom = document.querySelector('input[type="text"][name="account"]')
const userPassDom = document.querySelector('input[type="password"][name="password"]')
const keepLoginDom = document.querySelector('input[type="checkbox"][name="keepLogin[]"]') || document.getElementById("keepLoginon")
const submitDom = document.getElementById("submit")
submitDom && submitDom.addEventListener('click', function() {
userInfo = {
name: userNameDom.value,
pass: userPassDom.value,
}
GM_setValue('userInfoKey', userInfo)
})
if (userNameDom || userPassDom) {
const jsonUser = GM_getValue('userInfoKey')
const keys = GM_listValues()
if (!jsonUser) return
let { name: storageName, pass: storagePass } = jsonUser || {}
let { name, pass} = userInfo
userNameDom.value = name || storageName
userPassDom.value = pass || storagePass
keepLoginDom.checked = keepLoginDom.checked || true
if (name || pass) return
submitDom.click()
}
})()