// ==UserScript== // @name 教师信息技术应用能力挂机 // @namespace http://tampermonkey.net/ // @version 1.2 // @description 江西省教育学习挂机 // @author You // @match http://jxsxxyey2016.e.px.teacher.com.cn/home/student/* // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; window.alert = function() {return ;}; var OldNTime, endflag = false; setInterval(function(){ if (!flag && Math.floor(TimeNum/60) >= 1) { OldNTime = $("#cumulativeTime").val(); validateType=false; $("#comfirmButtonTo").click(); SendMsg("课程累计学习" + OldNTime + "分钟!", "更新了"+ Math.floor(TimeNum/60) + "分钟~~~~~", true); isEnd(); } else if (flag) { SendMsg("课程结束!", "课程结束了,请尽快更换课程~~~", false); } else { console.log("更新时间未到,目前学习:" + Math.floor(TimeNum/60)); } }, Math.random()*10000+60000); function isEnd() { setTimeout(function() { var NowNTime = $("#cumulativeTime").val(); if (NowNTime == OldNTime) { SendMsg("课程累计学习" + NowNTime + "分钟!", "课程结束了,请更换课程~~~", false); endflag = true; } }, 30000); } function SendMsg(title, msg, adis) { if (window.Notification){ if (Notification.permission === 'granted') { var notification = new Notification(title,{body:msg,icon:"http://rsp.teacher.com.cn/avatar/125/10498180/130.jpg"}); if (adis) { setTimeout(function() {notification.close();}, 5000); } } else { Notification.requestPermission(function(result) { if (result === 'denied' || result === 'default') { alert('通知权限被无情的拒绝了!'); } else { var notification = new Notification(title,{body:msg,icon:"http://rsp.teacher.com.cn/avatar/125/10498180/130.jpg"}); } }); } } } })();