Skip to content

Instantly share code, notes, and snippets.

@bouzuya
Created July 22, 2012 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bouzuya/3158731 to your computer and use it in GitHub Desktop.
Save bouzuya/3158731 to your computer and use it in GitHub Desktop.
javascript:
(function(){
var id = 'bouzuya-22';
var pattern = /^http:\/\/www\.amazon\.co\.jp(?:.*)\/(?:(?:gp\/product)|(?:dp))\/([0-9A-Za-z]{10}).*$/;
var result = location.href.match(pattern);
if (result == null) {
return;
}
var text = document.createTextNode('A!');
var href = 'http://amazon.jp/o/ASIN/' + result[1] + '/' + id;
var anchor = document.createElement('a');
anchor.appendChild(text);
anchor.setAttribute('href', href);
document.getElementById('btAsinTitle').appendChild(anchor);
return false;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment