Skip to content

Instantly share code, notes, and snippets.

@tarot
Last active December 11, 2015 02:58
Show Gist options
  • Save tarot/4533934 to your computer and use it in GitHub Desktop.
Save tarot/4533934 to your computer and use it in GitHub Desktop.
Amazonの商品ページのURLを短くするBookmarklet
javascript:(function(){var asin,_,_ref;_ref=location.pathname.match(/(?:\/dp\/|\/gp\/product\/|\/asin\/)([^\/]+)/i),_=_ref[0],asin=_ref[1];if(asin!=null){return history.replaceState("","","/dp/"+asin+"/")}})();
do ->
[_, asin] = location.pathname.match /(?:\/dp\/|\/gp\/product\/|\/asin\/)([^\/]+)/i
history.replaceState '', '', "/dp/#{asin}/" if asin?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment