(function() { var links = document.querySelectorAll('a.main'); for(var i = 0; i < links.length; i++) { links[i].search += '&t=' + links[i].rel; } })();