Greasy Fork

Greasy Fork is available in English.

汕头大学上网直通车自动登陆

Automatically complete the login of Shantou University online express

// ==UserScript==
// @name         汕头大学上网直通车自动登陆
// @namespace    http://tampermonkey.net/
// @version      0.1
// @license      Anti 996 License
// @description  Automatically complete the login of Shantou University online express
// @description:zh 自动完成汕头大学上网直通车的登录
// @description:zh-CN 自动完成汕头大学上网直通车的登录,登录网站请打开http://1.1.1.2/*
// @author       yunjingshan
// @match        http://1.1.1.2/*
// @match        http://a.stu.edu.cn/*
// @grant        none
// ==/UserScript==
//======================CONFIG======================
// Credentials for auto-login
    var username = "username";
    var password = "password";
// Timeout settings in ms
    var timeoutBeforeLogin = 1500;
    var timeoutBeforeCloseWindows = 3000;
//==================================================

    function $(id){
        return document.getElementById(id);
    }
    function $$(classname){
        return document.getElementsByClassName(classname);
    }
    function $$$(name){
        return document.getElementsByName(name);
    }
    var clickevt = document.createEvent("MouseEvents");
    clickevt.initEvent("click", true, true);


(function() {
    //填写登录信息
    $("password_name").value=username;
    $("password_pwd").value=password;

    setTimeout(function(){
        //登录
        $("password_submitBtn").click();
    }, timeoutBeforeLogin);

    setTimeout(function(){
        //关闭窗口
        window.close();
    }, timeoutBeforeCloseWindows);


})();