【刷学时】杭州科目驾驶培训网络课程
快速通过杭州科目驾驶培训网络课程,俗称【刷学时】
不知道其他地区是不是也要这个流程,但是在杭州驾校交钱报名后,需要进行「科目驾驶人培训」
而官网的视频需要看足 9 小时,中间还好不定时弹框进行心跳验证。刷动漫或者工作一不小心又要重头开始刷。而且页面还不能遮挡(浏览器只能最小化页面,不能切换其他tab/窗口)
本脚本解决:
在任意切换窗口、浏览其他页面时会自动计时
如果有验证弹窗,发送桌面通知
// ==UserScript==
// @name 【刷学时】杭州科目驾驶培训网络课程
// @namespace https://github.com/xujuvenile
// @version 0.1
// @description 快速通过杭州科目驾驶培训网络课程,俗称【刷学时】
// @author xujuvenile
// @match https://*.5u5u5u5u.com/studyOnLine.action*
// @grant none
// ==/UserScript==
(function() {
'use strict';
if (!("Notification" in window)) {
alert("请更新浏览器至最新版本");
}
Notification.requestPermission();
var notification = new Notification("验证通知已打开");
function sendNotification(){
if (Notification.permission === "granted") {
var notification = new Notification("【驾驶培训】请完成提示框验证!");
}else if (Notification.permission !== 'denied') {
Notification.requestPermission(function (permission) {
if (permission === "granted") {
var notification = new Notification("【驾驶培训】请完成提示框验证!");
}
});
}
}
var oldInspect = window.inspect;
window.inspect = function(){
oldInspect();
sendNotification();
};
// 检查浏览器页面被遮挡自动定时
// 提示框文字:您已离开当前页面,计时停止.
var timerCheckId;
function pageHideHandaler(){
if(!timerCheckId) {
timerCheckId = setInterval(()=>{
var alertText = document.getElementsByClassName('xubox_text')[0];
var confirmBtn = document.getElementsByClassName('xubox_botton1')[0];
if(alertText && alertText.textContent && alertText.textContent.includes('计时停止') && confirmBtn) confirmBtn.click()
}, 1000)
console.log('设置每隔1s检查成功,id=', timerCheckId)
}
}
pageHideHandaler();
})();
打赏采用二维码方式。
