汕頭大學健康打卡自動化
填寫體溫,勾選選項,提交,關閉一氣呵成~
如果想定時,可以添加打卡網頁到啓動瀏覽器打開特定網頁,然後添加定時任務打開瀏覽器。
腳本地址:https://greasyfork.org/zh-CN/scripts/404938-stu-dailyreport-automator
借鑑東南大學打卡自動化腳本:https://greasyfork.org/zh-CN/scripts/398138-seu-lwreportepidemicseu-dailyreport-automator
源碼
// ==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東南大學健康打卡自動化腳本https://greasyfork.org/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);
}
})();