慕课网自动下一节视频

慕课网自动放视频

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         慕课网自动下一节视频
// @namespace    http://tampermonkey.net/
// @version      0.3
// @author       User_Bx
// @match        *://www.imooc.com/video/*
// @grant        none
// @description  慕课网自动放视频
// @icon         https://www.imooc.com/static/img/common/touch-icon-ipad.png
// ==/UserScript==
(function() {
    'use strict';
    window.onload=function(){
        var next=document.getElementsByTagName("div");
       var min_start,min_all,s_start,s_all,ms_start,ms_all,href_hea,href_sum;
        var href=window.location.href;
        setTimeout(function(){
            setInterval(function(){
                min_start=parseInt(next[37].firstChild.data.slice(0,1));
                s_start=parseInt(next[37].firstChild.data.slice(2,3));
                ms_start=parseInt(next[37].firstChild.data.slice(3,4));

                min_all=parseInt(next[37].firstChild.data.slice(7,8));
                s_all=parseInt(next[37].firstChild.data.slice(-2,-1));
                ms_all=parseInt(next[37].firstChild.data.slice(-1));

                var href_hea=href.slice(0,28);
                var a=parseInt(href.slice(28,33))+1
                var href_sum=a.toString()
                if(min_start==min_all&&s_start==s_all&&ms_start==ms_all){
                    window.location.href=href_hea+href_sum;
                }
            },500);
        },3000)
    }

})();