Greasy Fork

来自缓存

Greasy Fork is available in English.

bilibiliTHEbangumi

add links @introductions on bangumi to bilibili.tv and tucao.cc

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @author	   Yukin
// @name           bilibiliTHEbangumi
// @include        /^https?://bangumi\.tv/subject/[0-9]*$/
// @version 0.1
// @description       add links @introductions on bangumi to bilibili.tv and tucao.cc 
// @grant       none
// @namespace http://greasyfork.icu/users/1228
// ==/UserScript==
// Add jQuery
var GM_JQ = document.createElement('script');
GM_JQ.src = 'http://jquery.com/src/jquery-latest.js';
GM_JQ.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(GM_JQ);

// Check if jQuery's loaded
function GM_wait()
{
    if(typeof unsafeWindow.jQuery == 'undefined') { window.setTimeout(GM_wait,100); }
    else { $ = unsafeWindow.jQuery; letsJQuery(); }
}
GM_wait();


// *** put your code inside letsJQuery: ***
function letsJQuery()
{
    $(document).ready(function () {
        //alert("jQuery is OK!");
    });
	main();
}

// the guts of this userscript
function main() {
	//alert(document.URL);
	var summary = $("div[id='subject_summary']");
	var left_col = $("ul[id='infobox']");
	//alert(left_col.html());
	var title = $("title");
	var name_patt = new RegExp("(.*) \\| Bangumi");
	var name = name_patt.exec(title.html());
	name = name[1];
	var nname = encodeURIComponent(name);
	//alert(name);
	summary.before('<p><a href='+'http://www.bilibili.tv/search?keyword='+nname+'&orderby=&formsubmit='+'><font color="gray">( ̄︶ ̄)传送至'+name+' @bilibili.tv~</font></a></p>');
	summary.before('<p><a href='+'http://www.tucao.cc/index.php?m=search&c=index&a=init2&catid=0&time=all&order=inputtime&username=&tag=&q='+nname+'><font color="gray">( ̄︶ ̄)传送至'+name+' @tucao.cc~</font></a></p>');
	var aname_patt = new RegExp("中文名.*");
	var bname_patt = new RegExp("别名.*");
	var in_patt = new RegExp("<\/span>(.*)<\/li>");
	var aname = aname_patt.exec(left_col.html());
	var bname = bname_patt.exec(left_col.html());
	if(aname == null) {
	} else {
		aname = in_patt.exec(aname);
		aname = aname[1];
		//var aaname = aname;
		var aaname = encodeURIComponent(aname);
		summary.before('<p><a href='+'http://www.bilibili.tv/search?keyword='+aaname+'&orderby=&formsubmit='+'><font color="gray">( ̄ε ̄*)传送至'+aname+' @bilibili.tv~</font></a></p>');
		summary.before('<p><a href='+'http://www.tucao.cc/index.php?m=search&c=index&a=init2&catid=0&time=all&order=inputtime&username=&tag=&q='+aaname+'><font color="gray">( ̄ε ̄*)传送至'+aname+' @tucao.cc~</font></a></p>');
	}
	if(bname == null) {
	} else {
		bname = in_patt.exec(bname);
		bname = bname[1];
		//var bbname = bname;
		var bbname = encodeURIComponent(bname);
		summary.before('<p><a href='+'http://www.bilibili.tv/search?keyword='+bbname+'&orderby=&formsubmit='+'><font color="gray">(≧▽≦)传送至'+bname+' @bilibili.tv~</font></a></p>');
		summary.before('<p><a href='+'http://www.tucao.cc/index.php?m=search&c=index&a=init2&catid=0&time=all&order=inputtime&username=&tag=&q='+bbname+'><font color="gray">(≧▽≦)传送至'+bname+' @tucao.cc~</font></a></p>');
	}
	summary.before("<br />");
	//alert(summary.html());
}