超星旧版网盘优化器

为什么要优化旧版呢,因为新版不支持超清视频,而且播放器巨差。

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         超星旧版网盘优化器
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  为什么要优化旧版呢,因为新版不支持超清视频,而且播放器巨差。
// @author       ZLOE https://zhang18.top
// @match        *pan.ananas.chaoxing.com/*
// @grant        none
// @require https://cdn.bootcss.com/dplayer/1.25.0/DPlayer.min.js
// @require https://cdn.jsdelivr.net/npm/hls.js

// ==/UserScript==

(function() {
    'use strict';

    function Dp(){
        try{
            var type = data.http.split('.')[4];
            if (type=='jpg' || type == 'png'){
                console.log("图片")
            }
            else{
                $('div').remove();
                $('body').before("<div id='Dp' style='max-width: 960px;height: 620px;margin: 0 auto;'></div>")
                const dp = new DPlayer({
                    container: document.getElementById('Dp'),
                    autoplay: true,
                    video: {
                        quality: [{
                            name: '超清',
                            url: data.httphd,
                            type: 'auto'
                        }, {
                            name: '标清',
                            url: data.http,
                            type: 'auto'
                        }],
                        defaultQuality: 0,
                    }
                });
            }
        }catch(err){
            $('div').remove();
                $('body').before("<div id='Dp' style='    max-width: 960px;height: 620px;margin: 0 auto;'></div>")
                const dp = new DPlayer({
                    container: document.getElementById('Dp'),
                    autoplay: true,
                    video: {
                        url: data.download,
                        type: 'auto',
                    }});
        }
    }

    function addCssFile(){
        var css = document.createElement("link");
        css.setAttribute("rel", "stylesheet");
        css.setAttribute("type", "text/css");
        css.setAttribute("href", "https://syrme.top/static/DPlayer.min.css");
        css.onload = function(){ }
        document.getElementsByTagName("head")[0].appendChild(css);
    }

    function Rmove(){
        $('#filelist').attr('class','list-list');
    }

    // 主程序
    var number = window.location.href.length;
    if (number>32){
        addCssFile()
        Dp()
    }
    else{
        Rmove()
    }

    // Your code here...
})();