[更新]智慧树刷课脚本(js)解放你的双手

2019年04月03日 523 次阅读 1 条评论

智慧树

前言

  博主最近又选了智慧树网课,今天开始刷网课的时候发现原来写的脚本(智慧树刷课js脚本)失效了,原来的答题界面可以不选答案直接关闭,现在必须答题才能关闭,今天修改了一下,又可以愉快的开始刷课啦,这次修改了代码使用JQuery。


源代码

/**
*  author: 雨落凋殇
*  blog website: https://rainss.cn
*  description: 自动播放、自动下一集、自动选择视频弹窗题目、自动关闭答题窗口、刷智慧树网课必备
*  use-method: 打开智慧树播放课程界面 按F12 -> Console -> 粘贴本代码 ->按回车键  
*  use-method: 视频左上方出现一个图标点击图标开始刷课 显示‘已开’脚本开始监听 再次点击图标关闭
*  upadteTime: 2019/04/03 21:36:00
*/
//查找节点
var tips = $(".exploreTip");
//创建新节点
var option = $("<div>");
//添加样式
var args = {
    "color":"DarkOrange",
    "text-align":"center",
    "line-height":"90px",
    "font-size":"30px",
    "background-image": "url(data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcgSlBFRyB2NjIpLCBxdWFsaXR5ID0gOTAK/9sAQwADAgIDAgIDAwMDBAMDBAUIBQUEBAUKBwcGCAwKDAwLCgsLDQ4SEA0OEQ4LCxAWEBETFBUVFQwPFxgWFBgSFBUU/9sAQwEDBAQFBAUJBQUJFA0LDRQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgAMgAyAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys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ZWFzjVIlSGGMRuziOQOWcgMqc8AIAuM7a8+GKq06sVUjd9z9AxtTL6uCjRy6HIrK+tnfdu99U+nb7j6W0f4X/Z/CEU2qaVNdPEnlpc3V6ZZgpOC2SxIPPJz718UfHqXTvDfxAs9X0/VpDqUtwkKD7ezKxZWA3bmDBRvU5yqnBB9Rka1/wUg+KmraGNLitdE0a3kuPs32h7SUzRoMg7yXK5yvIOPxySvh+oapqfxH8RaFqmrzxtc3SNdOw5LkSFhGvG1eI/lTJ+YPk84HqRq8zblqfFNVKceVOyPsOz/bBvpLOBhZSSho1Ik2Xa7uOuAMDPoOKK/PS71CV7qZkl1IoXYqWlYkjPHO3milzw7G2vl9x9I/sR20Vx480dZYklU3aZDqCOor9jPG9jbXfwsvbee3img/s+P91IgZfvN2PHYflRRV1fhpHza/i4j0X6n4aftUWdvb+LT5UEceQc7EAz85H8gK8e1F2l1YwuxeFb5iI2OVBZzu498DPrgUUVw4v+JI+kwf+7w9Dfl/0bw3HPD+6njSNUlThlHnS8AjkdB+VbOlEp4q8KKp2rNobrIBwHHkynDevIB59KKKUdkby3LdhZwTWNtJJBG7tGrMzICSSBkk0UUV6p4z3P/Z)",
    "background-repeat": "no-repeat",
    "background-size": "100%",
    "width": "90px",
    "height": "90px",
    "border-radius": "45px",
    "position":"fixed",
    "left":"60px",
    "top":"200px", 
    "z-index":"999"
}
option.css(args);
//添加点击事件
option.attr("onClick","StartOrStop()");
option.attr("id","rains");
option.text("Rains");
//插入节点到页面
tips[0].parentNode.insertBefore(option[0],tips[0])
//定时器
var timer;
//初始状态 0 开启 1关闭
var startstatus = 0;
//次数
var number = 0;
//视频播放到91%时候切换下一个
var percent = 91;
//函数
function start(){
    if(number % 200 == 0){
          console.clear();
    }
    number += 1;
    //获取进度条
    var pass = $(".passTime");
    //获取答题框状态
    var dialog = $(".wrap_popboxes.wrap_popchapter")[0];
    
    //点击关闭按钮关闭答题框
    if(dialog != undefined){
        $("#tmDialog_iframe").contents().find("input[_correctanswer=1]")[0].click()
        //延时关闭弹窗
        setTimeout("$(\".popbtn_cancel\")[0].click();",1000)
    }
    //判断播放进度是否大于83%
    if(parseInt(pass[0].style.width) > percent){
        //切换下一个视频
        $("#nextBtn").click();
    }
    console.log("执行第"+ number + "次");
}
function StartOrStop(){
    //获取播放状态
    var play  = $(".bigPlayButton.pointer")[0];
    if (startstatus == 0){
        //开始脚本
        timer = setInterval(start, 3000);
        //已经暂停 点击开始按钮 
        if(play.style.display == "block"){
            play.click();
        }
        startstatus = 1;
        var rains = $("#rains");
        rains.text("已开");
        rains.css("color","blue");
        console.log("刷课开始执行");
    }else if (startstatus == 1) {
        //停止脚本
        clearInterval(timer);
        //已经播放 暂停播放
        if(play.style.display == "none"){
            play.click();
        }
        startstatus = 0;
        var rains = $("#rains");
        rains.text("已关");
        rains.css("color","red");
        console.log("刷课已停止");
    }
}
//执行监听方法 默认填入代码后开启脚本
StartOrStop()

食用(使用)方法

  打开智慧树平台,点开需要播放的课程视频 按F12选择最顶上的Console点击下面的 >后面的空白处,将本博客提供的js代码复制粘贴到空白处,按回车键后左侧视频上会出现带Rains字样的图标,图标显示“已开”,刷课脚本开始工作,再次点击图标显示“已关”,刷课脚本停止。如下图所示!
  
  智慧树刷课脚本使用演示

源代码下载

下载代码:智慧树刷课脚本.js

雨落凋殇

聆听雨落的声音,俯瞰凋零的落叶。伫细雨之中,感雨落之殇。

文章评论(1)

  1. EchoCow
    EchoCow

    我擦嘞,我刚写完。早半小时来看我就懒得写了 噗噗噗噗噗噗

    2019-04-07 21:36