|
|
Zeile 1: |
Zeile 1: |
| // extern_newtab: Versuch einer Loesung fuer das Oeffnen von externen Links in neuen Fenstern | | // Globale JS-Funktionserweiterungen fuer die angepasste MonoBookWebis-Skin |
| // Quelle: http://www.mediawiki.org/wiki/Manual:Opening_external_links_in_a_new_window | | // - zur Zeit kein Inhalt. |
| | |
| 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";
| |
| }
| |
| }
| |
| }
| |
| | |
| if (window.addEventListener) {
| |
| window.addEventListener("load", externalLinks, false);
| |
| }
| |
| else if (window.attachEvent) {
| |
| window.attachEvent("onload", externalLinks);
| |
| }
| |
| | |
| // ende: extern_newtab
| |