Greasy Fork

Greasy Fork is available in English.

超星网课助手(测试版)

自动挂机看尔雅MOOC,支持后台、切换窗口不暂停,视频自动切换,屏蔽视频内的题目,倍速播放、进度条拖动、快进快退

当前为 2018-09-17 提交的版本,查看 最新版本

// ==UserScript==
// @name         超星网课助手(测试版)
// @namespace    [email protected]
// @version      0.0.20
// @description  自动挂机看尔雅MOOC,支持后台、切换窗口不暂停,视频自动切换,屏蔽视频内的题目,倍速播放、进度条拖动、快进快退
// @author       wyn665817
// @match        *://*.chaoxing.com/ananas/modules/video/index.html*
// @run-at       document-end
// @grant        unsafeWindow
// @license      MIT
// ==/UserScript==

// 设置修改后,需要刷新或重新打开网课页面才会生效
var setting = {
    // 1代表开启,0代表关闭
    video: 1 // 无法关闭,此版本中该参数不支持修改

    // 仅开启video时,修改此处才会生效
    ,line: '公网1' // 视频播放的默认资源线路,默认'公网1'
    ,http: '标清' // 视频播放的默认清晰度,默认'标清'
    ,muted: 0 // 视频静音播放,此功能在视频开始播放时调整音量至静音,默认关闭
    ,drag: 0 // 倍速播放、进度条拖动、快进快退,使用此功能会出现不良记录(慎用),默认关闭
},
_self = unsafeWindow,
$ = _self.$ || top.$;

var vj = _self.ans.VideoJs.prototype,
hook = Math.random().toString(36).substr(2);
vj[hook] = vj.params2VideoOpt;
vj.params2VideoOpt = function () {
    var config = vj[hook].apply(this, arguments),
    line = config.playlines.findIndex(function(currentValue) {
        return currentValue.label == setting.line;
    }),
    http = config.sources.find(function(currentValue) {
        return currentValue.label == setting.http;
    });
    config.playlines.unshift(config.playlines[line]);
    config.playlines.splice(line + 1, 1);
    config.plugins.videoJsResolutionSwitcher.default = http ? http.res : 360;
    config.plugins.studyControl.enableSwitchWindow = 1;
    config.plugins.timelineObjects.url = '/richvideo/initdatawithviewer?';
    config.autoplay = true;
    if (setting.muted) {
        config.muted = true;
    }
    if (setting.drag) {
        config.plugins.seekBarControl.enableFastForward = 1;
    }
    vj.params2VideoOpt = vj[hook];
    delete vj[hook];
    return config;
};