Sleazy Fork is available in English.

Create Download Links for HACG

琉璃神社神秘代码转换成下载链接

Od 15.08.2015.. Pogledajte najnovija verzija.

// ==UserScript==
// @name        Create Download Links for HACG
// @namespace   https://greasyfork.org/zh-CN/scripts/7762
// @description 琉璃神社神秘代码转换成下载链接
// @author      天涯倦客
// @supportURL http://t.qq.com/HeartBlade
// @include     http*://www.hacg.in/wordpress/*
// @include     http*://www.hacg.be/wordpress/*
// @include     http*://hacg.club/wordpress/*
// @include     http*://www.hacg.me/wordpress/*
// @include     http*://hacg.riwee.com/wordpress/*
// @include     http://pan.baidu.com/share/*
// @include     http://pan.baidu.com/s/*
// @version     2.94
// @grant       none
// ==/UserScript==
(function(){
//度盘填充提取码
if(/baidu/.test(location.href)&&location.hash.slice(1).length==4){
	document.querySelector("#accessCode").value=location.hash.slice(1);
}
var i;
//防爆补丁
	var feiZao=document.getElementsByTagName("p1");
	var fZLength=feiZao.length;
	if (!!fZLength){
		for (i=0;i<fZLength;i++){
			feiZao[0].parentNode.removeChild(feiZao[0]);
		}
	}
//老司机
	var oldDriver = document.getElementsByClassName('entry-content')[0];
	var regObj={	//用于匹配的正则
	btih:[//(?:magnet:\?xt=urn:btih:)?([a-fA-F0-9]{40})()/g,
			 //(?:magnet:\?xt=urn:btih:)?([a-zA-Z0-9]{32})()/g,
			 /([^\/=\|])(?:magnet:\?xt=urn:btih:)?([a-fA-F0-9]{40}|[a-zA-Z0-9]{32})()/g,
			 /([^\/=\|])\b([a-fA-F0-9]{40}|[a-zA-Z0-9]{32})()/g,
			 /()([a-fA-F0-9]{10,})\W{9,25}([a-fA-F0-9]{10,})/g,
			 /()([a-fA-F0-9 ]){41}()/g
		 ],
	bdshare:/b?\/s\/(\w{8})(?:\s+(\w{4}))?/g,	//度娘 类型:/s/1i31aCbb  b/s/1i31aCbb
	howfile:/@HF\/file\/(\w{4,10})\/(\w{8})\/?/gi, //好盘 类型I:@HF/file/61dbeea7/0c7f2f56/
	tcn:/\bt\/(\w{7})/g, //t.cn短链接 类型I:t/RZEWYLu
	yyw:/(\/lb\/)?(5lb[a-zA-Z0-9]{8,12})/g,  //115礼包:/lb/5lbeo3p8eh02
	mega:/(\.co\.nz\/(#[\w!]{22,}))/g      //.co.nz/#!AZcSmbJA!Q5ZbtIDoQecZc_3Cmc2v_vMaLFJRO6Ctd7uaWdWKqK0
	};
	var linkArr=[]; //用于替换的链接
	//linkArr.btih='<a href="magnet:?xt=urn:btih:$1$2">磁链:$1$2</a>';
	linkArr.btih='';//未定义
	linkArr.baidu="<a href='http://pan.baidu.com/s/$1#$2' target='_blank'>度娘:$1</a> $2";
	linkArr.howf="<a href='http://howfile.com/file/$1/$2/' target='_blank'>好盘:howfile.com/file/$1/$2</a>";
	linkArr.tcn="<a href='http://t.cn/$1' target='_blank'>短链:t.cn/$1</a>";
	linkArr.yyw="<a href='http://115.com/lb/$2' target='_blank'>115礼包:$2</a> ";
	linkArr.mega="<a href='https://mega$1' target='_blank'>MEGA网盘:$2</a>";
	var txt=oldDriver.innerHTML.toString();
//磁链
function hashFunc(hash){  //hash操作
	hashWord=hash.match(/^\W*/g)[0];
	hash=hash.replace(/[\s\W]*/g, "").toUpperCase();
	hashStart=hash.slice(0,2);
	hashEnd=hash.slice(-2);
	return [hashStart,hashEnd,hash,hashWord];
}
for(i in regObj.btih){
	if(regObj.btih[i].test(txt)){
		var magH=txt.match(regObj.btih[i]);		
		for (j=0;j<magH.length;j++){
			//linkArr.btih='<a href="magnet:?xt=urn:btih:'+hashFunc(magH[j])[2]+'">磁链:'+hashFunc(magH[j])[2]+'</a>';
			linkArr.btih=hashFunc(magH[j])[3]+'<a href="magnet:?xt=urn:btih:'+hashFunc(magH[j])[2]+'" class="magnetlinks">磁力链接 </a>';
		
			//linkArr.btih+=' →<a href="http://www.torrent.org.cn/magnet_torrent.php?hash='+hashFunc(magH[j])[2]+'" target="_blank" title="可查看种子内容">【TOC种子】</a>';
			linkArr.btih+=' <a href="http://www.btava.com/torrent/detail/hash/'+hashFunc(magH[j])[2]+'" target="_blank" title="支持Base32,可查看种子内容,需要验证码">【BTAVA种子】</a>';
			//linkArr.btih+=' <a href="http://www.btcache.me/torrent/'+hashFunc(magH[j])[2]+'" target="_blank" title="支持Base32,可查看种子内容,需要验证码">【BTcache种子】/a>';
			
			var th="woshisuijima"+magH[j]+' <a href="http://bt.box.n0808.com/'+hashFunc(magH[j])[0]+'/'+hashFunc(magH[j])[1]+'/'+hashFunc(magH[j])[2]+'.torrent" title="直接下载种子">【BTbox种子】</a> ';
			txt=txt.replace(magH[j],th);
			txt=txt.replace("woshisuijima"+magH[j],linkArr.btih)
		}
		break;
		
	}
}
//度娘
		txt=txt.replace(regObj.bdshare,linkArr.baidu);
//好盘
		txt=txt.replace(regObj.howfile,linkArr.howf);
//短链接
		txt=txt.replace(regObj.tcn,linkArr.tcn);
//115
		txt=txt.replace(regObj.yyw,linkArr.yyw);
//mega
		txt=txt.replace(regObj.mega,linkArr.mega);
	
	oldDriver.innerHTML=txt;
//评论区度娘、115、tcn
	var buDang=document.getElementsByClassName('comment-content');
	for (i in buDang){
		buDang[i].innerHTML=buDang[i].innerHTML.replace(/\b(\w{8})\b(?:\s*(?:<br>|密码:|密码:|pw:|提取码:)?\s*(\w{4})?)/gi,linkArr.baidu).replace(regObj.yyw,linkArr.yyw).replace(regObj.tcn,linkArr.tcn);
}
})();