/*

A small Greasemonkey script to claim the Amazon links on websites.

Original from http://3o0.net/mozilla/amazona.user.js
Modified for amazon.co.jp users

*/

// ==UserScript==
// @name          AmazonAsamassiate
// @namespace     http://3o0.net/mozilla
// @description   Exchanges Amazon affiliate id's with your own
// @include       http://*
// @include       https://*
// @exclude       http://*.amazon.co.jp/*
// @exclude       https://*.amazon.co.jp/*
// ==/UserScript==

(function() {
	/*
	  add your tags here - no further editing required.
	*/
	var JPtag = 'ryosukecompute-22';
	
	var allLinks = document.getElementsByTagName('a');
	
	for (i = 0; i < allLinks.length; i++) {
		var href = allLinks[i].href;
		if (href.match(/amazon\.co\.jp/i)) {
			var newhref = href.replace(/[0-9a-z]+\-22/i, JPtag);
			allLinks[i].setAttribute('href', newhref);
		}
	}
})();


