Greasy Fork

Greasy Fork is available in English.

学堂云视频加速

一个学堂云视频播放加速脚本

当前为 2019-02-19 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         xuetangx video speedup
// @name:zh      学堂云视频加速
// @name:zh-CN   学堂云视频加速
// @namespace    http://greasyfork.icu/zh-CN/scripts/377956-xuetangx-video-speedup/
// @homepage     http://blog.shlll.top/
// @version      0.0.1
// @description        A xuetangx video speedup script.
// @description:zh     一个学堂云视频播放加速脚本
// @description:zh-CN  一个学堂云视频播放加速脚本
// @author       SHLLL
// @include      https://*.xuetangx.com/lms*
// @grant        unsafeWindow
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    function speedUp() {
        let ele = document.getElementsByClassName('xt_video_player_speed')[0].getElementsByClassName('xt_video_player_common_list')[0].firstChild;
        ele.setAttribute('data-speed', 64);
        ele.innerText = '64.0x';
        if(window.Notification && Notification.permission !== "denied") {
            Notification.requestPermission(function(status) {
                var n = new Notification('学堂云加速', { body:'在播放器中选择播放速度吧!' });
            });
        }
    }

    unsafeWindow.onload = ()=>{
        console.log('学堂云视频加速器');
        let url = unsafeWindow.location.href;
        if(url.indexOf('video') !== -1) {
            setTimeout(speedUp, 100);
        }
        unsafeWindow.onhashchange = (e)=>{
                console.log('检测到url更改');
                let curUrl = e.newURL;
                if(url.indexOf('video') !== -1) {
                    setTimeout(speedUp, 100);
                }
            }
    }


})();