/** * MooTools External Opener (requires MooTools: http://www.mootools.net) * Opens all external links automatically in a new tab, all in XHTML Strict. * Version : 0.95a - Last update: August 21st 2009 * * Author: Jonathan Petitcolas * Site: www.jonathan-petitcolas.com * * Further informations: http://www.jonathan-petitcolas.com/external-opener-ouvrir-les-liens-dans-un-nouvel-onglet-en-xhtml-strict/ * * This file is released under Creative Commons (with Attribution, NonCommercial * and NoDerivs specifications) licence. You can read the legal code on: * http://creativecommons.org/licenses/by-nc-nd/3.0/legalcode * * You can use this script for every non-commercial project. You just have to * put a link on www.jonathan-petitcolas.com within the resulting website. For all * commercial projects, please contact me at . **/ window.addEvent('domready', function(e){ var siteUrl = document.location.hostname; $each($$('a'), function(item){ var linkUrl = item.get('href'); if(linkUrl.test("^http://") && !linkUrl.test("^http://(www\.)?" + siteUrl)) { item.setProperty('target', '_blank'); } }); });