太和县人力资源和社会保障局平台刷课脚本
这是一个 太和县人力资源和社会保障局继续教育平台 自动刷课的小脚本,主要代码就几行
登录平台后,请手动打开 http://xy.59iedu.com/Course/MyCourse/Index
// ==UserScript==
// @name 太和县人力资源和社会保障局平台刷课脚本
// @namespace you
// @version 0.2
// @description 这是一个 太和县人力资源和社会保障局继续教育平台 自动刷课的小脚本,主要代码就几行
// @author Allen
// @match *://*.59iedu.com/*
// @grant GM_getValue
// @grant GM_setValue
// ==/UserScript==
(function() {
'use strict';
// Your code here...
var confirm = function () {
return true;
};
window.confirm = function () {
return true;
};
var lists = new Array();
var ssss = "";
if (window.location.href.indexOf("http://xy.59iedu.com/Course/MyCourse/Index") != -1) {
var chapters = document.getElementsByTagName("img")
for (var i = 0; i < chapters.length; i++) {
if (chapters[i].src.indexOf("xkarrowone.gif") != -1) {
chapters[i].click()
}
}
//在课程学习页面,获取所有链接
window.setTimeout(function () {
var links = document.getElementById("tabsLearning").getElementsByTagName("a")
for (let i = 0; i < links.length; i++) {
var url = links[i].getAttribute("href");
if (url.indexOf("medId") != -1 && url != null){
console.log('正在采集学习网址:' + url);
lists.push(url)
}
//alert(lists)
}
GM_setValue('lists', lists);
var new_url = lists[0];
console.log('即将开始学习:' + new_url);
window.location.href = "http://xy.59iedu.com" + lists[0];
}, 3000);
}
window.setTimeout(function () {
setInterval(function () {
//判断是否需要 跳转到下一节
var current_course
var current_medId
var lists = GM_getValue('lists',[]);
var progress = document.getElementById("div_ProgressBar_value").innerHTML;
console.log('当前学习网址:' + window.location.href + ' 当前学习进度:' + progress);
if (progress == "100%") {
var now_id = window.location.href.split("&medId=")[1]
console.log('当前学习课程号:' + now_id);
console.log(lists);
for (var i =0; i < lists.length;i++){
var s = lists[i];
if (s == null) {
continue;
}
console.log('正在检测学习网址:' + s);
var index = s.indexOf(now_id)
console.log('当前学习网址索引:' + index);
if (index >= 0){
delete lists[i];
GM_setValue('lists', lists);
console.log('删除当前学习网址:' + window.location.href);
break
}
}
for (var j=0;j<lists.length;j++){
var ss = lists[j];
if (ss != null){
console.log('跳转到新的学习网址:'+ ss);
window.location.href = "http://xy.59iedu.com" + ss;
break;
}
}
}
}, 2000)
}, 4000);
})();
打赏采用二维码方式。
