bilibili toothbrush

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

当前为 2014-05-13 提交的版本,查看 最新版本

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

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

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

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

您需要先安装一款用户脚本管理器扩展,例如 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.7
// @run-at      document-end
// ==/UserScript==

(function() {

    var bofqi = document.getElementById('bofqi');
    var player = bofqi.getElementsByTagName('embed');

    if (player.length > 0) {

        var flashvars = player[0].getAttribute('flashvars');
        var cid_array = flashvars.match(/cid=(\d+)/i);
        var cid = cid_array == null ? 'error' : cid_array[1];

        var aid_array = document.location.href.match(/av(\d+)/i);
        var aid = aid_array == null ? 'error' : aid_array[1];

        if (cid == 'error' || aid == 'error') {
            return;
        }

        bofqi.innerHTML = '<iframe height="482" width="950" class="player" src="https://secure.bilibili.tv/secure,cid=' + cid + '&aid=' + aid + '" scrolling="no" border="0" frameborder="no" framespacing="0" onload="window.securePlayerFrameLoaded=true"></iframe>';

        if (navigator.userAgent.match(/chrome/i)) {
            window.addEventListener("message", function(e){eval(e.data.substr(6))}, false);
        }

    } else {
        return;
    }
})();