$script .= "$('a').each(function() {
var a = new RegExp('/' + window.location.host + '/');
var f = new RegExp('https://www.facebook.com/amigotecom');
var g = new RegExp('https://plus.google.com/+Amigote');
var t = new RegExp('https://twitter.com/amigotecom');
if(!a.test || !f.test || !g.test || !t.test (this.href)) {
$(this).attr('rel','nofollow');
}
});
</script>";
I would assume this would not affect the search engines as they would see the HTML the way it looks before the JavaScript runs. Just what is it you are trying to achieve by doing this as there is almost certainly a better way.