Greasy Fork

Greasy Fork is available in English.

河南专技在线辅助

河南专技在线辅助|继续教育公需科目专业科目辅助|自动静音播放|自动播放下一个视频|自动答题(去掉答题弹窗)|手动暂停时进度持续更新

目前为 2019-09-06 提交的版本,查看 最新版本

// ==UserScript==
// @name         河南专技在线辅助
// @version      1.0
// @description  河南专技在线辅助|继续教育公需科目专业科目辅助|自动静音播放|自动播放下一个视频|自动答题(去掉答题弹窗)|手动暂停时进度持续更新
// @author       huangdi
// @match        *://*.ghlearning.com/*
// @require      http://code.jquery.com/jquery-1.12.4.min.js
// @namespace    http://greasyfork.icu/users/360494
// @supportURL   https://huangdi.wodemo.com/hnzjzxfz
// ==/UserScript==

(function() {
    //'use strict';
    // Your code here...

    // For more, refer to http://dev.polyv.net/2013/videoproduct/v-playerapi/v-playerapi-event/jsbf0001/

    function resume()
    {
        player.j2s_resumeVideo();
    }

    function pause()
    {
        player.j2s_pauseVideo();
    }

    function seek(sec)
    {
        player.j2s_seekVideo(sec);
    }

    function stop()
    {
        player.j2s_stopVideo();
    }

    function vol(v)
    {
        player.j2s_setVolume(v);
    }

    function nextVideo(vid)
    {
        player.changeVid(vid);
    }

    function hide()
    {
        player.j2s_hideInterAction();
    }
  
    function toNext(){
        var text=$('li[id][class=active]')[0].innerText;
        console.log(text);
        setTimeout(function(){
            if (text!=$('li[id][class=active]')[0].innerText){
                text=$('li[id][class=active]')[0].innerText;
                console.log(text);
            }
            if(text.match(/[0-9]+%/)[0]=="100%"){
                seek(player.j2s_getDuration()-1);
                resume();
                console.log(text+'播放结束,即将播放下一个视频');
            }else{
                setTimeout(arguments.callee, 5000);
            }}, 5000); 
                    
    }

    function fixFuc (){
        window.s2j_onVideoPause = function () {
            console.log('触发暂停(手动触发或弹题触发),已处理,继续播放');
            setTimeout(hide,2000);
            setTimeout(resume,3000);
        }
    }

    function start(){
        console.log('播放器初始化完成');
        if (first==1){
            first=0;
            alert('河南专技在线辅助加载成功(自动静音播放,视频进度完成自动播放下一个),点击确定后开始。');
            console.log('脚本开始运行');
        }
        player=document.getElementsByClassName("polyvFlashObject")[0];
        setTimeout(resume,1000);//自动播放
        setTimeout(function (){vol(0);},2000);//静音
        setTimeout(fixFuc,3000);//修改功能
        //setTimeout(pause,4000);//暂停视频播放,进度继续增加。
        setTimeout(toNext,5000);//检测进度
    }

    var player,
        first=1;
    
    window.s2j_onPlayerInitOver=start;

})();