Skip to content

Instantly share code, notes, and snippets.

@rmateu
Created September 22, 2011 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rmateu/1236146 to your computer and use it in GitHub Desktop.
Save rmateu/1236146 to your computer and use it in GitHub Desktop.
Amazon Short URL Bookmarklet
(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);
})()
@rmateu
Copy link
Author

rmateu commented Sep 22, 2011

Slight modification for personal use:

  1. Deleted Amazon ID Affiliate link part
  2. Added Title
  3. Bookmarklet removes Amazon.com: from title.

Output should look like this:
Steve Jobs eBook: Walter Isaacson: Kindle Store
http://amzn.com/B004W2UBYW

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment