Bilibili 旧播放页

切换旧版播放页面,布局、播放器全部切换回2019年12月09日之前的样子。

Fra og med 10.01.2020. Se den nyeste version.

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 or Violentmonkey 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.

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

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         Bilibili 旧播放页
// @namespace    https://greatest.deepsurf.us/zh-CN/scripts/394296
// @version      2.3.5
// @description  切换旧版播放页面,布局、播放器全部切换回2019年12月09日之前的样子。
// @author       Motoori Kashin
// @match        *://*.bilibili.com/video/av*
// @match        *://*.bilibili.com/watchlater/*
// @match        *://*.bilibili.com/bangumi/play/ss*
// @match        *://*.bilibili.com/bangumi/play/ep*
// @license      MIT
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const OR_HTML = document.getElementsByTagName("head")[0].innerHTML;
    const path = location.pathname.match(/(?<=\/).*?(?=\/)/)[0];

    /*function xhrHM(){ // 同步链接获取网页数据
        const xhr = new XMLHttpRequest();
        xhr.open('GET', window.location.href, false);
        xhr.send(null);
        if (xhr.status === 200) {
            return xhr.responseText;
        }
    }
    function adscr(src){ // 添加同步script
        let script = document.createElement("script");
        script.setAttribute("type","text/javascript");
        script.setAttribute("src",src);
        document.body.appendChild(script);
    }
    function anscr(src){ // 添加异步script
        let script = document.createElement("script");
        script.setAttribute("src",src);
        script.setAttribute("crossorigin","");
        script.setAttribute("defer","defer");
        document.body.appendChild(script);
    }
    function repEle(ele,dcm){ // 替换页面元素
        let rp = document.getElementsByTagName(ele)[0];
        let rpw = document.createElement(ele);
        rpw.innerHTML = dcm;
        rp.replaceWith(rpw);
    }
    function onPlay(){ // 动态添加av页播放器初始化代码
        let bofqi = document.getElementById("bofqi");
        let str = '<script>function getQueryString(e){var r=new RegExp(\"(^|&)\"+e+\"=([^&]*)(&|$)\"),i=window.location.search.substr(1).match(r);return null!=i?unescape(i[2]):null}window.getInternetExplorerVersion=function(){var e=-1;if(\"Microsoft Internet Explorer\"==navigator.appName){var r=navigator.userAgent;null!=new RegExp(\"MSIE ([0-9]{1,}[.0-9]{0,})\").exec(r)&&(e=parseFloat(RegExp.$1))}return e};var vd=window.__INITIAL_STATE__&&window.__INITIAL_STATE__.videoData;if(vd&&vd.aid&&9!==getInternetExplorerVersion()){if($(\"#__bofqi\").innerHTML=\'<div class=\"bili-wrapper\" id=\"bofqi\"><div id=\"player_placeholder\"></div></div>\',vd.embedPlayer){var p=getQueryString(\"p\")?getQueryString(\"p\")-1:0,player={aid:vd.aid,cid:vd.pages[p]&&vd.pages[p].cid||vd.pages[0].cid};EmbedPlayer(\"player\",\"//static.hdslb.com/play.swf\",\"cid=\"+player.cid+\"&aid=\"+player.aid+\"&pre_ad=\")}vd.embed&&$(\"#bofqi\").html(vd.embed)}else $(\"#bofqi\").remove()</script>';
        var range = document.createRange()
        range.setStart(bofqi, 0)
        bofqi.appendChild(
            range.createContextualFragment(str)
        )
    }*/
    function wrAV(){ // 处理av页
        let html = '<!DOCTYPE html><html><head><script type="text/javascript">window.__BILI_CONFIG__={"show_bv":false}</script><link rel="stylesheet" href="//s1.hdslb.com/bfs/static/jinkela/videoplay/css/video.0.406cee7878545872b8dfbe73071d665dfb287c67.css" /><style>#bofqi .player {width:980px;height:556px;display:block;}@media screen and (min-width:1400px){#bofqi .player{width:1160px;height:686px}}</style></head><body><script type="text/javascript" src="//static.hdslb.com/js/jquery.min.js"></script> <script type="text/javascript" src="//static.hdslb.com/js/video.min.js"></script><div class="z-top-container has-menu"></div><div class="player-fix abs" id="bofqi" style="visibility: hidden;"><script type="text/javascript">function getQueryString(e){var r=new RegExp("(^|&)"+e+"=([^&]*)(&|$)"),i=window.location.search.substr(1).match(r);return null!=i?unescape(i[2]):null}window.getInternetExplorerVersion=function(){var e=-1;if("Microsoft Internet Explorer"==navigator.appName){var r=navigator.userAgent;null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(r)&&(e=parseFloat(RegExp.$1))}return e};var vd=window.__INITIAL_STATE__&&window.__INITIAL_STATE__.videoData;if(vd&&vd.aid&&9!==getInternetExplorerVersion()){if($("#__bofqi").innerHTML=\'<div class="bili-wrapper" id="bofqi"><div id="player_placeholder"></div></div>\',vd.embedPlayer){var p=getQueryString("p")?getQueryString("p")-1:0,player={aid:vd.aid,cid:vd.pages[p]&&vd.pages[p].cid||vd.pages[0].cid};EmbedPlayer("player","//static.hdslb.com/play.swf","cid="+player.cid+"&aid="+player.aid+"&pre_ad=")}vd.embed&&$("#bofqi").html(vd.embed)}else $("#bofqi").remove()</script></div><script>0</script><div id="app" data-server-rendered="true"></div><script type="text/javascript" src="//s1.hdslb.com/bfs/seed/jinkela/header/header.js"></script><script type="text/javascript" src="//static.hdslb.com/phoenix/dist/js/comment.min.js"></script><script src="//s1.hdslb.com/bfs/static/jinkela/videoplay/1.video.406cee7878545872b8dfbe73071d665dfb287c67.js" crossorigin="" defer="defer"></script><script src="//s1.hdslb.com/bfs/static/jinkela/videoplay/video.406cee7878545872b8dfbe73071d665dfb287c67.js" crossorigin="" defer="defer"></script><div class="footer bili-footer report-wrap-module"></div><link rel="stylesheet" href="//static.hdslb.com/phoenix/dist/css/comment.min.css" type="text/css" /><script type="text/javascript" src="//static.hdslb.com/js/jquery.qrcode.min.js"></script><script type="text/javascript" charset="utf-8" src="//static.hdslb.com/common/js/footer.js"></script></body></html>';
        document.open();
        document.write(html);
        document.close();
    }
    function wrWL(){ // 处理稍后再看
        let html = '<!DOCTYPE html><html><head><link rel="stylesheet" href="//static.hdslb.com/phoenix/dist/css/comment.min.css" type="text/css"><link rel="stylesheet" href="//static.hdslb.com/elec_2/dist/css/later_elec.css" type="text/css"><link rel="stylesheet" href="//static.hdslb.com/tag/css/tag-index2.0.css" type="text/css"><script type="text/javascript">window.__BILI_CONFIG__={"show_bv":false}</script><link rel="stylesheet" href="//static.hdslb.com/phoenix/dist/css/comment.min.css" type="text/css"><link rel="stylesheet" href="//static.hdslb.com/elec_2/dist/css/later_elec.css" type="text/css"><link rel="stylesheet" href="//static.hdslb.com/tag/css/tag-index2.0.css" type="text/css"><link href="//s1.hdslb.com/bfs/static/phoenix/viewlater/static/css/main.d9641d2f4dc42228ea8c2650e1b98b0b.css" rel="stylesheet"></head><body><div class="z-top-container has-menu"></div><div id="watchlater-app"></div><div class="footer bili-footer"></div><script type="text/javascript">0</script><script type="text/javascript" src="//static.hdslb.com/js/jquery.min.js"></script><script type="text/javascript" src="//static.hdslb.com/js/jquery.qrcode.min.js"></script><script type="text/javascript" src="//s1.hdslb.com/bfs/seed/jinkela/header/header.js"></script><script type="text/javascript" src="//static.hdslb.com/common/js/footer.js"></script><script type="text/javascript" src="//static.hdslb.com/js/swfobject.js"></script><script type="text/javascript" src="//static.hdslb.com/js/video.min.js"></script><script type="text/javascript" src="//static.hdslb.com/account/bili_quick_login.js"></script><script type="text/javascript" src="//static.hdslb.com/phoenix/dist/js/comment.min.js"></script><script type="text/javascript" src="//static.hdslb.com/mstation/js/upload/moxie.js"></script><script type="text/javascript" src="//static.hdslb.com/mstation/js/upload/plupload.js"></script><script type="text/javascript" src="//static.hdslb.com/elec_2/dist/js/later_elec.js"></script><script type="text/javascript" src="//s1.hdslb.com/bfs/static/jinkela/watchlater/1.watchlater.ba8f2751267792c1f4a5e3a14514e47c34afba61.js"></script><script type="text/javascript" src="//s1.hdslb.com/bfs/static/jinkela/watchlater/watchlater.ba8f2751267792c1f4a5e3a14514e47c34afba61.js"></script></body></html>';
        document.open();
        document.write(html);
        document.close();
    }
    function wrBGM(){ // 处理BGM页
        let html = '<!DOCTYPE html><html><head><link rel="stylesheet" href="//static.hdslb.com/phoenix/dist/css/comment.min.css" type="text/css" /><script type="text/javascript">window.__BILI_CONFIG__={"show_bv":false}</script><script type="text/javascript" src="//static.hdslb.com/js/jquery.min.js"></script><script type="text/javascript" src="//static.hdslb.com/js/video.min.js"></script><script type="text/javascript" src="//static.hdslb.com/vip/dist/js/vipPlugin.v2.js"></script><script type="text/javascript" src="//static.hdslb.com/js/promise.auto.min.js"></script><script type="text/javascript" src="//s1.hdslb.com/bfs/seed/jinkela/header/header.js"></script><script type="text/javascript" src="//s2.hdslb.com/bfs/cm/st/bundle.js"></script><link rel="stylesheet" href="//s1.hdslb.com/bfs/static/bangumi/play/css/bangumi-play.0.764aaa07c8ac8078b639306b18838d080a1cefc1.css" /></head><body><div class="z-top-container has-menu"></div><div id="app" data-server-rendered="true" class="main-container"></div><script src="//s1.hdslb.com/bfs/static/bangumi/play/1.bangumi-play.764aaa07c8ac8078b639306b18838d080a1cefc1.js" crossorigin="" defer="defer"></script><script src="//s1.hdslb.com/bfs/static/bangumi/play/bangumi-play.764aaa07c8ac8078b639306b18838d080a1cefc1.js" crossorigin="" defer="defer"></script><script type="text/javascript">0</script><div class="footer bili-footer report-wrap-module" id="home_footer"></div><script type="text/javascript" src="//static.hdslb.com/common/js/footer.js"></script><script src="//s1.hdslb.com/bfs/static/plugin/vip/BilAccountThaw.js"></script></body></html>';
        document.open();
        document.write(html);
        document.close();
    }
    function setDM(){ // 选择弹幕列表
        let cDM = setInterval(function(){
            let DMList = document.getElementsByClassName("bilibili-player-filter-btn")[1];
            if (DMList){
                DMList.click();
                clearInterval(cDM);
            }
        }, 10);
    }
    function reAV(){ // av页入口
        if (OR_HTML.match(/biliconfig/) == null){ // 排除自动重定向的av页
            new wrAV();
            new setDM();
            let reh = setInterval(function(){ // av页后续处理
                let reHead = document.getElementsByClassName("bili-header-m");
                if (reHead[1]){
                    reHead[1].remove(); // 移除旧版av页已失效版头
                    document.getElementById("bofqi").removeAttribute("style"); // 取消播放器隐藏
                    document.getElementById("entryNew").setAttribute("style","visibility: hidden;"); // 隐藏新版入口
                    clearInterval(reh);
                }
            }, 10);
        }
    }
    function reWL(){ // 稍后再看入口
        new wrWL();
        new setDM();
    }
    function reBGM(){ // BGM页入口
        if (OR_HTML.match(/出错/) == null){ // 排除无效BGM页
            new wrBGM();
            new setDM();
            let reh = setInterval(function(){ // BGM页后续处理
                let entryNew = document.getElementsByClassName("new-entry")[0];
                if (entryNew){
                    entryNew.setAttribute("style","visibility: hidden;");
                    clearInterval(reh);
                }
            }, 10);
        }
    }
    /* 分离页面 */
    if (path == 'video'){new reAV();}
    if (path == 'watchlater'){new reWL();}
    if (path == 'bangumi'){new reBGM();}
})();