油猴中文网自动登录
// ==UserScript==
// @name 油猴中文网自动登录
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author gaoshuai
// @match https://bbs.tampermonkey.net.cn/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net.cn
// @require https://code.jquery.com/jquery-2.1.4.min.js
// @grant unsafeWindow
// @grant none
// ==/UserScript==
this.$ = this.jQuery = jQuery.noConflict(true);
(function () {
'use strict';
var username = "你的账号"
var password = "你的密码"
var denglu = $("#comiis_nv > div > div > div > div.comiis_dlq > a:nth-child(1)")
var aa = denglu.text()
if (location.href == "https://bbs.tampermonkey.net.cn/" && aa == "登录") {
var event = new MouseEvent('click');
document.querySelector("#comiis_nv > div > div > div > div.comiis_dlq > a:nth-child(1)").dispatchEvent(event);
}
if (location.href == "https://bbs.tampermonkey.net.cn/member.php?mod=logging&action=login" && aa == "登录") {
document.querySelector('input[name="username"]').value = username
document.querySelector('input[name="password"]').value = password
document.querySelector('button[name="loginsubmit"]').click()
} else {
console.log("已经登录")
return
}
})();