bilibili toothbrush

牙刷科技,还原B站播放器,

目前為 2014-05-11 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        bilibili toothbrush
// @namespace   http://www.icycat.com
// @description 牙刷科技,还原B站播放器,
// @include     *www.bilibili.tv/video/*
// @include     *bilibili.kankanews.com/video/*
// @version     1.1
// ==/UserScript==

(function(){
    
    var player = document.getElementById('bofqi').getElementsByTagName('embed');
    
    if (player.length>0){

        //获取cid
        var flashvars = player[0].getAttribute('flashvars');
        var cid_reg = /cid=(\d+)/ig;
        var cid_array = cid_reg.exec(flashvars);
        var cid = cid_array===null ? '':cid_array[1];

        //获取aid
        var url = document.location.href;
        var aid_reg = /av(\d+)/ig;
        var aid_array = aid_reg.exec(url); 
        var aid = aid_array===null ? '':aid_array[1];

        //替换
        document.getElementById('bofqi').innerHTML = '<embed id="bofqi_embed" quality="high" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash" src="https://static-s.bilibili.tv/play.swf" flashvars="cid='+cid+'&aid='+aid+'" allowfullscreeninteractive="true" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" width=950 height=482;">';

    } else {
        return;
    }
})();