智慧树 代码

打开智慧树官网,登录进去打开你要看的课程视频:

智慧树 代码_第1张图片

 最开始是这样的

然后你就打开后台代码查看的地方,一般电脑是直接按F12,就可以了,有些电脑是菜单键+F12(例如惠普):

智慧树 代码_第2张图片

然后就把代码加到红框里面,然后就按回车键(enter键),就执行代码了!


var ti = $("body");
var video = $(".catalogue_ul1 li[id*=video-]");
var i = 1;
var v = 1;
video.css("color", "blue");
console.log("已选取" + video.length + "个小节,并已用蓝色标明,请检查是否有遗漏,如有遗漏,概不负责");
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 () {
            document.getElementById("tmDialog_iframe").contentWindow.document.getElementsByClassName("answerOption")[0].getElementsByTagName("input")[0].click();
            $(".popbtn_cancel").click();
            console.log("已关闭");
        }, 3000);
        i++;
    } else if (e.target.textContent == "本节视频,累计观看时间『100%』") {
        console.log("检测到视频观看完成,准备跳到下一节");
        $('.next_lesson_bg').find('a').trigger('click');
        console.log("已跳转");
        setTimeout(function () {
            $('.volumeIcon').click();
            $('.speedTab15').click();
            console.log("已进行静音和1.5倍加速");
        }, 6000);
        v++;
        console.log("目前播放了" + v + "个视频");
    }
});

最后你的视频字体变成了蓝色就说明成功了:

智慧树 代码_第3张图片

document.getElementsByClassName('speedTab15')[0].click();//先设置一下播放速率为1.5倍速
setInterval(function(){//每3秒执行一次
    //判断播放进度是否到达100%
    if(document.getElementsByClassName('passTime')[0].style.width == '100%'){
        setTimeout(function(){
            //用js执行“下一集”按钮的点击事件,延迟1s执行
            document.getElementById('nextBtn').click();
        },1000);
        setTimeout(function () {
            //延迟两秒执行调节播放速率
            document.getElementsByClassName('speedTab15')[0].click();
        },2000)
    }
    if(document.getElementsByClassName('wrap_popboxes  wrap_popchapter')[0]){
        //观察网页代码发现。弹题框是js生成的,而且类名是唯一的,所以如果用类名获取到了元素,
        //则执行关闭按钮的点击事件,若没有则会返回undefined,就不会执行关闭事件。
        document.getElementsByClassName('popboxes_close tmui_txt_hidd')[0].click();
    }
},3000);
————————————————
版权声明:本文为CSDN博主「_A_Tong」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/i_like_programming/article/details/80195260

代码来至:https://blog.csdn.net/qq_39403545/article/details/80038082

你可能感兴趣的:(智慧树 代码)