Skip to content

Instantly share code, notes, and snippets.

@nathos
Created May 25, 2010 20:39
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save nathos/413662 to your computer and use it in GitHub Desktop.
Save nathos/413662 to your computer and use it in GitHub Desktop.
AmznShortener - Javascript bookmarket source for an Amazon.com short-link generator.
(function(){
var aff = 'nathos-20'; // replace 'nathos-20' with your Amazon affiliate ID, including the '-20'
if (!document.getElementById('ASIN')) {
alert('Can\'t find an Amazon product ID');
return;
}
var asin = document.getElementById('ASIN').value;
prompt(
'Here is the shortened affiliate link:',
'http://amzn.com/' + asin + '?tag=' + aff);
})()
(function(){
if (!document.getElementById('ASIN')) {
alert('Can\'t find an Amazon product ID');
return;
}
var asin = document.getElementById('ASIN').value;
prompt(
'Here is the shortened affiliate link:',
'http://amzn.com/' + asin);
})()
@nathos
Copy link
Author

nathos commented May 25, 2010

Use the Bookmarklet Crunchinator to generate a minified bookmarket from this code.

@nathos
Copy link
Author

nathos commented May 25, 2010

Original code by Stoyan Stefanov. I tweaked it to support Amazon's new 'amzn.com' short domain.

@otaviocc
Copy link

Nathan, feel free to use this fork. I've added support for Kindle ebooks.

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