MediaWiki:Monomookwebis.js: Unterschied zwischen den Versionen

Aus Webis
Zur Navigation springenZur Suche springen
(Die Seite wurde neu angelegt: externalLinks = function() { if (!document.getElementsByTagName) { return; } var anchors = document.getElementsByTagName("a"); for (var i = 0; i < anchors.length;...)
(kein Unterschied)

Version vom 10. Juni 2009, 12:22 Uhr

externalLinks = function() {
	if (!document.getElementsByTagName) {
		return;
	}
	var anchors = document.getElementsByTagName("a");
	for (var i = 0; i < anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && 
				anchor.getAttribute("rel") != null && 
				(anchor.getAttribute("rel").indexOf("external") >= 0 ||
					anchor.getAttribute("rel").indexOf("nofollow") >= 0)
			) {
			anchor.target = "_blank";
		}
	}
}