// ==UserScript==
// @name 水木自动登录
// @namespace https://github.com/doggeddog
// @homepage https://github.com/doggeddog/smth_scripts
// @version 0.6.1
// @description 水木社区不能保存登录状态, 这个脚本可以用来自动登录.
// @author doggeddog
// @match *://*.newsmth.net/*
// @match *://*.mysmth.net/*
// @run-at document-end
// @grant GM_getValue
// @grant GM_setValue
// ==/UserScript==
function doLogin() {
var loginButton, id, passwd;
if (window.location.pathname == "/") {
loginButton = document.getElementById("b_login");
id = document.getElementById("id");
passwd = document.getElementById("pwd");
} else {
loginButton = document.getElementById("u_login_submit");
id = document.getElementById("u_login_id");
passwd = document.getElementById("u_login_passwd");
}
var idSave = GM_getValue('autologin_id');
if (!idSave && id && id.value.length) {
GM_setValue('autologin_id', id.value)
idSave = id.value
}
if (loginButton) {
if (idSave && id.value == idSave) {
loginButton.click();
}
}
}
var timeoutID;
function tm_doLogin() {
timeoutID = setTimeout(doLogin,1000);
}
window.addEventListener("load", tm_doLogin, false);// ==UserScript==
// @name 水木自动登录
// @namespace https://github.com/doggeddog
// @homepage https://github.com/doggeddog/smth_scripts
// @version 0.6.1
// @description 水木社区不能保存登录状态, 这个脚本可以用来自动登录.
// @author doggeddog
// @match *://*.newsmth.net/*
// @match *://*.mysmth.net/*
// @run-at document-end
// ==/UserScript==
function doLogin() {
var loginButton, id;
if (window.location.pathname == "/") {
loginButton = document.getElementById("b_login");
id = document.getElementById("id");
} else {
loginButton = document.getElementById("u_login_submit");
id = document.getElementById("u_login_id");
}
if (loginButton) {
if (id && id.value.length) {
loginButton.click();
}
}
}
var timeoutID;
function tm_doLogin() {
timeoutID = setTimeout(doLogin,1000);
}
window.addEventListener("load", tm_doLogin, false);// ==UserScript==
// @name 水木自动登录
// @namespace https://github.com/doggeddog
// @homepage https://github.com/doggeddog/smth_scripts
// @version 0.6.1
// @description 水木社区不能保存登录状态, 这个脚本可以用来自动登录.
// @author doggeddog
// @match *://*.newsmth.net/*
// @match *://*.mysmth.net/*
// @run-at document-end
// ==/UserScript==
function doLogin() {
var loginButton, id;
if (window.location.pathname == "/") {
loginButton = document.getElementById("b_login");
id = document.getElementById("id");
} else {
loginButton = document.getElementById("u_login_submit");
id = document.getElementById("u_login_id");
}
if (loginButton && id && id.value.length) {
loginButton.click();
}
}
var timeoutID;
function tm_doLogin() {
timeoutID = setTimeout(doLogin,1000);
}
window.addEventListener("load", tm_doLogin, false);: // ==UserScript==
: // @name 水木自动登录
: // @namespace https://github.com/doggeddog
: // @homepage https://github.com/doggeddog/smth_scripts
: // @version 0.6.1
: // @description 水木社区不能保存登录状态, 这个脚本可以用来自动登录.
: // @author doggeddog
: // @match *://*.newsmth.net/*
: // @match *://*.mysmth.net/*
: // @run-at document-end
: // ==/UserScript==
: function doLogin() {
: var loginBu
: if (window.location.pathname == "/") {
: loginButton = document.getElementById("b_login");
: id = document.getElementById("id");
: } else {
: loginButton = document.getElementById("u_login_submit");
: id = document.getElementById("u_login_id");
: }
: if (loginButton && id && id.value.length) {
: loginButton.click();
: }
: }
: var timeoutID;
: function tm_doLogin() {
: timeoutID = setTimeout(doLogin,1000);
: }
: window.addEventListener("load", tm_doLogin, false);
: