Greasy Fork

Greasy Fork is available in English.

汕头大学健康打卡自动化

自动完成汕头大学线上服务健康打卡过程。借鉴@SaltfishAmi东南大学健康打卡自动化脚本http://greasyfork.icu/zh-CN/scripts/398138-seu-lwreportepidemicseu-dailyreport-automator

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         STU dailyReport Automator
// @name:zh      汕头大学健康打卡自动化
// @name:zh-CN   汕头大学健康打卡自动化
// @namespace    http://my.stu.edu.cn/
// @version      0.01
// @license      Anti 996 License
// @description  Automatically completes the health daily report during the Wuhan pneumonia pandemic.
// @description:zh 自动完成汕头大学线上服务健康打卡过程。
// @description:zh-CN 自动完成汕头大学线上服务健康打卡过程。借鉴@SaltfishAmi东南大学健康打卡自动化脚本http://greasyfork.icu/zh-CN/scripts/398138-seu-lwreportepidemicseu-dailyreport-automator
// @author       yunjingshan
// @include      https://my.stu.edu.cn/health-report/login.html?_t=1591603871484
// @include      https://my.stu.edu.cn/health-report/report/report.do
// @include      https://sso.stu.edu.cn/login?service=https%3A%2F%2Fmy.stu.edu.cn%2Fhealth-report%2Finit-stu-user
// @grant        none
// ==/UserScript==

//======================CONFIG======================
// Credentials for auto-login
    var username = "username";
    var password = "password";
// Timeout settings in ms
    var timeoutBeforeLogin = 1500;
    var timeoutBeforeClickSummit = 2000;
    var timeoutBeforeCloseWindows = 3000;

//Temperature setting
    //var temperature = String((361 + Math.floor(Math.random() * 10))/10.0);
    var temperature = String(36.4);//固定温度
//==================================================

    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() {
    'use strict';

    if(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 != "my.stu.edu.cn"){
        // login
        $("username").value = username;
        $("password").value = password;

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

    } else {

        setTimeout(function(){

            //填写体温
            $$$("dailyReport.afternoorBodyHeat")[0].value = temperature;
            $$$("dailyReport.forenoonBodyHeat")[0].value = temperature;
            //window.alert($$$("dailyReport.forenoonBodyHeat")[0].value);

            //勾选
            $$$("dailyReport.hasCough")[1].checked="Ture";
            $$$("dailyReport.hasShortBreath")[1].checked="Ture";
            $$$("dailyReport.hasWeak")[1].checked="Ture";
            $$$("dailyReport.hasFever")[1].checked="Ture";
            //window.alert($$$("dailyReport.hasCough")[1].checked);

            //提交健康信息按钮
            $("submitBtn3").click();
            //window.alert($("submitBtn3"));

        }, timeoutBeforeClickSummit);

        setTimeout(function(){
            //window.alert($("noticeMsg").innerHTML);
            if(/数据已上报成功/.test($("noticeMsg").innerHTML)){
                //window.alert("提交成功");
                window.close();
            };
        }, timeoutBeforeCloseWindows);
    }
})();