Created
September 22, 2011 21:47
-
-
Save rmateu/1236146 to your computer and use it in GitHub Desktop.
Amazon Short URL Bookmarklet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var id = ''; | |
var asin = document.getElementById('ASIN'); | |
var asin0 = document.getElementsByName('ASIN.0'); | |
var title = document.title.replace("Amazon.com: ", ""); | |
if (asin) | |
id = asin.value; | |
else if (asin0) | |
id = asin0[0].value; | |
else { | |
alert('Can\'t find an Amazon product ID'); | |
return; | |
} | |
prompt( | |
'Shortened Amazon Page:', | |
title +'\n'+ 'http://amzn.com/' + id); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Slight modification for personal use:
Output should look like this:
Steve Jobs eBook: Walter Isaacson: Kindle Store
http://amzn.com/B004W2UBYW