Skip to content

Instantly share code, notes, and snippets.

@macx
Forked from nathos/amznshortener.js
Created November 18, 2011 08:23
Show Gist options
  • Save macx/1375895 to your computer and use it in GitHub Desktop.
Save macx/1375895 to your computer and use it in GitHub Desktop.
AmznShortener - Javascript bookmarket source for an Amazon.com short-link generator.
(function(){
var aff = 'macx-21'; // replace 'macx-21' with your Amazon affiliate ID, including the '-20'
if (!document.getElementById('ASIN')) {
alert('Konnte keine Amazon-Produkt-ID finden');
return;
}
var asin = document.getElementById('ASIN').value;
prompt(
'Kurz-URL des Amazon-Produkts:',
'http://amazon.de/dp/' + 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);
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment