Greasy Fork

来自缓存

Greasy Fork is available in English.

bilibili plus bilibilijj

在bilibili界面上直接添加jj的三种下载链接。请登录jj以跳过广告页。播放弹幕可使用potplayer等。视频弹幕同名即可自动加载,第一行false改为true即可打开测试功能。

当前为 2017-01-31 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        bilibili plus bilibilijj
// @namespace   http://qli5.tk/
// @description 在bilibili界面上直接添加jj的三种下载链接。请登录jj以跳过广告页。播放弹幕可使用potplayer等。视频弹幕同名即可自动加载,第一行false改为true即可打开测试功能。
// @include     http://www.bilibili.com/video/av*
// @include     http://bangumi.bilibili.com/anime/*
// @version     0.1
// @grant       GM_xmlhttpRequest
// @author      qli5
// @copyright   qli5, 2014+, 田生
// @license     Mozilla Public License 2.0; http://www.mozilla.org/MPL/2.0/
// @require     http://greasyfork.icu/scripts/2231-bilibili-ass-danmaku-downloader/code/bilibili%20ASS%20Danmaku%20Downloader.user.js
// @connect-src www.bilibilijj.com
// @connect-src comment.bilibili.com
// ==/UserScript==

// 感谢所有大佬,鄙人只做了微小的工作。
(function() {
    var testingMP4Rename=false;
    window.removeEventListener('DOMContentLoaded', init);
    initFont();
    GM_xmlhttpRequest({
        method: 'GET',
        url: 'http://www.bilibilijj'+location.href.match(/\.com.*/)[0],
        onload: function(response) {
            var doc = new DOMParser().parseFromString(response.responseText, 'text/html');
            var links = document.createElement('div');
            var aa;
            aa=document.createElement('a');
            aa.href='http://www.bilibilijj'+location.href.match(/\.com.*/)[0];
            aa.textContent='bilibilijj';
            links.appendChild(aa);
            var input,button;
            if (testingMP4Rename) {
                input=document.createElement('input');
                input.type='text';
                input.value='请选择ass...';
                input.onclick=function() {this.select();};
                links.appendChild(input);
                button=document.createElement('button');
                button.onclick=function() {
                    try {
                        input.select();
                        document.execCommand('copy');
                    }
                    catch(e) {
                        console.warn('Oops, copy failed'+e);
                    }
                };
                button.textContent='copy';
                links.appendChild(button);
            }
            var listCols=doc.getElementById('Right_Main');
            for (var i=0;i<listCols.children.length;i++) {
                var list=listCols.children[i];
                for (var j=0;j<list.children.length;j++) {
                    var flvDiv, mp4Div, assDiv;
                    var name, cid;
                    if (list.children[j].querySelector('span.PBoxName')) {
                        flvDiv=list.children[j].querySelector('span.Data_Main > span.Data_Flv > span.Data_Data');
                        mp4Div=list.children[j].querySelector('span.Data_Main > span.Data_Mp4 > span.Data_Data');
                        assDiv=list.children[j].querySelector('span.Data_Main > span.Data_Ass > span.Data_Data');
                        if (list.children[j].querySelector('span.PBoxName').textContent == '下载地址(右侧方块切换类型)')
                            name=assDiv.children[0].title.slice(0,-7);
                        else
                            name=list.children[j].querySelector('span.PBoxName').textContent;
                        cid=assDiv.children[1].getAttribute('href').match(/cid\=\d*(?=&)/)[0].slice(4);
                        links.appendChild(document.createElement('br'));
                        links.appendChild(document.createTextNode(name));
                        links.appendChild(document.createTextNode(' '));
                        var a;
                        a=document.createElement('a');
                        a.href='http://www.bilibilijj.com'+flvDiv.querySelector('a').getAttribute('href');
                        a.textContent='flv';
                        links.appendChild(a);
                        links.appendChild(document.createTextNode(' '));
                        a=document.createElement('a');
                        if (mp4Div.querySelector('a'))
                            a.href='http://www.bilibilijj.com'+mp4Div.querySelector('a').getAttribute('href');
                        else
                            a.onclick=function() {alert('no mp4 data\nplease check jj');};
                        a.textContent='mp4';
                        links.appendChild(a);
                        links.appendChild(document.createTextNode(' '));
                        a=document.createElement('a');
                        a.onclick=(function(name, cid){
                            return function () {
                                fetchDanmaku(cid, function (danmaku) {
                                    debug('got xml with %d danmaku', danmaku.length);
                                    var ass = generateASS(setPosition(danmaku), {
                                        'title': name,
                                        'ori': location.href,
                                    });
                                    startDownload('\ufeff' + ass, name + '.ass');
                                });
                                if (testingMP4Rename) {
                                    input.value=name+'.mp4';
                                    input.select();
                                }
                                return false;
                            };
                        })(name, cid);
                        a.href='http://www.bilibilijj.com'+assDiv.querySelector('a').getAttribute('href');
                        a.textContent='ass';
                        links.appendChild(a);
                    }
                }
            }
            links.style.backgroundColor='white';
            links.style.padding='10px';
            links.style.border='black';
            links.style.borderWidth='thin';
            links.style.borderStyle='dashed';
            if (location.hostname == 'www.bilibili.com') {
                links.style.zIndex='500000';
                links.style.position='absolute';
                links.style.top='0px';
                document.querySelector('.v_small').appendChild(links);
            }
            else if (location.hostname == 'bangumi.bilibili.com'){
                document.querySelector('.v1-bangumi-list-part-wrapper').appendChild(links);
            }
        }
    });
})();