Greasy Fork

成都信息工程大学健康打卡自动化

自动完成成都信息工程大学线上服务健康打卡过程。

// ==UserScript==
// @name         成都信息工程大学健康打卡自动化
// @name:zh      成都信息工程大学健康打卡自动化
// @name:zh-CN   成都信息工程大学健康打卡自动化
// @namespace    http://jszx.cuit.edu.cn/
// @version      0.1.3
// @license      Anti 996 License
// @description  自动完成成都信息工程大学线上服务健康打卡过程。
// @description:zh 自动完成成都信息工程大学线上服务健康打卡过程。
// @description:zh-CN 自动完成成都信息工程大学线上服务健康打卡过程。
// @author       Zkyao
// @include      *
// @grant        none
// ==/UserScript==

//===================使用说明(必读)=======================
// 1.在安装本脚本时,请将CONFIG中的username改为你计算中心的学号
// 2.再把password改成你计算中心的密码,然后就可以放心食用了
// 3.使用教程:
//    3.1.首先需要自己进入计算中心,然后点击"学生-作业/考试/查卷"
//    3.2.然后就是全自动的打卡了,一般正常只需3-5s,但受浏览器和网速影响可能会稍长
//    3.3.如果过程中发现卡死(最大的可能是登录的时候卡死),直接返回计算中心首页,再点一次"学生-作业/考试/查卷"即可


//======================CONFIG======================
// Credentials for auto-login
var username = "username";
var password = "password";
//==================================================
function $(id){
    return document.getElementById(id);
}
function $$(name){
    return document.getElementsByName(name);
}
function $$$(classname){
    return document.getElementsByClassName(classname);
}
function $$$$(Tagname){
    return document.getElementsByTagName(Tagname);
}
var clickevt = document.createEvent("MouseEvents");
clickevt.initEvent("click", true, true);
//==================================================

(function() {
    'use strict';

    if(window.location.hostname == "login.cuit.edu.cn" && username == "username"){
        // username check
        alert("Please edit the script and set your username & password! \n请编辑脚本,指定你的用户名和密码!");
        alert("The script will now terminate. \n脚本执行中断。");
        return false;

    }

    if(window.location.hostname == "login.cuit.edu.cn"){
        $("txtId").value = username;
        $("txtMM").value = password;
        $$$("IbtnEnterCssClass")[0].dispatchEvent(clickevt);
    }
    if(window.location.pathname == "/Jxgl/Xs/MainMenu.asp"){
        //$$$("mn11R")[0].dispatchEvent(clickevt);
        $$$$("a")[1].dispatchEvent(clickevt);
    }
    if(window.location.pathname == "/Jxgl/Xs/netKs/sj.asp"){
        $$$$("a")[1].dispatchEvent(clickevt);
    }
    if(window.location.pathname == "/Jxgl/Xs/netKs/editSj.asp"){
        $$("sF21650_6")[0].selectedIndex = 4
        $$("sF21650_7")[0].selectedIndex = 1
        $$("sF21650_8")[0].selectedIndex = 1
        $$("sF21650_9")[0].selectedIndex = 1
        $$("B2")[0].dispatchEvent(clickevt);
    }
})();