コトバノウタカタ

よしなしごとをつらつらとつづるばしょ。

Amazonリンクを短く2

ちょっと直した。productも対応。

javascript:(function(){w=window;t=location.href;p=t.match(/(\/dp\/|\/ASIN\/|\/product\/)([a-zA-Z0-9]+)\//);if(p==null){alert('no dp, ASIN or product');return}x=w.prompt('URL','http://www.amazon.co.jp/dp/'+p[2]);if(x==''||x==null){return;}w.location.href=x}())

さらにちょい修正。

javascript:(function(){w=window;t=location.href;p=t.match(/(\/dp\/|\/ASIN\/|\/product\/)([a-zA-Z0-9]+)[\/\?]?/);if(p==null){alert('no dp, ASIN or product');return}x=w.prompt('URL','http://www.amazon.co.jp/dp/'+p[2]);if(x==''||x==null){return;}w.location.href=x}())