// ==UserScript==
// @name 学银在线助手/自动刷课
// @namespace http://apcbat.top/
// @version 1.1
// @description 学银在线刷课,自动点击下一页
// @author Apcbat
// @match http://mooc1.xueyinonline.com/mycourse/studentstudy?*
// @grant none
// @supportURL apcbat@qq.com
// @contributionURL http://donate.apcbat.top/
// @license Apache Licence 2.0
// @icon http://donate.apcbat.top/xyzx/logo.ico
// @downloadURL none
// ==/UserScript==
var t;
var started=false;
var button,btnDonate,divD,divTip;
(function() {
'use strict';
var div= $("
学银在线助手
");
button=$("");
button.click(function(){toggle();});
btnDonate=$("
");
divD=$(""+
"
感谢您的捐赠:)
"+
"
")
btnDonate.click(function(){
divD.fadeIn();
});
divD.find("button").click(function(){closeDonate();});
divTip=$("");
div.append(button,btnDonate);
$("body").append(div,divD,divTip);
})();
function toggle(){
started=!started;
if (started){
button.text("点击关闭");
tip("已开启,请不要离开此页面,否则上课时常可能不会被记录!",3000);
tik();
t = setInterval(function(){
tik();
}, 3000);
}else {
button.text("点击开启");
tip("已关闭,感谢您的使用:)",2000);
clearInterval(t);
}
}
function tip(msg,delay){
divTip.text(msg);
divTip.fadeIn();
divTip.delay(delay).fadeOut();
}
function tik(){
if(!started) return;
var f=isFinshed();
log("tik: Finshed:"+f);
if(f) {
tip("本节已完成:)",1000);
$(".tabtags .orientationright").click();
}else{
var ff=$("iframe").contents().find("iframe").contents();
var video=ff.find("video")[0];
if(video.paused){
log("paused");
//tip("检测到暂停,已自动播放",1000);
ff.find(".vjs-big-play-button").click();
}
}
}
function isFinshed(){
var ff = window.frames[0];
var length=$(".ans-job-finished",ff.document).length;
return length>0;
}
function log(msg){
console.log(msg);
}
function closeDonate(){
divD.fadeOut();
}