脚本
学习网站:rlzy.lshrss.cn/Service/Index
脚本地址:丽水市专业技术人员继续教育公需科目-刷课脚本
教程
1.插件安装(以Microsoft Edge浏览器为例)
打开最中间那个蓝色绿色的浏览器,谷歌之类的浏览器也可以
点击屏幕右上角三个点,图示位置,然后点击扩展
点击获取扩展
搜索Tampermonkey,并点击获取那个绿色的小猴子(篡改猴 - Microsoft Edge Addons)
到这里,你的油猴就已经装好啦!同时你可以看见你的浏览器上面多了个黑色图标。
那么接下来教大家安装脚本。
在这个浏览器上打开丽水市专业技术人员继续教育公需科目-刷课脚本,进入后点击安装脚本,安装完成刷新你学习网页就可以愉快使用了。
更多
关键代码分享:
(function() {'use strict';var ivar href = location.hrefif(href.indexOf("sectionid=")!=-1){//获取当前课件var current = document.getElementsByClassName("act")[0].innerText//是文本的话直接跳到下一个课件if(current.indexOf("文本")!=-1){for(i = 0; i < document.getElementsByTagName("li").length; i++){if(document.getElementsByTagName("li")[i].className == "act"){document.getElementsByTagName("li")[i+1].click()break;}}}//是视频的话就播放if(current.indexOf("视频")!=-1){var video = document.getElementsByTagName("video")[0]video.click()//播放完成后自动下一课件setInterval(function(){if(video.ended){for(var i = 0; i < document.getElementsByTagName("li").length; i++){if(document.getElementsByTagName("li")[i].className == "act"){document.getElementsByTagName("li")[i+1].click()break;}}}},5000)}}setInterval(function(){var frame = document.getElementsByTagName("iframe")[0].contentWindow.documentvar end_state = frame.getElementById("lessonStatus").valueif(end_state == "completed"){var lists = document.getElementsByTagName("td")var currentfor(var i = 0; i < lists.length; i++){if(lists[i].className=="couBg"){current = i}}lists[current+1].getElementsByTagName("a")[0].click()}},2000)if(href.indexOf("Learning/Index/") != -1){//根据进度判断是否需要进入课程页面for (i = 0; i < document.getElementsByClassName("td004").length; i++){if(document.getElementsByClassName("td004")[i].innerText!="100%"){document.getElementsByClassName("td005")[i].getElementsByTagName("a")[0].click()}}}if(href.indexOf("Learning/OnLineListen") != -1){//根据已学时长和总时长来判断是否需要听课for(i = 0; i < document.getElementsByClassName("td00a").length; i++){var total_time = makeDurationToSeconds(document.getElementsByClassName("td00a")[i].getElementsByClassName("td003")[1].innerText)var learned_time = makeDurationToSeconds(document.getElementsByClassName("td00a")[i].getElementsByClassName("td003")[2].innerText)console.log(total_time,learned_time)if(learned_time < total_time){document.getElementsByClassName("td00a")[i].getElementsByClassName("td008")[0].getElementsByTagName("a")[0].click()break;}}}//将格式化时间转换秒function makeDurationToSeconds(time){var str = time;var arr = str.split(':');var hs = parseInt(arr[0]*3600);var ms = parseInt(arr[1]*60);var ss = parseInt(arr[2]);var seconds = hs + ms + ss;return seconds;}window.setTimeout(function () {var s = GM_getValue("string")//console.log(s)//console.log(typeof(s))lists = s.split('-')console.log(lists)setInterval(function () {//判断是否需要 跳转到下一节var current_coursevar current_medIdif (learnMediaTime >= mediaTime) {// current_course = lists.shift()// current_medId = current_course.split("&medId=")[1]// while (current_course.indexOf("medId") == -1 || current_medId <= window.location.href.split("&medId=")[1]) {// current_course = lists.shift()// current_medId = current_course.split("&medId=")[1]// }var now_id = window.location.href.split("&medId=")[1]var indexfor (var i = 0; i < lists.length; i++) {if (lists[i].indexOf("medId=" + now_id) != -1) {//确保下一节是课程,而不是章节链接if (lists[i + 1].indexOf("medId=") != -1) {window.location.href = "http://xy.59iedu.com" + lists[i+1];} else {window.location.href = "http://xy.59iedu.com" + lists[i+3];}}}}}, 2000)}, 4000);
})();