uyx-pro

将播放器替换为更强大的DPlayer,以支持弹幕、键盘控制和下载功能

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         uyx-pro
// @namespace    krytro.com
// @version      0.1
// @description  将播放器替换为更强大的DPlayer,以支持弹幕、键盘控制和下载功能
// @author       NitroFire
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/DPlayer.min.js
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js
// @include      https://apppc.uyxedu.com/*
// @license MIT
// @grant        none
// ==/UserScript==

(function() {
    'use strict'
    var dp = null
    setInterval(() => {
        if (!document.location.href.match('https://apppc.uyxedu.com/uycourse/detail')) {
            dp && dp.destroy()
            dp = null
            return
        }
        var video = $('.video-js video')
        if (video.length !== 0 && video.attr('src')) {
            var src = video.attr('src')
            $('.video-js').remove()
            dp = new DPlayer({
                container: $('.video-wrap')[0],
                screenshot: true,
                video: {
                    url: src,
                },
                playbackSpeed: [0.5, 0.75, 1, 1.25, 1.5, 2, 3],
                danmaku: {
                    id: 'uxy-pro-' + src.match(/[0-9a-f\-]{10,100}/)[0],
                    api: 'https://api.krytro.com:1443/dplayer/',
                },
                contextmenu: [
                    {
                        text: '原视频',
                        link: src,
                    }
                ]
            })
        }
    }, 100)
})();