Skip to content

Instantly share code, notes, and snippets.

@nathos
Created May 25, 2010 20:39

Revisions

  1. nathos revised this gist May 25, 2010. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions amznshortener_noaff.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    (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);
    })()
  2. nathos created this gist May 25, 2010.
    11 changes: 11 additions & 0 deletions amznshortener.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    (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);
    })()