Greasy Fork

Greasy Fork is available in English.

东南大学健康打卡自动化

自动完成东南大学线上服务健康打卡过程。

当前为 2020-03-18 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         SEU lwReportEpidemicSeu dailyReport Automator
// @name:zh      东南大学健康打卡自动化
// @name:zh-CN   东南大学健康打卡自动化
// @namespace    http://seu.saltfish.moe/
// @version      0.1
// @description  Automatically completes the health daily report during the Wuhan pneumonia pandemic.
// @description:zh 自动完成东南大学线上服务健康打卡过程。
// @description:zh-CN 自动完成东南大学线上服务健康打卡过程。
// @author       SaltfishAmi
// @include      *://newids.seu.edu.cn/authserver/login?service=http://ehall.seu.edu.cn/qljfwapp2/sys/lwReportEpidemicSeu/index.do*
// @include      *://ids*.seu.edu.cn/authserver/login?service=http://ehall.seu.edu.cn/qljfwapp2/sys/lwReportEpidemicSeu/index.do*
// @include      *://ehall.seu.edu.cn/qljfwapp2/sys/lwReportEpidemicSeu/index.do*
// @grant        none
// ==/UserScript==

//======================CONFIG======================
// Credentials for auto-login
    var username = "222222222";
    var password = "password";
// Timeout settings in ms
    var timeoutBeforeLogin = 1500;
    var timeoutBeforeClickingAdd = 8000;
    var timeoutBeforeClickingSave = 3000;
    var timeoutBeforeClickingConfirm = 3000;
//==================================================

    function $(id){
        return document.getElementById(id);
    }
    function $$(classname){
        return document.getElementsByClassName(classname);
    }

    var clickevt = document.createEvent("MouseEvents");
    clickevt.initEvent("click", true, true);

(function() {
    'use strict';

    if(window.location.hostname != "ehall.seu.edu.cn"){
        // login
        // This will not work for login pages with role checking, as they have initial onClick functions of "return false".
        // use the url https://newids.seu.edu.cn/authserver/login?service=http://ehall.seu.edu.cn/qljfwapp2/sys/lwReportEpidemicSeu/index.do
        $("username").value = username;
        $("password").value = password;

        setTimeout(function(){
            $$("auth_login_btn")[0].dispatchEvent(clickevt);
        }, timeoutBeforeLogin);

    } else {
        //dailyreport
        setTimeout(function(){
            $$("bh-mb-16")[1].childNodes[1].dispatchEvent(clickevt);
            setTimeout(function(){
                $("save").dispatchEvent(clickevt);
                setTimeout(function(){
                    $$("bh-dialog-btn")[0].dispatchEvent(clickevt);
                }, timeoutBeforeClickingConfirm);
            }, timeoutBeforeClickingSave);
        }, timeoutBeforeClickingAdd);
    }
})();