// ==UserScript==
// @name         [new]刷课脚本2-自动播放未放完视频及下一集
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        http://cqlg.360xkw.com/gxplatform/gxlearningcenter/rebackVideo.html?subId=*
// @grant        none
// ==/UserScript==
//

(function() {
    'use strict';

    // Your code here...
    setTimeout(start, 5000);
    var ele;
    var index=0; // 当前视频
    function start(){
        ele = $('#recordVideoBox ul li').eq(index)
        console.log('======>',ele.find('span').text());
    }

    // 8、play:播放监听
    video.on('play', function (e) {
        console.log('提示该视频正在播放中')
        index = $('#recordVideoBox ul li .onLive').parent().index();

    })
    // 9、pause:暂停监听
    video.on('pause', function (e) {
        // 获取当前播放视频
        console.log("++++++++++++暂停监听++++++++++++")
        index = $('#recordVideoBox ul li .onLive').parent().index();

        var item_duration = parseInt(video[0].duration); // 当前视频总时长
        var watchTime = parseInt(studyprogress); // 观看时长
        console.log('视频总时长:',item_duration);
        console.log('视频已观看时长:',watchTime);

        // 判断当前视频是否看完
        if(watchTime < item_duration){
           var jb_onlive = $('#recordVideoBox ul li').find('.onLive')
           video[0].currentTime = watchTime;
           jb_onlive.click();
        }else{
           var jb_onlive2 = $('#recordVideoBox ul li').eq(++index).find('a')
           jb_onlive2.click();
        }
    })

})();

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐