(4月可用)最新2020智慧树自动刷课脚本代码(1.5倍速,自动答题,自动跳转视频)
现在网上很多版本失效了, 下面是最新的
var ti = $("body");
var video = $("div[class*='fl cataloguediv-c'] ");
var i = 1;
var v = 1;
console.log("共:"+video.length+"节");
video.children("span").css("color", "blue");
setTimeout(function () {
$('.speedTab15').click();
$('.volumeIcon').click();
console.log("已进行静音和1.5倍加速");
}, 3000);
ti.on("DOMNodeInserted", function (e) {
if (e.target.textContent == "弹题测验 弹题是为了帮助同学们巩固知识点,不会影响到大家作业和考试的成绩。关闭") {
console.log("检测到第" + i + "个弹题窗口");
window.setTimeout(function () {
$(".topic-item").click();
setTimeout(function () {
// $(".popbtn_cancel").click();
$(".el-icon-close").click();
console.log("已关闭");
setTimeout(function(){
$("#playButton").click();
},500);
}, 1000);
}, 2000);
i++;
} else if (e.target.textContent == "Play") {
setTimeout(function () {
if($(".passTime").css("width")== '100%')
{
console.log("检测到视频观看完成,准备跳到下一节");
// $('.next_lesson_bg').find('a').trigger('click');
$("#nextBtn").click();
console.log("已跳转");
setTimeout(function () {
$('.volumeIcon').click();
$('.speedTab15').click();
setTimeout(function(){
// $("#playButton").click();
},500);
console.log("已进行静音和1.5倍加速");
}, 6000);
v++;
console.log("目前播放了" + v + "个视频");
}
},2000);
}
});
版本二:
var chapters_length = document.querySelectorAll("ul.list").length;
var video_length = document.querySelectorAll("li.video").length;
console.log("共检测到" + chapters_length + "章" + video_length + "小节!");
document.getElementsByClassName("volumeIcon")[0].click(); //设置静音
console.log("静音设置成功!");
document.getElementsByClassName("speedTab speedTab15")[0].click(); //设置1.5倍速
console.log("1.5倍播放");
//每两秒检测进度是否100%
setInterval(() => {
var progress = window.getComputedStyle(document.getElementsByClassName("passTime")[0], null).width; //进度数据
if (progress == "100%") {
//下一节
document.getElementById("nextBtn").click();
console.log("自动播放下一节");
setTimeout(() => {
//检测00:00:00状态 处理章节间跳动
if (document.querySelector("span.duration").innerHTML == "00:00:00") {
var finished_length = document.querySelectorAll("b.time_icofinish").length;
document.querySelectorAll("li.video")[finished_length].click();
console.log("进入下一章节!");
}
}, 2000);
}
}, 2000);
//每秒检测弹窗
setInterval(() => {
//防静音意外失效
if(!document.getElementsByClassName("volumeBox volumeNone")[0])
{
document.getElementsByClassName("volumeIcon")[0].click();
document.getElementsByClassName("speedTab speedTab15")[0].click(); //设置1.5倍速
}
if (document.getElementsByClassName("dialog-test")[0]) {
console.log("检测到弹窗!");
var random_number = randomNum(0, document.querySelectorAll("li.topic-item").length - 1);
document.getElementsByClassName("topic-item")[random_number].click(); //随机选一个防作弊
console.log("已选择第" + (random_number + 1) + "个选项");
document.getElementsByClassName("el-dialog__wrapper dialog-test")[0].getElementsByClassName(
"el-dialog__footer")[0].getElementsByClassName("btn")[0].click(); //关闭弹窗
console.log("弹窗关闭!");
document.getElementById("playButton").click(); //播放
}
}, 1000);
function randomNum(minNum, maxNum) {
switch (arguments.length) {
case 1:
return parseInt(Math.random() * minNum + 1, 10);
break;
case 2:
return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
break;
default:
return 0;
break;
}
}
版本三
var main=$("body");
var msg=$("<li></li>");
var json={
"background":"#3D84FF",
"height":"30px",
"padding":"5px",
"top":"100px",
"right":"340px",
"font-size":"16px",
"position": "fixed",
"color":"white",
"line-height":"30px"
};
var ti = $("body");
var video = $(".catalogue_ul1 li[id*=video-]");
var i = 1;
var v = 1;
var now = new Date();
var month = now.getMonth()+1;
msg.css(json);
msg.html("<marquee>\u5df2\u4e3a\u60a8\u5f00\u542f\u81ea\u52a8\u64ad\u653e\u6a21\u5f0f\uff0c\u66f4\u591a\u9ed1\u79d1\u6280\u8bf7\u5173\u6ce8\u006c\u0073\u0069\u0072\u0033\u0034\u0035\u0036\u0037 更多精彩内容请访问www.yaunsine.xyz/homeweb "+now.getFullYear()+"-"+month+"-"+now.getDate()+" "+now.getHours()+":"+now.getMinutes()+"</marquee>");
main.append(msg);
video.css("color", "blue");
setTimeout(function () {
$('.speedTab15').click();
$('.volumeIcon').click();
console.log("已进行静音和1.5倍加速");
}, 3000);
ti.on("DOMNodeInserted", function (e) {
if (e.target.textContent.indexOf("弹题测验")>=0) {
setTimeout(function () {
$(".dialog-test").remove();
$(".v-modal").remove();//移除弹窗
}, 3000);
$("video")[0].play();
console.log("检测到第" + i + "个弹题窗口");
console.log("已关闭");
i++;
} else{
}
});
var ainterval = setInterval(function(){
if($("video")[0].pause){ $("video")[0].play();}
var len = $(".current_play").find(".time_icofinish").length;//找到当前播放已完成
var nextlen = $(".current_play").parent().nextAll().length;
var le = $(".current_play").nextAll().length;
if(len == 1){
console.clear();
if(nextlen==1){
$(".current_play").parents("ul").next().children()[2].getElementsByClassName("clearfix video")[0].click();
setTimeout(function () {
$('.speedTab15').click();
$('.volumeIcon').click();
console.log("已进行静音和1.5倍加速");
}, 1000);
}else if(nextlen==0 && le==1){
$(".current_play").next().contents().click();
setTimeout(function () {
$('.speedTab15').click();
$('.volumeIcon').click();
console.log("已进行静音和1.5倍加速");
}, 3000);
}else if(nextlen==0 && le==0){
$('#nextBtn').click();
//if($(".current_play").parents("div").next().contents()[0].innerText.indexOf("章测试")>=0){
//$(".current_play").parents("ul").next().children()[2].getElementsByClassName("clearfix video")[0].click();
// $('#nextBtn').click();
//}else{
// $('#nextBtn').click();
//$(".current_play").parents("div").next().contents().click();
// }
setTimeout(function () {
$('.speedTab15').click();
$('.volumeIcon').click();
console.log("已进行静音和1.5倍加速");
}, 3000);
}else{
if($(".current_play").parent().next().find('.clearfix').length>1){
$(".current_play").parent().next().find('.clearfix')[1].click();
setTimeout(function () {
$('.speedTab15').click();
$('.volumeIcon').click();
console.log("已进行静音和1.5倍加速");
}, 3000);
}else{
if( $(".current_play").next().length==1){
$('#nextBtn').click();
setTimeout(function () {
$('.speedTab15').click();
$('.volumeIcon').click();
console.log("已进行静音和1.5倍加速");
}, 3000);
}else{
$(".current_play").parent().next().contents().click();//播放下一个视频
setTimeout(function () {
$('.speedTab15').click();
$('.volumeIcon').click();
console.log("已进行静音和1.5倍加速");
}, 3000);
}
}
}
}
},3000);
具体使用方法如下:
进入网页后按F12出现以上界面,点击Console(控制台),然后把代码复制到下面输入框,按下回车(Enter)就会自动1.5倍速,静音播放了