Greasy Fork

Greasy Fork is available in English.

chinahrt继续教育加速DrS

进入视频自动开始并静音。解除失去焦点自动暂停,后台听不也挺好吗。一般情形可用。注:使用本脚本视频会一直处于播放状态,请关注提示是否已经播完,如弹出课程评价等。

目前为 2023-02-11 提交的版本,查看 最新版本

// ==UserScript==
// @name         chinahrt继续教育加速DrS

// @version      0.7b
// @description  进入视频自动开始并静音。解除失去焦点自动暂停,后台听不也挺好吗。一般情形可用。注:使用本脚本视频会一直处于播放状态,请关注提示是否已经播完,如弹出课程评价等。
// @author       DrS
// @license      AGPL License
// @match        *://videoadmin.chinahrt.com*/videoPlay/play*
// @match        *://web.chinahrt.com*/index.html#/v_video*
// @grant        none
// @namespace http://greasyfork.icu/users/849179
// ==/UserScript==
$(document).ready(function (){
    // (function () {
    // 'use strict';
//----------------函数定义----------------//
    function goPlayAction(addstr){
        addstr = addstr || '默认调用';
        player.videoPlay();
        player.changeVolume(0.1);
        player.videoMute();
        //player.changePlaybackRate(4); //修改播放速度
            console.log('播放静音倍速3连【'+addstr+'】');
      //  setTimeout(function(){player.videoMute();}, 10000);


    }
        function pauseAction(addstr,waitTime){
            addstr = 'pauseAction'+addstr || 'pauseAction默认调用';
            waitTime = waitTime || 1000;
            if(videoIsEnd==true ){
                document.title = '【已播完】'+document.title;
            }
                if(document.URL.search('end')>34 ||videoIsEnd==true ){
                     //window.close();
                    console.log('检测到视频结束,本次视频恢复取消等待系统进入下一视频');
                    document.getElementsByClassName('ths')[0].innerText='【本视频已经播放过至少1次】'
                    document.title = '【已播完】'+document.title;
                   $(".f14:first").prepend("【重播】");
                    waitTime=5000;
                    videoIsEnd=false;
                }else{setTimeout(function(){goPlayAction(addstr)}, waitTime);}

        }
//----------------函数定义end----------------//
    window.onfocus = function () { console.log('onfocus焦点监控事件已被替换') };
    window.onblur = function () { console.log('onblur原始事件已被替换') };
    var videoIsEnd =false;

    var tmp = setInterval(function () {
        if (player) {
            player.addListener('loadedmetadata', function () {
                setTimeout(function(){goPlayAction('初始加载')}, 1000);
                clearInterval(tmp);
            });
           //player.addListener('pause',pauseAction('暂停监听'));
           player.addListener('ended',function(){videoIsEnd=true});
        }
    }, 500);
setInterval(function () {
    var playerMetaDate=player.getMetaDate();
    if(playerMetaDate['paused']){
        pauseAction('循环检测发现暂停');
        };

} ,20000);
});