Greasy Fork

Greasy Fork is available in English.

职培云刷课

自动播放课程所有视频

当前为 2020-09-28 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         职培云刷课
// @namespace    http://hello.world.net/
// @version      2.0
// @description  自动播放课程所有视频
// @author       TBC
// @match        *://px.class.com.cn/player/study/index?guid=*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var current
    var nav
    var watchtime
    var watchstatus = 1
    var watchmode = 1 //查看模式,0代表未看完的方式,1代表已看完重刷一次,默认1都能做到。
    setTimeout(function() {
        nav = document.getElementsByClassName("list")[0]
        for(var i = 0; i < nav.getElementsByTagName("div").length; i++) {
            //定位到当前任务
            if(nav.getElementsByTagName("div")[i].className.indexOf("active")!=-1) {
                current = i
                break
            }
        }
    }, 5000);
    function watchover(){
        setTimeout(function() {
            while (nav.getElementsByTagName("div")[current+1].className.indexOf("section")==-1){
                current += 1;
            }
            current += 1;
            nav.getElementsByTagName("div")[current].click();
            watchstatus = 1
        }, watchtime*60*1000);
    }
    function watchnew(){
        var test = nav.getElementsByTagName("div")[current].getElementsByClassName("status-done")[0];
        //判断是否播放完成
        if(typeof(test) != "undefined") {
            //alert("视频已播放完成"+test);
            while (nav.getElementsByTagName("div")[current+1].className.indexOf("section")==-1){
                current += 1;
            }
            current += 1;
            nav.getElementsByTagName("div")[current].click();
        }
    }
    setInterval(function() {
        if (watchmode == 1){
            if (watchstatus == 1){
                watchstatus = 0;
                watchtime = parseInt(nav.getElementsByTagName("div")[current].getElementsByClassName("time")[0].innerHTML.split(":")[0]) + 1;
                watchover();
            }
        }
        else{
            watchnew();
        }
    },5000)
    // Your code here...
})();