我想在greasemonkey中使用javascript或jquery从第一个链接重定向到另一个
http://*.tumblr.com/post/*/*
http://$1.tumblr.com/image/$2
我想在greasemonkey中使用javascript或jquery从第一个链接重定向到另一个
http://*.tumblr.com/post/*/*
http://$1.tumblr.com/image/$2
使用这个正则表达式
/^http:\/\/(.*).twitter.com\/post\/(.*)\/(.*)/g
像这样
var regexp = new RegExp(/^http:\/\/(.*).twitter.com\/post\/(.*)\/(.*)/g);
var results = regexp.exec(window.location.href);
要创建您的阵列,那么您可以
if(results){
window.location="http://"+results[1]+".twitter.com/image/"+results[2]+"/"+results[3];
}
重定向