Creat Download Links for HACG

琉璃神社hash转磁链,神秘代码转度娘盘、115礼包、好盘等

Stan na 29-01-2015. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        Creat Download Links for HACG
// @namespace   https://greasyfork.org/zh-CN/scripts/7762
// @description 琉璃神社hash转磁链,神秘代码转度娘盘、115礼包、好盘等
// @author      http://t.qq.com/HeartBlade
// @include     http://www.hacg.in/wordpress/*
// @include     http://www.hacg.me/wordpress/*
// @include     http://hacg.riwee.com/wordpress/*
// @version     1.3
// @grant       none
// ==/UserScript==
(function(){
	var oldDriver = document.getElementsByClassName('entry-content')[0];
	
	var regObj={	//用于匹配的正则
	btih:[/([a-zA-Z0-9]{40})()/g,//磁链btih
			 /([a-zA-Z0-9]{32})[^\.]()/g,
			 /([a-zA-Z0-9]{6,})\W{14,25}([a-zA-Z0-9]{6,})/g],
	bdshare:[/b?\/s\/(\w{8})/g],	//度娘 类型:/s/1i31aCbb  b/s/1i31aCbb
	howfile:[/@HF\/file\/(\w{4,10})\/(\w{8})\/?/gi], //好盘 类型I:@HF/file/61dbeea7/0c7f2f56/
	tcn:[/@t\/(\w{7})/g], //t.cn短链接 类型I:@t/RZEWYLu
	yyw:[/(\/lb\/)?(5lb[a-zA-Z0-9]{8,12})/g]  //115礼包:/lb/5lbeo3p8eh02
	};
	var linkArr=[]; //用于替换的链接
	linkArr["btih"]='<a href="magnet:?xt=urn:btih:$1$2">磁链:$1$2</a>';
	linkArr["baidu"]="<a href='http://pan.baidu.com/s/$1'>度娘:$1</a>";
	linkArr["howf"]="<a href='http://howfile.com/file/$1/$2/'>好盘:howfile.com/file/$1/$2</a>";
	linkArr["tcn"]="<a href='http://t.cn/$1'>短链:t.cn/$1</a>";
	linkArr["115"]="<a href='http://115.com/lb/$2'>115礼包:$2</a> ";
	
	var txt=oldDriver.innerHTML.toString();
	
	//循环替换
	for(i in regObj.btih){//磁链
		if(regObj.btih[i].test(txt)){
			txt=txt.replace(regObj.btih[i],linkArr["btih"]);
			break;
		}
	}
	for (i in regObj.bdshare){//度娘
		txt=txt.replace(regObj.bdshare[i],linkArr["baidu"]);
	}
	for (i in regObj.howfile){//好盘
		txt=txt.replace(regObj.howfile[i],linkArr["howf"]);
	}
	for (i in regObj.tcn){//短链接
		txt=txt.replace(regObj.tcn[i],linkArr["tcn"]);
	}
	for (i in regObj.yyw){//115
		txt=txt.replace(regObj.yyw[i],linkArr["115"]);
	}
	
	
	oldDriver.innerHTML=txt;
})();