智慧树

try to take over the world!

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         智慧树
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       不二
// @match        http://study.zhihuishu.com/learning/videoList?courseId=*
// @grant        none
// ==/UserScript==

var fa=$("body");
var btn=$("<li></li>");
var json={
    "background":"#31e16d",
    "height":"16px",
    "padding":"5px",
    "cursor": "pointer",
    "top":"300px",
    "right":"80px",
    "position": "fixed"
};
btn.css(json);
btn.html("<span id='lfsenior'>开启自动播放模式</span>");
fa.append(btn);
var bodywidth=$("#body").css("width");
var mainwidth=$("#main").css("width");
btn.click(function () {
    $("#lfsenior").html("自动模式已开启");
    //关闭弹题
    setInterval(function(){
        $(".popboxes_close").click();
        //获取当前进度
        var spans=$(".current_play span");
        var progress=spans[spans.size()-1].innerHTML;
        document.getElementsByClassName('speedTab15')[0].click();
        if("100"==progress.substring(progress.lastIndexOf("『")+1,progress.lastIndexOf("』")-1)){
            //播放完毕
            $(".next_lesson a").click();
            document.getElementsByClassName('speedTab15')[0].click();
        }else{
            $("#vjs_mediaplayer_html5_api")[0].play();
            $("#vjs_mediaplayer_html5_api")[0].muted=true;
            document.getElementsByClassName('speedTab15')[0].click();
        }
        $("#lfsenior").html("自动模式已开启,本章进度:"+progress+"%");
        document.getElementsByClassName('speedTab15')[0].click();
    },100);
});