Movatterモバイル変換


[0]ホーム

URL:


はてラボはてな匿名ダイアリー
ようこそ ゲスト さんログインユーザー登録
< [biz]中ぐらいの勝利で... |誕生日を迎える度に ... >

2007-10-09

http://anond.hatelabo.jp/20071009171336

http://anond.hatelabo.jp/20071009142256 の人ですが、ごめん、結構適当書いてました。余計な事してました。ぜんぜん確認してませんでした。という事でバグフィクス版。

javascript:l=location;w=window;u=l.pathname;(function(){wd='/product/';st=u.indexOf(wd);if(st==-1){wd='/ASIN/';st=u.indexOf(wd);}if(st==-1){wd='/dp/';st=u.indexOf(wd);}if(st!=-1){asin=u.substring(st+wd.length,st+10+wd.length);if(prompt('ShortestAmazonURL and thisopen withHatena','http://www.amazon.co.jp/dp/'+asin)){w.open('http://d.hatena.ne.jp/asin/'+asin,'_blank','');}}else{w.alert('noasin info');}}());

ただ、正規表現使えばもっとシンプルになる。って事で同じ動作を書きなおしてみました。

javascript:(function(){if(location.pathname.match(/\/(product|ASIN|dp)\/(.{10})/)){asin=RegExp.$2;if(prompt('ShortestAmazonURL and thisopen withHatena','http://www.amazon.co.jp/dp/'+asin))open('http://d.hatena.ne.jp/asin/'+asin,'_blank')}else{alert('noasin info')}})();

さらに、はてなじゃなくて、アマゾンで開きなおす版も。

javascript:(function(){if(location.pathname.match(/\/(product|ASIN|dp)\/(.{10})/)){asin=RegExp.$2;if(prompt('Jump this shortestAmazonURL','http://www.amazon.co.jp/dp/'+asin))location.href='http://www.amazon.co.jp/dp/'+asin}else{alert('noasin info')}})();

最初はダイアログURLの修正が出来る様に、と思ってましたが、良く考えるとあまり意味なさそうなので止めました。

Permalink |記事への反応(1) | 20:33

このエントリーをはてなブックマークに追加ツイートシェア

記事への反応 -
  • 商品詳細ページの URL に商品名そのものが入っててすごくうざいんですが、 http://www.amazon.co.jp/%E6%B5%B7%E6%B4%8B%E5%A0%82-%E3%83%AA%E3%83%9C%E3%83%AB%E3%83%86%E3%83%83%E3%82%AF-%E3%83%80%E3%83%B3%E3%83%9C%E3%83%BC/dp/B0...

    • http://www.hatena.ne.jp/tool/bookmarklet#diary の「Amazonの商品ページ → はてなasinページ」ブックマークレットでASINページに飛んで、「amazon.co.jp詳細ページへ」のURLをコピー、かなあ。 後ろをチョ...

      • 直接コピー&スマートじゃないけど、こんなんでどうでしょ。 #"https://anond.hatelabo.jp/20071009203351" name="tb">http://anond.hatelabo.jp/20071009171336

        http://anond.hatelabo.jp/20071009142256 の人ですが、ごめん、結構適当書いてました。余計な事してました。ぜんぜん確認してませんでした。という事でバグフィクス版。 #"https://anond.hatelabo.jp/20080213194019">http://anond.hatelabo.jp/20080213191913

        アマゾンのURLがわからない。 ググれ。google:amazonのurl ググってまぁ増田が出るんだが。 同じ悩みの人はもういるよ。 http://anond.hatelabo.jp/20070416190523 http://anond.hatelabo.jp/20071009113829 (ちな...

    • http://anond.hatelabo.jp/20071009142256 イイ!

    • そのままコピーすればAmazonのURL、「OK」を押せばASINページへ。十分スマートですよ。 「もっとも短いAmazonのURL」はこう↓かも(細かくてゴメン) http://amazon.jp/dp/B000WF1TKS http://anond.hatelabo....

  • でも、サンデープログラマですらない自分にはこれが限界です本当にありがとうございました。 どうでもいいけど、サンデープログラマの文字でシャープ提供「パソコンサンデー」を...

  • #"https://b.hatena.ne.jp/entry/jsonlite/" data-url="https://anond.hatelabo.jp/20071009203351">

    記事への反応(ブックマークコメント)

    人気エントリ

    注目エントリ

  • ログインユーザー登録
    ようこそ ゲスト さん
    Copyright (C) 2001-2025 hatena. All Rights Reserved.

    [8]ページ先頭

    ©2009-2025 Movatter.jp