Skip to content

Instantly share code, notes, and snippets.

@10sr
Created January 13, 2010 00:48
Show Gist options
  • Save 10sr/275800 to your computer and use it in GitHub Desktop.
Save 10sr/275800 to your computer and use it in GitHub Desktop.
すべてのリンクを新しいタブで開くぐりもん
// ==UserScript==
// @name open all in new tab
// @namespace 10sr.posterous.com
// @discription add target="_blank" to all anchors
// @include http://*
// @include https://*
// @exclude http://delicious.com/*
// @exclude https://secure.delicious.com/*
// @exclude http://twitter.com/*
// @exclude https://twitter.com*
// @exclude http://gist.github.com/*
// @exclude https://gist.github.com/*
// @exclude http://github.com/*
// @exclude https://github.com/*
// @exclude http://jottit.com/*
// @exclude http://posterous.com/manage/*
// @exclude http://piconote.com/*
// @exclude http://ping.fm/*
// @exclude http://www29.atwiki.jp/10sr*
// @exclude http://identi.ca/
// @include http://twitter.com/
// @include https://twitter.com/
// ==/UserScript==
//
// http://moto-mono.net/2009/09/03/ofbnw.htmlを書き換え。
//
//
new function(){
var urlw = /^[^(javascript)]/i;
function OpenFileByNewWin(){
var a = document.getElementsByTagName('a');
for(var i=0;i<a.length;i++){
if(a[i].href.match(urlw)){
if(a[i].target || a[i].target!='_blank'){
a[i].target = '_blank';
}
}
}
}
window.addEventListener('load',OpenFileByNewWin,false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment