智慧树

try to take over the world!

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);
});