// ==UserScript==
// @name 职业技能刷课
// @namespace http://tampermonkey.net/
// @namespace https://www.bjjnts.cn/lessonStudy/398/7605
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.bjjnts.cn/lessonStudy/*/*
// @require http://cdn.bootcss.com/jquery/1.8.3/jquery.min.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
var next = getNextCourse()
$.post("/lessonStudy/" + 398 + "/" + next, {},function(data){
console.log("初始化===:", data)
});
sendUpdate(next, 10, 1000)
sendUpdate(next, 50, 2000)
sendUpdate(next, 100, 3000)
sendUpdate(next, 300, 4000)
sendUpdate(next, 600, 5000)
sendUpdate(next, 1200, 6000)
sendUpdate(next, 1500, 7000)
sendUpdate(next, 1800, 8000)
sendUpdate(next, 2000, 9000)
sendUpdate(next, 2200, 1000)
sendUpdate(next, 2500, 11000)
sendUpdate(next, 2700, 12000)
sendUpdate(next, 2900, 13000)
sendUpdate(next, 3000, 14000)
sendUpdate(next, 3500, 15000)
setTimeout(function (){
window.location.href = 'https://www.bjjnts.cn/lessonStudy/398/7605'
}, 17000);
})();
function sendUpdate(id, time, dura){
setTimeout(function (){
$.post("/addstudentTaskVer2/" + 398 + "/" + id, { "learnTime": time,"push_event":"update" },function(data){
console.log("开始刷===:", data)
if(data && data.msg && data.msg.indexOf('8小时') > -1){
alert("兄弟,明天再来吧!兄弟,明天再来吧!兄弟,明天再来吧!兄弟,明天再来吧!兄弟,明天再来吧!兄弟,明天再来吧!兄弟,明天再来吧!兄弟,明天再来吧!兄弟,明天再来吧!兄弟,明天再来吧!兄弟,明天再来吧!兄弟,明天再来吧!兄弟,明天再来吧!兄弟,明天再来吧!兄弟,明天再来吧!兄弟,明天再来吧!" + data.msg)
}
});
}, dura);
}
function getNextCourse(){
var menus = $('.new_demoul li')
let shouldId = ''
$('.new_demoul li').each(function(i,v){
var item = $(v)
var percent = item.find('em').html()
if(percent.indexOf('100%') == -1){
shouldId = item.find('a')[0].getAttribute('data-lessonid')
return false;
}
})
return shouldId
}