自动播放插件

autoplay

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         自动播放插件
// @include      http://www.gzjxjy.gzsrs.cn
// @include      https://www.gzjxjy.gzsrs.cn
// @version      1.2
// @description  autoplay
// @author       Jos
// @match        http://www.gzjxjy.gzsrs.cn/personback/#/learning?id=1409765570891055105
// @match        http://www.gzjxjy.gzsrs.cn/personback/#/learning?id=1409765570891055105
// @match        https://www.gzjxjy.gzsrs.cn/personback/#/learning?id=1409765570891055105
// @match        https://www.gzjxjy.gzsrs.cn/personback/#/learning?id=1409765570891055105
// @grant        none
// @namespace http://www.gzjxjy.gzsrs.cn/personback/#/learning?id=1409765570891055105
// ==/UserScript==


var course = document.getElementsByClassName("rightnav cursor-p")[0]
var list = course.getElementsByTagName("li")
var i
setInterval(function(){
    for (i = 0; i < list.length; i++){
        //定位当前课程
        if (list[i].className == "active" && list[i].innerText.indexOf("目录") == -1){
            console.log(list[i].innerText)
            console.log(i)
            var current_course = i
        }
    }
    //当前课程播放完成
    if (list[current_course].innerText.indexOf("100%") != -1){
        //防止点击章节名
        if(list[current_course+1].innerText.indexOf("%") == -1){
            list[current_course+2].click()
        }else{
            list[current_course+1].click()
        }
    }
},2000)