MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus PhysikWiki
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
window.addPortletLink = mw.util.addPortletLink;
/* Jedes JavaScript hier wird für alle Benutzer für jede Seite geladen. */


/**
//=============================================================
* Redirect User:Name/skin.js and skin.css to the current skin's pages
//*** Configuration for "star" logo in front of interwiki links to Featured Articles
* (unless the 'skin' page really exists)
//*** and green symbol in front of interwiki links to Good Articles
* @source: http://www.mediawiki.org/wiki/Snippets/Redirect_skin.js
* @rev: 2
*/
if ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgNamespaceNumber' ) == 2 ) {
var titleParts = mw.config.get( 'wgPageName' ).split( '/' );
// Make sure there was a part before and after the slash
// And that the latter is 'skin.js' or 'skin.css'
if ( titleParts.length == 2 ) {
var userSkinPage = titleParts.shift() + '/' + mw.config.get( 'skin' );
if ( titleParts.slice(-1) == 'skin.js' ) {
window.location.href = mw.util.wikiGetlink( userSkinPage + '.js' );
} else if ( titleParts.slice(-1) == 'skin.css' ) {
window.location.href = mw.util.wikiGetlink( userSkinPage + '.css' );
}
}
}


/** extract a URL parameter from the current URL **********
/** set to false in Special:Mypage/monobook.js to switch off this "feature" */
*
var linkFA_enabled  = true;
* @deprecated: Use mw.util.getParamValue with proper escaping
*/
function getURLParamValue(paramName, url){
return mw.util.getParamValue(paramName, url);
}


/** &withCSS= and &withJS= URL parameters *******
/** description that is displayed when cursor hovers above FA interwiki links */
* Allow to try custom scripts from MediaWiki space
var linkFA_description = "Dieser Artikel wurde als exzellent bewertet.";
* without editing personal .css or .js files
var linkGA_description = "Dieser Artikel wurde als lesenswert bewertet.";
*/
var extraCSS = mw.util.getParamValue("withCSS");
if ( extraCSS && extraCSS.match("^MediaWiki:[^&<>=%]*\.css$") ) {
    importStylesheet(extraCSS);
}
var extraJS = mw.util.getParamValue("withJS");
if ( extraJS && extraJS.match("^MediaWiki:[^&<>=%]*\.js$") ) {
    importScript(extraJS);
}


// makeCollapsible (remove when deployed)
// linkFA_bullet/linkGA_bullet and linkFA_style/linkGA_Style werden nur für cologneblue, nostalgia and standard verwendet,
importStylesheet('MediaWiki:JQuery-makeCollapsible.css');
// für monobook, modern und simple siehe [[MediaWiki:Common.css]], vector hat in [[MediaWiki:Vector.css] eigene Definitionen
importScript('MediaWiki:JQuery-makeCollapsible.js');


/** image to use instead of the standard bullet (for cologneblue, nostalgia and standard */
var linkFA_bullet = "http://upload.wikimedia.org/wikipedia/commons/d/d0/Monobook-bullet-star-transparent.png";
var linkGA_bullet = "http://upload.wikimedia.org/wikipedia/commons/a/a1/Monobook-bullet-star-gray.png";


/* Import more specific scripts if necessary */
/** style to use for the linkFA_bullet/LinkGA_bullet img */
if (wgAction == 'edit' || wgAction == 'submit' || wgPageName == 'Special:Upload') { //scripts specific to editing pages
var linkFA_style = "margin-right: 0.2em;";
    importScript('MediaWiki:Common.js/edit.js');
var linkGA_style = "margin-right: 0.2em;";
}
else if (mw.config.get('wgPageName') == 'Special:Watchlist') { //watchlist scripts
    mw.loader.load(mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=MediaWiki:Common.js/watchlist.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
}


if ( wgNamespaceNumber == 6 ) {
/**
    importScript('MediaWiki:Common.js/file.js');
  * star logo for featured articles in other languages,
}
  * see Template:Link_FA / Template:Link_GA and MediaWiki:Common.css
 
/** For sysops and accountcreators *****************************************
  *
  * Description: Allows for sysop-specific Javascript at [[MediaWiki:Sysop.js]],
*              and accountcreator-specific CSS at [[MediaWiki:Accountcreator.css]].
  */
  */
if ( $.inArray( 'sysop', wgUserGroups) > -1 ) {
addOnloadHook(function() {
importStylesheet('MediaWiki:Sysop.css');
    // early exit when disabled
if ( !window.disableSysopJS ) {
    if (!linkFA_enabled) return;
  $(function(){
  importScript('MediaWiki:Sysop.js');
  });
}
} else if ( $.inArray( 'accountcreator', wgUserGroups ) > -1 ) {
importStylesheet('MediaWiki:Accountcreator.css');
}


    // skins that can be handled the CSS class way
    if (skin == "monobook" || skin == "simple" || skin == "modern" || skin== "vector" ) {
        linkFA_CSS();
    }
    else if (skin == "cologneblue" || skin == "nostalgia" || skin == "standard") {
        linkFA_decorate();
    }


/** WikiMiniAtlas *******************************************************
    /** skin == "monobook" || skin == "simple" || skin="modern" || skin== "vector"*/
  *
    function linkFA_CSS() {
  *  Description: WikiMiniAtlas is a popup click and drag world map.
        // links are to replaced in p-lang only
  *               This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
        var pLang = document.getElementById("p-lang");
  *               The script itself is located on meta because it is used by many projects.
        if (!pLang) return;
  *               See [[Meta:WikiMiniAtlas]] for more information.  
        var lis = pLang.getElementsByTagName("li");
  *  Maintainers: [[User:Dschwen]]
        for (var i = 0; i < lis.length; i++) {
  */
            var li = lis[i];
            // only links with a corresponding Link_FA template are interesting
            if (document.getElementById(li.className + "-fa")) {
               li.className += " FA";        // additional class so the template can be hidden with CSS
              li.title = linkFA_description; // change title
              continue;
            }
            if (document.getElementById(li.className + "-ga")) {
               li.className += " GA";        // additional class so the template can be hidden with CSS
               li.title = linkGA_description; // change title
              continue;
            }
        }
    }


var metaBase = 'http://meta.wikimedia.org';
    /** skin == "cologneblue" || skin == "nostalgia" || skin == "standard" */
if ( mw.config.get( 'wgServer' ) == 'https://secure.wikimedia.org' ) {
    function linkFA_decorate() {
var metaBase = 'https://secure.wikimedia.org/wikipedia/meta';
        // these root elements can contain FA-/GA-links
}
        var rootIds = new Array("topbar", "footer");
mw.loader.load(metaBase + '/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
        for (var i=0; i<rootIds.length; i++) {
            var root    = document.getElementById(rootIds[i]);
            if (!root) continue;


/* Scripts specific to Internet Explorer */
            // if the root exists, try to decorate all the links within
if (navigator.appName == 'Microsoft Internet Explorer'){
            var links  = root.getElementsByTagName("a");
    /** Internet Explorer bug fix **************************************************
            for (var j=0; j<links.length; j++) {
    *
                decorate(links[j], "-fa", linkFA_bullet, linkFA_description, linkFA_style);
    *  Description: Fixes IE horizontal scrollbar bug
                decorate(links[j], "-ga", linkGA_bullet, linkGA_description, linkGA_style);
    *  Maintainers: [[User:Tom-]]?
            }
    */
   
    var oldWidth;
    var docEl = document.documentElement;
   
    var fixIEScroll = function() {
        if (!oldWidth || docEl.clientWidth > oldWidth) {
            doFixIEScroll();
        } else {
            setTimeout(doFixIEScroll, 1);
         }
         }
    }
 
    /** id necessary, modify a link to show the FA- or GA-star (older) */
    function decorate(link, idSuffix, bullet, description, style) {
        var lang    = link.hostname.split(".")[0];
        var fa      = document.getElementById("interwiki-" + lang + idSuffix);
        if (!fa) return;
          
          
        oldWidth = docEl.clientWidth;
// build an image-node for the FA-star
    };
var img = document.createElement("img");
   
img.setAttribute("src",     bullet);
    var doFixIEScroll = function () {
img.setAttribute("alt",     description);
        docEl.style.overflowX = (docEl.scrollWidth - docEl.clientWidth < 4) ? "hidden" : "";
img.setAttribute("style",   style);
     };
// decorate the link with the image
   
link.appendChild(img);
    document.attachEvent("onreadystatechange", fixIEScroll);
link.appendChild(link.removeChild(link.firstChild));
    document.attachEvent("onresize", fixIEScroll);
link.setAttribute("title", description);
   
    }
    // In print IE (7?) does not like line-height
});
    mw.util.addCSS( '@media print { sup, sub, p, .documentDescription { line-height: normal; }}');


    // IE overflow bug
/*
    mw.util.addCSS('div.overflowbugx { overflow-x: scroll !important; overflow-y: hidden !important; } div.overflowbugy { overflow-y: scroll !important; overflow-x: hidden !important; }');
## ProjektLinks ##
by Skript von [[user:Merlissimo]] (Idee basierend auf http://de.wiktionary.org/wiki/MediaWiki:Common.js von [[User:Pathoschild]] und [[wikt:de:User:Melancholie]])
erzeugt Sitebar-Interwiki zu Schwesterprojekten aufgrund von Vorlage {{InterProjekt}}
siehe auch Feature-Request [[bugzilla:708]]
*/
addOnloadHook(function() {
    var iProject = document.getElementById("interProject");
    if(!iProject) return;
    var sistersibling = document.getElementById("p-navigation");
    if(!sistersibling) return;
    //Link auf Parennode des Portletmenues
    var sisterparent = sistersibling.parentNode;


     // IE zoomfix
     //Erzeuge neues Portletmenue
     // Use to fix right floating div/table inside tables
     var sisterprojectnav = document.createElement("div");
     mw.util.addCSS('.iezoomfix div, .iezoomfix table { zoom: 1;}');
    sisterprojectnav.id = "p-sisterprojects";
      
     sisterprojectnav.className = sistersibling.className
    // Import scripts specific to Internet Explorer 6
    sisterprojectnav.innerHTML = '<h5>'+document.getElementById("sisterProjects").firstChild.innerHTML+'</h5><div><ul></ul></div>';
     if (navigator.appVersion.substr(22, 1) == '6') {
     var sistersiblingsub = sistersibling.getElementsByTagName("div")[0];
         importScript('MediaWiki:Common.js/IE60Fixes.js');
     if(sistersiblingsub){
        sisterprojectnav.childNodes[1].className = sistersiblingsub.className;
    } else {
         sisterprojectnav.childNodes[1].className = "pBody";
     }
     }
}


/* Load fixes for Windows font rendering */
    //Wenn möglich vor den Interwikis einfügen
if( navigator.platform.indexOf( "Win" ) != -1 ) {
    var sisternext = document.getElementById("p-lang");
     importStylesheet( 'MediaWiki:Common.css/WinFixes.css' );
    if ( sisternext && sisternext.parentNode == sisterparent ){
}
        sisterparent.insertBefore( sisterprojectnav, sisternext );
     }else{
        sisterparent.appendChild(sisterprojectnav);
    }


/* Test if an element has a certain class
    //Schwesterlinks ermitteln und einfügen
* Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]
    var sisterlinks = iProject.getElementsByTagName("a");
*
    for (var i = 0; i < sisterlinks.length; i++) {
* @deprecated:  Use $(element).hasClass() instead.
        var sistername = sisterlinks[i].firstChild.nodeValue
*/
        addPortletLink('p-sisterprojects', sisterlinks[i].getAttribute("href") + '?uselang=' + wgUserLanguage, sistername, "sister-"+ sistername, sistername);
    }
});


var hasClass = (function () {
//==============================================================================
    var reCache = {};
//*** Fügt einen Link "Alle Sprachen" auf der Hauptseite unter die Sprachverweise hinzu
    return function (element, className) {
        return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
    };
})();


addOnloadHook(function() {
    // only on the main page
    if ( wgPageName != wgMainPageTitle) return;


/** Interwiki links to featured articles ***************************************
    try {
*
        var completelist = addPortletLink("p-lang", "http://de.wikipedia.org/wiki/Wikipedia:Sprachen", "Alle Sprachen", "interwiki-completelist", "Alle Sprachen");
*  Description: Highlights interwiki links to featured articles (or
        completelist.className='interwiki-completelist';
*              equivalents) by changing the bullet before the interwiki link
    } catch(e) {
*              into a star.
        // lets just ignore what's happened
*  Maintainers: [[User:R. Koot]]
    }
*/
});


function LinkFA() {
//================================================================================
    if ( document.getElementById( "p-lang" ) ) {
//*** force the loading of another JavaScript file
        var InterwikiLinks = document.getElementById( "p-lang" ).getElementsByTagName( "li" );
// Deprecated function, function alias kept for backward compatibility


        for ( var i = 0; i < InterwikiLinks.length; i++ ) {
function includePage(name) {
            if ( document.getElementById( InterwikiLinks[i].className + "-fa" ) ) {
    return importScript(name);
                InterwikiLinks[i].className += " FA"
                InterwikiLinks[i].title = "This is a featured article in another language.";
            } else if ( document.getElementById( InterwikiLinks[i].className + "-ga" ) ) {
                InterwikiLinks[i].className += " GA"
                InterwikiLinks[i].title = "This is a good article in another language.";
            }
        }
    }
}
}


$( LinkFA );
//==============================================================================
//*** Fügt der Suche weitere Suchengines hinzu (kopiert aus eswp)
// 2009-07-02: Auskommentiert, da das neue Suchformular anders funktioniert. Raymond.
// 2009-08-03: code jetzt reparierter . Pmartin
// 2009-08-03: Nochmals auskommentiert, siehe Diskussionsseite
//if (wgCanonicalSpecialPageName == "Search") {
//    importScript("MediaWiki:SpezialSuche.js");
//}


//================================================================================
//*** import Onlyifuploading-functions
// SEE ALSO [[MediaWiki:Onlyifuploading.js]]


/** Collapsible tables *********************************************************
if (wgCanonicalSpecialPageName == "Upload") {
*
    importScript("MediaWiki:Onlyifuploading.js");
*  Description: Allows tables to be collapsed, showing only the header. See
    importScript("MediaWiki:Onlyifediting.js");
*              [[Wikipedia:NavFrame]].
}
*  Maintainers: [[User:R. Koot]]
*/


var autoCollapse = 2;
//================================================================================
var collapseCaption = "hide";
//*** import watchlistmessage-functions
var expandCaption = "show";
// Nachrichten auf der Beobachtungliste ausblenden
// SEE ALSO [[MediaWiki:Common.js/watchlist.js]]


function collapseTable( tableIndex ){
if (wgCanonicalSpecialPageName == "Watchlist") {
    var Button = document.getElementById( "collapseButton" + tableIndex );
     importScript("MediaWiki:Common.js/watchlist.js");
     var Table = document.getElementById( "collapsibleTable" + tableIndex );
}


    if ( !Table || !Button ) {
//================================================================================
        return false;
//*** Dynamic Navigation Bars
    }


    var Rows = Table.rows;
// set up the words in your language
var NavigationBarHide = 'Einklappen';
var NavigationBarShow = 'Ausklappen';


    if ( Button.firstChild.data == collapseCaption ) {
// set up max count of Navigation Bars on page,
        for ( var i = 1; i < Rows.length; i++ ) {
// if there are more, all will be hidden
            Rows[i].style.display = "none";
// NavigationBarShowDefault = 0; // all bars will be hidden
        }
// NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden
        Button.firstChild.data = expandCaption;
if (typeof NavigationBarShowDefault == 'undefined' ) {
    } else {
    var NavigationBarShowDefault = 0;
        for ( var i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = Rows[0].style.display;
        }
        Button.firstChild.data = collapseCaption;
    }
}
}


function createCollapseButtons(){
// adds show/hide-button to navigation bars
     var tableIndex = 0;
addOnloadHook(function() {
    var NavigationBoxes = new Object();
// shows and hides content and picture (if available) of navigation bars
    var Tables = document.getElementsByTagName( "table" );
// Parameters:
//     indexNavigationBar: the index of navigation bar to be toggled
function toggleNavigationBar(NavToggle, NavFrame)
{
  if (!NavFrame || !NavToggle) {
  return false;
  }
 
  // if shown now
  if (NavToggle.firstChild.data == NavigationBarHide) {
  for (
  var NavChild = NavFrame.firstChild;
  NavChild != null;
  NavChild = NavChild.nextSibling
  ) {
  if (NavChild.className == 'NavPic') {
  NavChild.style.display = 'none';
  }
  if (NavChild.className == 'NavContent') {
  NavChild.style.display = 'none';
  }
  if (NavChild.className == 'NavToggle') {
  NavChild.firstChild.data = NavigationBarShow;
  }
  }


    for ( var i = 0; i < Tables.length; i++ ) {
  // if hidden now
        if ( hasClass( Tables[i], "collapsible" ) ) {
  } else if (NavToggle.firstChild.data == NavigationBarShow) {
  for (
  var NavChild = NavFrame.firstChild;
  NavChild != null;
  NavChild = NavChild.nextSibling
  ) {
  if (NavChild.className == 'NavPic') {
  NavChild.style.display = 'block';
  }
  if (NavChild.className == 'NavContent') {
  NavChild.style.display = 'block';
  }
  if (NavChild.className == 'NavToggle') {
  NavChild.firstChild.data = NavigationBarHide;
  }
  }
  }
}


            /* only add button and increment count if there is a header row to work with */
function toggleNavigationBarFunction(NavToggle, NavFrame) {
            var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0];
return function() {
            if (!HeaderRow) continue;
toggleNavigationBar(NavToggle, NavFrame);
            var Header = HeaderRow.getElementsByTagName( "th" )[0];
return false;
            if (!Header) continue;
};
}
// iterate over all NavFrames
var content = document.getElementById("content") || document.getElementById("mw_content");
var NavFrames = getElementsByClassName(content, "div", "NavFrame");
// if more Navigation Bars found and not template namespace than Default: hide all
var initiallyToggle = NavigationBarShowDefault < NavFrames.length && wgNamespaceNumber != 10;
for (var i=0;  i<NavFrames.length; i++) {
var NavFrame = NavFrames[i];
var NavToggle = document.createElement("a");
NavToggle.className = 'NavToggle';
NavToggle.setAttribute('href', '#');
var NavToggleText = document.createTextNode(NavigationBarHide);
NavToggle.appendChild(NavToggleText);
// add NavToggle-Button as first div-element
// in < div class="NavFrame" >
NavFrame.insertBefore(NavToggle, NavFrame.firstChild);
NavToggle.onclick = toggleNavigationBarFunction(NavToggle, NavFrame);
if (initiallyToggle) {
toggleNavigationBar(NavToggle, NavFrame);
}
}
});


            NavigationBoxes[ tableIndex ] = Tables[i];
//================================================================================
            Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );
//*** import Onlyifediting-functions
// SEE ALSO [[MediaWiki:Onlyifediting.js]]


            var Button    = document.createElement( "span" );
if ( wgAction == 'edit' || wgAction == 'submit' ) {
            var ButtonLink = document.createElement( "a" );
    importScript("MediaWiki:Onlyifediting.js");
            var ButtonText = document.createTextNode( collapseCaption );
}


            Button.className = "collapseButton";  //Styles are declared in Common.css
//================================================================================


            ButtonLink.style.color = Header.style.color;
/** Skript für Vorlage:Galerie */
            ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
addOnloadHook(function() {
            ButtonLink.setAttribute( "href", "#" );
  if (document.URL.match(/printable/g)) return;
            addHandler( ButtonLink,  "click", new Function( "evt", "collapseTable(" + tableIndex + " ); return killEvt( evt );") );
            ButtonLink.appendChild( ButtonText );


            Button.appendChild( document.createTextNode( "[" ) );
  function toggleImageFunction(group,  remindex, shwindex) {
            Button.appendChild( ButtonLink );
    return function() {
            Button.appendChild( document.createTextNode( "]" ) );
      document.getElementById("ImageGroupsGr" + group + "Im" + remindex).style["display"] = "none";
      document.getElementById("ImageGroupsGr" + group + "Im" + shwindex).style["display"] = "block";
      return false;
    };
  }


            Header.insertBefore( Button, Header.childNodes[0] );
  var divs = document.getElementsByTagName("div");
            tableIndex++;
  var i = 0, j = 0;
         }
  var units, search;
  var currentimage;
  var UnitNode;
  for (i = 0; i < divs.length; i++) {
    if (divs[i].className !== "ImageGroup") { continue; }
    UnitNode = undefined;
    search = divs[i].getElementsByTagName("div");
    for (j = 0; j < search.length; j++) {
      if (search[j].className !== "ImageGroupUnits") { continue; }
      UnitNode=search[j];
      break;
    }
    if (UnitNode === undefined) { continue; }
    units = [];
    for (j = 0 ; j < UnitNode.childNodes.length ; j++ ) {
      var temp = UnitNode.childNodes[j];
      if (temp.className === "center") { units.push(temp); }
    }
    var rightlink = undefined;
    var commentText = undefined;
    for (j = 0; j < units.length; j++) {
      currentimage = units[j];
      currentimage.id = "ImageGroupsGr" + i + "Im" + j;
      var leftlink = document.createElement("a");
      if (commentText !== undefined) {
        leftlink.setAttribute("title", commentText);
      }
      var comment;
      if (typeof(currentimage.getAttribute("title")) !== "string") {
        commentText = (j+1) + "/" + units.length;
        comment = document.createElement("tt").appendChild(document.createTextNode("("+ commentText + ")"));
      }
      else {
        commentText = currentimage.getAttribute("title");
        comment = document.createElement("span").appendChild(document.createTextNode(commentText));
        currentimage.removeAttribute("title");
      }
      if(rightlink !== undefined) {
        rightlink.setAttribute("title", commentText);
      }
      var imghead = document.createElement("div");
      rightlink = document.createElement("a");
      if (j != 0) {
        leftlink.href = "#";
        leftlink.onclick = toggleImageFunction(i, j, j-1);
        leftlink.appendChild(document.createTextNode("◀"));
      }
      if (j != units.length - 1) {
        rightlink.href = "#";
        rightlink.onclick = toggleImageFunction(i, j, j+1);
        rightlink.appendChild(document.createTextNode("▶"));
      }
      imghead.style["fontSize"] = "110%";
      imghead.style["fontweight"] = "bold";
      imghead.appendChild(leftlink);
      imghead.appendChild(document.createTextNode("\xA0"));
      imghead.appendChild(comment);
      imghead.appendChild(document.createTextNode("\xA0"));
      imghead.appendChild(rightlink);
      if (units.length > 1) {
         currentimage.insertBefore(imghead,currentimage.childNodes[0]);
      }
      if (j != 0) {
        currentimage.style["display"] = "none";
      }
     }
     }
  }
});


    for ( var i = 0; i < tableIndex; i++ ) {
/* admin ui changes */
        if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
 
            collapseTable( i );
if( window.wgUserGroups ) {
        }
  for(var i = 0; i < wgUserGroups.length; ++i) {
        else if ( hasClass( NavigationBoxes[i], "innercollapse" ) ) {
    if(wgUserGroups[i] === "sysop") {
            var element = NavigationBoxes[i];
  // importScript("MediaWiki:Group-sysop.js"); kann bei Bedarf ent-auskommentiert werden
            while (element = element.parentNode) {
      importStylesheet("MediaWiki:Group-sysop.css");
                if ( hasClass( element, "outercollapse" ) ) {
      break;
                    collapseTable ( i );
                    break;
                }
            }
        }
     }
     }
  }
}
}


$( createCollapseButtons );
//==============================================================================
//*** Fügt eine Betreffzeile auf leeren Diskussionsseiten ein


addOnloadHook(function() {
        if(wgNamespaceNumber != 0 && wgNamespaceNumber != 1) return;
var tab = document.getElementById( 'ca-talk' );
if( !tab || tab.className != 'new' ) return;
var link = tab.getElementsByTagName( 'a' )[0];
if( !link ) return;
link.href += '&section=new';
});


/** Dynamic Navigation Bars (experimental) *************************************
*
*  Description: See [[Wikipedia:NavFrame]].
*  Maintainers: UNMAINTAINED
*/


// set up the words in your language
// Lokaler Bilddiskussionsseitenlink eines Commonsbildes verweist nach Commons
var NavigationBarHide = '[' + collapseCaption + ']';
var NavigationBarShow = '[' + expandCaption + ']';


// shows and hides content and picture (if available) of navigation bars
if (wgNamespaceNumber === 6) addOnloadHook( function() {
// Parameters:
if (window.keepLocalFileTabs ) return;
//    indexNavigationBar: the index of navigation bar to be toggled
if (document.getElementById( 'ca-history')) return; //Lokale Dateibeschreibung vorhanden?
function toggleNavigationBar(indexNavigationBar){
if (!getElementsByClassName(document, 'div', 'sharedUploadNotice')[0]) return; //Nur bei Commons-Bildern
    var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
    var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
var path = wgServer.match(/^https/)
? 'https://secure.wikimedia.org/wikipedia/commons/wiki/'
: 'http://commons.wikimedia.org/wiki/';


    if (!NavFrame || !NavToggle) {
// Ändere Link auf Diskussionsseite
        return false;
var talk = document.getElementById('ca-talk');
    }
if (talk && talk.className.match(/(^| )new( |$)/)) {
var link = talk.getElementsByTagName('a')[0];
link.href      = path + 'File_talk:' + encodeURIComponent(wgTitle) + '?uselang=' + wgUserLanguage;
link.className  += ' commonstab';
}
// Ändere Bearbeiten-Link
var edit = document.getElementById('ca-edit') || document.getElementById('ca-viewsource');
if (edit) {  
var link = edit.getElementsByTagName('a')[0];
link.href      = path + 'File:' + encodeURIComponent(wgTitle) + '?uselang=' + wgUserLanguage + '&action=edit';
link.className  += ' commonstab';
link.firstChild.nodeValue = 'Bearbeiten';
}
});


    // if shown now
/** Fügt bei SVG-Grafiken Links zu gerenderten PNGs in verschiedenen Breiten hinzu */
    if (NavToggle.firstChild.data == NavigationBarHide) {
function SVGThumbs() {
        for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
var file = document.getElementById("file"); // might fail if MediaWiki can't render the SVG
            if (hasClass(NavChild, 'NavContent') || hasClass(NavChild, 'NavPic')) {
if (file && wgIsArticle && wgTitle.match(/\.svg$/i)) {
                NavChild.style.display = 'none';
var thumbu = file.getElementsByTagName('IMG')[0].src;
            }
if(!thumbu) return;
        }
    NavToggle.firstChild.data = NavigationBarShow;
function svgAltSize( w, title) {
 
var path = thumbu.replace(/\/\d+(px-[^\/]+$)/, "/" + w + "$1");
    // if hidden now
var a = document.createElement("A");
    } else if (NavToggle.firstChild.data == NavigationBarShow) {
a.setAttribute("href", path);
        for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
a.appendChild(document.createTextNode(title));
            if (hasClass(NavChild, 'NavContent') || hasClass(NavChild, 'NavPic')) {
return a;
                NavChild.style.display = 'block';
}
            }
        }
var p = document.createElement("p");
        NavToggle.firstChild.data = NavigationBarHide;
p.className = "SVGThumbs";
    }
p.appendChild(document.createTextNode("Aus SVG automatisch erzeugte PNG-Grafiken in verschiedenen Auflösungen"+": "));
}
var l = [200, 500, 1000, 2000];
 
                for( var i = 0; i < l.length; i++ ) {
// adds show/hide-button to navigation bars
p.appendChild(svgAltSize( l[i], l[i] + "px"));
function createNavigationBarToggleButton(){
if( i < l.length-1 ) p.appendChild(document.createTextNode(", "));
    var indexNavigationBar = 0;
    // iterate over all < div >-elements
    var divs = document.getElementsByTagName("div");
    for (var i = 0; NavFrame = divs[i]; i++) {
        // if found a navigation bar
        if (hasClass(NavFrame, "NavFrame")) {
 
            indexNavigationBar++;
            var NavToggle = document.createElement("a");
            NavToggle.className = 'NavToggle';
            NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
            NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
 
            var isCollapsed = hasClass( NavFrame, "collapsed" );
            /*
            * Check if any children are already hidden. This loop is here for backwards compatibility:
            * the old way of making NavFrames start out collapsed was to manually add style="display:none"
            * to all the NavPic/NavContent elements. Since this was bad for accessibility (no way to make
            * the content visible without JavaScript support), the new recommended way is to add the class
            * "collapsed" to the NavFrame itself, just like with collapsible tables.
            */
            for (var NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling) {
                if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
                    if ( NavChild.style.display == 'none' ) {
                        isCollapsed = true;
                    }
                 }
                 }
            }
p.appendChild(document.createTextNode("."));
            if (isCollapsed) {
var info = getElementsByClassName( file.parentNode, 'div', 'fullMedia' )[0];
                for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
if( info ) info.appendChild(p);
                    if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
}
                        NavChild.style.display = 'none';
};
                    }
addOnloadHook( SVGThumbs );
                }
            }
            var NavToggleText = document.createTextNode(isCollapsed ? NavigationBarShow : NavigationBarHide);
            NavToggle.appendChild(NavToggleText);


            // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
// <noscript>-Emulation via <div class="noscript"></div>
            for(var j=0; j < NavFrame.childNodes.length; j++) {
appendCSS('.noscript {display:none;}');
                if (hasClass(NavFrame.childNodes[j], "NavHead")) {
                    NavToggle.style.color = NavFrame.childNodes[j].style.color;
                    NavFrame.childNodes[j].appendChild(NavToggle);
                }
            }
            NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
        }
    }
}


$( createNavigationBarToggleButton );
/*
 
  * Description: Stay on the secure server as much as possible
 
/** Main Page layout fixes *********************************************************
*
  * Description: Adds an additional link to the complete list of languages available.
*  Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]]
  */
  */
 
if(wgServer == 'https://secure.wikimedia.org') {
if (wgPageName == 'Main_Page' || wgPageName == 'Talk:Main_Page') {
    importScript( 'MediaWiki:Common.js/secure.js');
    $(function () {
        mw.util.addPortletLink('p-lang', 'http://meta.wikimedia.org/wiki/List_of_Wikipedias',
                'Complete list', 'interwiki-completelist', 'Complete list of Wikipedias');
        var nstab = document.getElementById('ca-nstab-main');
        if (nstab && wgUserLanguage=='en') {
            while (nstab.firstChild) { nstab = nstab.firstChild; }
            nstab.nodeValue = 'Main Page';
        }
    });
}
}




/** Table sorting fixes ************************************************
// Verwendung von OpenStreetMap in Wikipedia.
  *
// (c) 2008 by Magnus Manske
  *  Description: Disables code in table sorting routine to set classes on even/odd rows
// Released under GPL
  *  Maintainers: [[User:Random832]]
  */
ts_alternate_row_colors = false;


function openStreetMapInit() {
  var c = document.getElementById('coordinates');
  if (!c) return;


/***** uploadwizard_newusers ********
   var a = c.getElementsByTagName('a');
* Switches in a message for non-autoconfirmed users at [[Wikipedia:Upload]]
  var geohack = false;
*
  for (var i = 0; i < a.length; i++) {
*  Maintainers: [[User:Krimpet]]
    var h = a[i].href;
*/
    if (!h.match(/geohack/)) continue;
function uploadwizard_newusers() {
    geohack = true;
   if (wgNamespaceNumber == 4 && wgTitle == "Upload" && wgAction == "view") {
    break;
    var oldDiv = document.getElementById("autoconfirmedusers"),
        newDiv = document.getElementById("newusers");
    if (oldDiv && newDiv) {
      if (typeof wgUserGroups == "object" && wgUserGroups) {
        for (i = 0; i < wgUserGroups.length; i++) {
          if (wgUserGroups[i] == "autoconfirmed") {
            oldDiv.style.display = "block";
            newDiv.style.display = "none";
            return;
          }
        }
      }
      oldDiv.style.display = "none";
      newDiv.style.display = "block";
      return;
    }
   }
   }
}
  if (!geohack) return;
$(uploadwizard_newusers);
 
 
/** IPv6 AAAA connectivity testing **/


var __ipv6wwwtest_factor = 100;
  var na = document.createElement('a');
var __ipv6wwwtest_done = 0;
  na.href = '#';
if ((wgServer != "https://secure.wikimedia.org") && (Math.floor(Math.random()*__ipv6wwwtest_factor)==42)) {
  na.onclick = openStreetMapToggle ;
    importScript("MediaWiki:Common.js/IPv6.js");
  na.appendChild(document.createTextNode('Karte'));
  c.appendChild(document.createTextNode(' ('));
  c.appendChild(na);
  c.appendChild(document.createTextNode(')    '));
}
}


/** Magic editintros ****************************************************
function openStreetMapToggle() {
*
  var c = document.getElementById('coordinates');
*  Description: Adds editintros on disambiguation pages and BLP pages.
  if (!c) return;
*  Maintainers: [[User:RockMFR]]
  var cs = document.getElementById('contentSub');
*/
  var osm = document.getElementById('openstreetmap');


function addEditIntro(name){
  if (cs && osm) {
  var el = document.getElementById('ca-edit');
    if (osm.style.display == 'none') {
  if (!el) {
      osm.style.display = 'block';
     return;
    } else {
      osm.style.display = 'none';
    }
     return false;
   }
   }
   el = el.getElementsByTagName('a')[0];
 
   if (el) {
  var found_link = false;
     el.href += '&editintro=' + name;
   var a = c.getElementsByTagName('a');
   var h;
  for (var i = 0; i < a.length; i++) {
     h = a[i].href;
    if (!h.match(/geohack/)) continue;
    found_link = true;
    break;
   }
   }
}
   if (!found_link) return; // No geohack link found
 
 
if (wgNamespaceNumber === 0) {
   $(function(){
    if (document.getElementById('disambigbox')) {
      addEditIntro('Template:Disambig_editintro');
    }
  });


   $(function(){
   h = h.split('params=')[1];
    var cats = document.getElementById('mw-normal-catlinks');
 
    if (!cats) {
  var i = document.createElement('iframe');
      return;
  var url = 'http://toolserver.org/~kolossos/openlayers/kml-on-ol.php?lang=de&uselang=' + wgUserLanguage + '&params=' + h;
    }
    cats = cats.getElementsByTagName('a');
    for (var i = 0; i < cats.length; i++) {
      if (cats[i].title == 'Category:Living people' || cats[i].title == 'Category:Possibly living people') {
        addEditIntro('Template:BLP_editintro');
        break;
      }
    }
  });
}


/**
  i.id = 'openstreetmap';
* Description: Stay on the secure server as much as possible
  i.style.width = '100%';
* Maintainers: [[User:TheDJ]]
  i.style.height = '350px';
*/
  i.style.clear = 'both';
if ( mw.config.get('wgServer') == 'https://secure.wikimedia.org' ) {
  i.src = url;
    importScript( 'MediaWiki:Common.js/secure.js');
  cs.appendChild(i);
  return false;
}
}


/** Text area function for the account creation process */
addOnloadHook(openStreetMapInit);
jQuery(function(){
  if (!(document.getElementById('signupuserpagefillmagic'))) return;
  /*
  * Puts an userpage edit-box inside a div with the ID 'signupuserpagefillmagic'
  * Created for [[:outreach:Account Creation Improvement Project]] by
  * [[:sv:User:Sertion]] on the behalf of [[:outreach:User:Hannibal]]
  *
  * Below are variables for internationalization. Please use \n for linebreaks
  * and escape all single quotation marks (') with \'
  */
  var preComment = '<!-- BELOW IS THE TEXT ABOUT YOU. YOU CAN CHANGE IT COMPLETELY OR IN PARTS AND THEN COME BACK TO IT. AFTER YOU ARE DONE, SCROLL DOWN A BIT FURTHER AND CLICK "SAVE PAGE".--\>{'+'{New user bar}}\n',
      postComment = '\n\n<!-- NOW, CLICK THE "SAVE PAGE" BUTTON. CONGRATULATIONS, YOU\'VE JUST MADE YOUR FIRST EDIT TO WIKIPEDIA. --\>',
      preSubmitButton ='Do not forget to click SAVE PAGE when you get to the next page!',
      submitText = 'Create my user page for me now!',
      SUPeditSummary = 'New user page thru [[:outreach:Account Creation Improvement Project|Outreach:ACIP]]',
      preFilltemplate = 'Replace this example text below with information about you: \n\nHello, my name is Rosie Underhill. I am a veterinarian from Utah, USA, but I was born just outside London, UK, around forty years ago. My background is in biology, with a main interest in snakes.\n\nI speak English and French. In my off-time, I listen to a lot of music, and I have discovered that Wikipedia is a very good source for information in that department. Hopefully I can help make it even better.';
  /*
    * The actual magic:
    * Inserts a form with a single visible field that simulates the normal
    * edit-field. It uses the variables from above to set a text example (pre
    * filled), an automated edit summary and the label of the submit button.
    * 'fakewpTextbox1' is used to hide the assembling of the final output that
    * is made below.
    */
  jQuery('#signupuserpagefillmagic').html('<form action="'+wgServer+wgScript+'?title='+wgFormattedNamespaces[2]+':'+wgUserName+'&action=submit" method="post"><textarea id="fakewpTextbox1" style="width:46em;height:20em;">'+preFilltemplate+'</textarea><textarea name="wpTextbox1" id="wpTextbox1" style="display:none;"></textarea><input type="hidden" name="wpSummary" id="wpSummary" value="'+SUPeditSummary+'" /><br/>'+preSubmitButton+'<br/><input type="submit" value="'+submitText+'"/></form>')
  // Waits for the form to be submitted.
  jQuery('#signupuserpagefillmagic form').live('submit',function(r){
    // Stops the form from submitting
    r.preventDefault()
    /*
      * Uses the previously defined variables preComment and postComment
      * to assemble the final output in the hidden textarea.
      */
    $('#wpTextbox1').text(preComment+jQuery('#fakewpTextbox1').text()+postComment)
    /*
      * Submits the form.
      * For unknown reasons jQuery('#signupuserpagefillmagic form').submit() crashes
      * Firefox (only tested in version 4.0). This method seam to work cross browser.
      */
    document.getElementById('signupuserpagefillmagic').getElementsByTagName('form')[0].submit()
  })
})

Version vom 31. Mai 2011, 09:57 Uhr

/* Jedes JavaScript hier wird für alle Benutzer für jede Seite geladen. */

//=============================================================
//*** Configuration for "star" logo in front of interwiki links to Featured Articles
//*** and green symbol in front of interwiki links to Good Articles

/** set to false in Special:Mypage/monobook.js to switch off this "feature" */
var linkFA_enabled  = true;

/** description that is displayed when cursor hovers above FA interwiki links */
var linkFA_description = "Dieser Artikel wurde als exzellent bewertet.";
var linkGA_description = "Dieser Artikel wurde als lesenswert bewertet.";

// linkFA_bullet/linkGA_bullet and linkFA_style/linkGA_Style werden nur für cologneblue, nostalgia and standard verwendet,
// für monobook, modern und simple siehe [[MediaWiki:Common.css]], vector hat in [[MediaWiki:Vector.css] eigene Definitionen

/** image to use instead of the standard bullet (for cologneblue, nostalgia and standard */
var linkFA_bullet = "http://upload.wikimedia.org/wikipedia/commons/d/d0/Monobook-bullet-star-transparent.png";
var linkGA_bullet = "http://upload.wikimedia.org/wikipedia/commons/a/a1/Monobook-bullet-star-gray.png";

/** style to use for the linkFA_bullet/LinkGA_bullet img */
var linkFA_style = "margin-right: 0.2em;";
var linkGA_style = "margin-right: 0.2em;";

/**
 * star logo for featured articles in other languages,
 * see Template:Link_FA / Template:Link_GA and MediaWiki:Common.css
 */
addOnloadHook(function() {
    // early exit when disabled
    if (!linkFA_enabled) return;

    // skins that can be handled the CSS class way
    if (skin == "monobook" || skin == "simple" || skin == "modern" || skin== "vector" ) {
        linkFA_CSS();
    }
    else if (skin == "cologneblue" || skin == "nostalgia" || skin == "standard") {
        linkFA_decorate();
    }

    /** skin == "monobook" || skin == "simple" || skin="modern" || skin== "vector"*/
    function linkFA_CSS() {
        // links are to replaced in p-lang only
        var pLang = document.getElementById("p-lang");
        if (!pLang) return;
        var lis = pLang.getElementsByTagName("li");
        for (var i = 0; i < lis.length; i++) {
            var li = lis[i];
            // only links with a corresponding Link_FA template are interesting
            if (document.getElementById(li.className + "-fa")) {
              li.className += " FA";         // additional class so the template can be hidden with CSS
              li.title = linkFA_description; // change title
              continue;
            }
            if (document.getElementById(li.className + "-ga")) {
              li.className += " GA";         // additional class so the template can be hidden with CSS
              li.title = linkGA_description; // change title
              continue;
            }
        }
    }

    /** skin == "cologneblue" || skin == "nostalgia" || skin == "standard" */
    function linkFA_decorate() {
        // these root elements can contain FA-/GA-links
        var rootIds = new Array("topbar", "footer");
        for (var i=0; i<rootIds.length; i++) {
            var root    = document.getElementById(rootIds[i]);
            if (!root)  continue;

            // if the root exists, try to decorate all the links within
            var links   = root.getElementsByTagName("a");
            for (var j=0; j<links.length; j++) {
                decorate(links[j], "-fa", linkFA_bullet, linkFA_description, linkFA_style);
                decorate(links[j], "-ga", linkGA_bullet, linkGA_description, linkGA_style);
            }
        }
    }
   
    /** id necessary, modify a link to show the FA- or GA-star (older) */
    function decorate(link, idSuffix, bullet, description, style) {
        var lang    = link.hostname.split(".")[0];
        var fa      = document.getElementById("interwiki-" + lang + idSuffix);
        if (!fa)	return;
        
		// build an image-node for the FA-star
		var img = document.createElement("img");
		img.setAttribute("src",     bullet);
		img.setAttribute("alt",     description);
		img.setAttribute("style",   style);
		// decorate the link with the image
		link.appendChild(img);
		link.appendChild(link.removeChild(link.firstChild));
		link.setAttribute("title", description);
    }
});

/*
## ProjektLinks ##
by Skript von [[user:Merlissimo]] (Idee basierend auf http://de.wiktionary.org/wiki/MediaWiki:Common.js von [[User:Pathoschild]] und [[wikt:de:User:Melancholie]])
erzeugt Sitebar-Interwiki zu Schwesterprojekten aufgrund von Vorlage {{InterProjekt}}
siehe auch Feature-Request [[bugzilla:708]]
*/
addOnloadHook(function() {
    var iProject = document.getElementById("interProject");
    if(!iProject) return;
    var sistersibling = document.getElementById("p-navigation");
    if(!sistersibling) return;
    //Link auf Parennode des Portletmenues
    var sisterparent = sistersibling.parentNode;

    //Erzeuge neues Portletmenue
    var sisterprojectnav = document.createElement("div");
    sisterprojectnav.id = "p-sisterprojects";
    sisterprojectnav.className = sistersibling.className
    sisterprojectnav.innerHTML = '<h5>'+document.getElementById("sisterProjects").firstChild.innerHTML+'</h5><div><ul></ul></div>';
    var sistersiblingsub = sistersibling.getElementsByTagName("div")[0];
    if(sistersiblingsub){
        sisterprojectnav.childNodes[1].className = sistersiblingsub.className;
    } else {
        sisterprojectnav.childNodes[1].className = "pBody";
    }

    //Wenn möglich vor den Interwikis einfügen
    var sisternext = document.getElementById("p-lang");
    if ( sisternext && sisternext.parentNode == sisterparent ){
        sisterparent.insertBefore( sisterprojectnav, sisternext );
    }else{
        sisterparent.appendChild(sisterprojectnav);
    }

    //Schwesterlinks ermitteln und einfügen
    var sisterlinks = iProject.getElementsByTagName("a");
    for (var i = 0; i < sisterlinks.length; i++) {
        var sistername = sisterlinks[i].firstChild.nodeValue
        addPortletLink('p-sisterprojects', sisterlinks[i].getAttribute("href") + '?uselang=' + wgUserLanguage, sistername, "sister-"+ sistername, sistername);
    }
});

//==============================================================================
//*** Fügt einen Link "Alle Sprachen" auf der Hauptseite unter die Sprachverweise hinzu

addOnloadHook(function() {
    // only on the main page
    if ( wgPageName != wgMainPageTitle) return;

    try {
        var completelist = addPortletLink("p-lang", "http://de.wikipedia.org/wiki/Wikipedia:Sprachen", "Alle Sprachen", "interwiki-completelist", "Alle Sprachen");
        completelist.className='interwiki-completelist';
    } catch(e) {
        // lets just ignore what's happened
    }
});

//================================================================================
//*** force the loading of another JavaScript file 
// Deprecated function, function alias kept for backward compatibility

function includePage(name) {
    return importScript(name);
}

//==============================================================================
//*** Fügt der Suche weitere Suchengines hinzu (kopiert aus eswp)
// 2009-07-02: Auskommentiert, da das neue Suchformular anders funktioniert. Raymond.
// 2009-08-03: code jetzt reparierter . Pmartin
// 2009-08-03: Nochmals auskommentiert, siehe Diskussionsseite
//if (wgCanonicalSpecialPageName == "Search") {
//    importScript("MediaWiki:SpezialSuche.js");
//}

//================================================================================
//*** import Onlyifuploading-functions
// SEE ALSO [[MediaWiki:Onlyifuploading.js]]

if (wgCanonicalSpecialPageName == "Upload") {
    importScript("MediaWiki:Onlyifuploading.js");
    importScript("MediaWiki:Onlyifediting.js");
}

//================================================================================
//*** import watchlistmessage-functions
// Nachrichten auf der Beobachtungliste ausblenden
// SEE ALSO [[MediaWiki:Common.js/watchlist.js]]

if (wgCanonicalSpecialPageName == "Watchlist") {
    importScript("MediaWiki:Common.js/watchlist.js");
}

//================================================================================
//*** Dynamic Navigation Bars

// set up the words in your language
var NavigationBarHide = 'Einklappen';
var NavigationBarShow = 'Ausklappen';

// set up max count of Navigation Bars on page,
// if there are more, all will be hidden
// NavigationBarShowDefault = 0; // all bars will be hidden
// NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden
if (typeof NavigationBarShowDefault == 'undefined' ) {
    var NavigationBarShowDefault = 0;
}

// adds show/hide-button to navigation bars
addOnloadHook(function() {
	// shows and hides content and picture (if available) of navigation bars
	// Parameters:
	//     indexNavigationBar: the index of navigation bar to be toggled
	function toggleNavigationBar(NavToggle, NavFrame)
	{
	   if (!NavFrame || !NavToggle) {
		   return false;
	   }

	   // if shown now
	   if (NavToggle.firstChild.data == NavigationBarHide) {
		   for (
				   var NavChild = NavFrame.firstChild;
				   NavChild != null;
				   NavChild = NavChild.nextSibling
			   ) {
			   if (NavChild.className == 'NavPic') {
				   NavChild.style.display = 'none';
			   }
			   if (NavChild.className == 'NavContent') {
				   NavChild.style.display = 'none';
			   }
			   if (NavChild.className == 'NavToggle') {
				   NavChild.firstChild.data = NavigationBarShow;
			   }
		   }

	   // if hidden now
	   } else if (NavToggle.firstChild.data == NavigationBarShow) {
		   for (
				   var NavChild = NavFrame.firstChild;
				   NavChild != null;
				   NavChild = NavChild.nextSibling
			   ) {
			   if (NavChild.className == 'NavPic') {
				   NavChild.style.display = 'block';
			   }
			   if (NavChild.className == 'NavContent') {
				   NavChild.style.display = 'block';
			   }
			   if (NavChild.className == 'NavToggle') {
				   NavChild.firstChild.data = NavigationBarHide;
			   }
		   }
	   }
	}

	function toggleNavigationBarFunction(NavToggle, NavFrame) {
		return function() {
			toggleNavigationBar(NavToggle, NavFrame);
			return false;
		};
	}
	// iterate over all NavFrames
	var content	= document.getElementById("content") || document.getElementById("mw_content");
	var NavFrames = getElementsByClassName(content, "div", "NavFrame");
	// if more Navigation Bars found and not template namespace than Default: hide all
	var initiallyToggle	= NavigationBarShowDefault < NavFrames.length && wgNamespaceNumber != 10;
	for (var i=0;  i<NavFrames.length; i++) {
		var NavFrame = NavFrames[i];
		var NavToggle = document.createElement("a");
		NavToggle.className = 'NavToggle';
		NavToggle.setAttribute('href', '#');
 
		var NavToggleText = document.createTextNode(NavigationBarHide);
		NavToggle.appendChild(NavToggleText);
 
		// add NavToggle-Button as first div-element
		// in < div class="NavFrame" >
		NavFrame.insertBefore(NavToggle, NavFrame.firstChild);
		
		NavToggle.onclick = toggleNavigationBarFunction(NavToggle, NavFrame);
		if (initiallyToggle) {
			toggleNavigationBar(NavToggle, NavFrame);
		}
	}
});

//================================================================================
//*** import Onlyifediting-functions
// SEE ALSO [[MediaWiki:Onlyifediting.js]]

if ( wgAction == 'edit' || wgAction == 'submit' ) {
    importScript("MediaWiki:Onlyifediting.js");
}

//================================================================================

/** Skript für Vorlage:Galerie */
addOnloadHook(function() {
  if (document.URL.match(/printable/g)) return;

  function toggleImageFunction(group,  remindex, shwindex) {
    return function() {
      document.getElementById("ImageGroupsGr" + group + "Im" + remindex).style["display"] = "none";
      document.getElementById("ImageGroupsGr" + group + "Im" + shwindex).style["display"] = "block";
      return false;
    };
  }

  var divs = document.getElementsByTagName("div");
  var i = 0, j = 0;
  var units, search;
  var currentimage;
  var UnitNode;
  for (i = 0; i < divs.length; i++) {
    if (divs[i].className !== "ImageGroup") { continue; }
    UnitNode = undefined;
    search = divs[i].getElementsByTagName("div");
    for (j = 0; j < search.length; j++) {
      if (search[j].className !== "ImageGroupUnits") { continue; }
      UnitNode=search[j];
      break;
    }
    if (UnitNode === undefined) { continue; }
    units = [];
    for (j = 0 ; j < UnitNode.childNodes.length ; j++ ) {
      var temp = UnitNode.childNodes[j];
      if (temp.className === "center") { units.push(temp); }
    }
    var rightlink = undefined;
    var commentText = undefined;
    for (j = 0; j < units.length; j++) {
      currentimage = units[j];
      currentimage.id = "ImageGroupsGr" + i + "Im" + j;
      var leftlink = document.createElement("a");
      if (commentText !== undefined) {
        leftlink.setAttribute("title", commentText);
      }
      var comment;
      if (typeof(currentimage.getAttribute("title")) !== "string") {
        commentText = (j+1) + "/" + units.length;
        comment = document.createElement("tt").appendChild(document.createTextNode("("+ commentText + ")"));
      }
      else {
        commentText = currentimage.getAttribute("title");
        comment = document.createElement("span").appendChild(document.createTextNode(commentText));
        currentimage.removeAttribute("title");
      }
      if(rightlink !== undefined) {
        rightlink.setAttribute("title", commentText);
      }
      var imghead = document.createElement("div");
      rightlink = document.createElement("a");
      if (j != 0) {
        leftlink.href = "#";
        leftlink.onclick = toggleImageFunction(i, j, j-1);
        leftlink.appendChild(document.createTextNode("◀"));
      }
      if (j != units.length - 1) {
        rightlink.href = "#";
        rightlink.onclick = toggleImageFunction(i, j, j+1);
        rightlink.appendChild(document.createTextNode("▶"));
      }
      imghead.style["fontSize"] = "110%";
      imghead.style["fontweight"] = "bold";
      imghead.appendChild(leftlink);
      imghead.appendChild(document.createTextNode("\xA0"));
      imghead.appendChild(comment);
      imghead.appendChild(document.createTextNode("\xA0"));
      imghead.appendChild(rightlink);
      if (units.length > 1) {
        currentimage.insertBefore(imghead,currentimage.childNodes[0]);
      }
      if (j != 0) {
        currentimage.style["display"] = "none";
      }
    }
  }
});

/* admin ui changes */

if( window.wgUserGroups ) {
  for(var i = 0; i < wgUserGroups.length; ++i) {
    if(wgUserGroups[i] === "sysop") {
  // importScript("MediaWiki:Group-sysop.js");  kann bei Bedarf ent-auskommentiert werden
      importStylesheet("MediaWiki:Group-sysop.css");
      break;
    }
  }
}

//==============================================================================
//*** Fügt eine Betreffzeile auf leeren Diskussionsseiten ein

addOnloadHook(function() {
        if(wgNamespaceNumber != 0 && wgNamespaceNumber != 1) return;
	var tab = document.getElementById( 'ca-talk' );
	if( !tab || tab.className != 'new' ) return;
	var link = tab.getElementsByTagName( 'a' )[0];
	if( !link ) return;
	link.href += '&section=new';
});


// Lokaler Bilddiskussionsseitenlink eines Commonsbildes verweist nach Commons

if (wgNamespaceNumber === 6) addOnloadHook( function() {
	if (window.keepLocalFileTabs ) return;
	if (document.getElementById( 'ca-history')) return; //Lokale Dateibeschreibung vorhanden?
	if (!getElementsByClassName(document, 'div', 'sharedUploadNotice')[0]) return; //Nur bei Commons-Bildern
 
	var path = wgServer.match(/^https/)
		? 'https://secure.wikimedia.org/wikipedia/commons/wiki/'
		: 'http://commons.wikimedia.org/wiki/';

	// Ändere Link auf Diskussionsseite
	var talk = document.getElementById('ca-talk');
	if (talk && talk.className.match(/(^| )new( |$)/)) {
		var link		= talk.getElementsByTagName('a')[0];
		link.href       = path + 'File_talk:' + encodeURIComponent(wgTitle) + '?uselang=' + wgUserLanguage;
		link.className  += ' commonstab';
	}
 
	// Ändere Bearbeiten-Link
	var edit	= document.getElementById('ca-edit') || document.getElementById('ca-viewsource');
	if (edit) { 
		var link		= edit.getElementsByTagName('a')[0];
		link.href       = path + 'File:' + encodeURIComponent(wgTitle) + '?uselang=' + wgUserLanguage + '&action=edit';
		link.className  += ' commonstab';
		link.firstChild.nodeValue = 'Bearbeiten';
	}
});

/** Fügt bei SVG-Grafiken Links zu gerenderten PNGs in verschiedenen Breiten hinzu */
function SVGThumbs() {
	var file = document.getElementById("file"); // might fail if MediaWiki can't render the SVG
	if (file && wgIsArticle && wgTitle.match(/\.svg$/i)) {
		var thumbu = file.getElementsByTagName('IMG')[0].src;
		if(!thumbu) return;
 
		function svgAltSize( w, title) {
			var path = thumbu.replace(/\/\d+(px-[^\/]+$)/, "/" + w + "$1");
			var a = document.createElement("A");
			a.setAttribute("href", path);
			a.appendChild(document.createTextNode(title));
			return a;
		}
 
		var p = document.createElement("p");
		p.className = "SVGThumbs";
		p.appendChild(document.createTextNode("Aus SVG automatisch erzeugte PNG-Grafiken in verschiedenen Auflösungen"+": "));
		var l = [200, 500, 1000, 2000];
                for( var i = 0; i < l.length; i++ ) {
			p.appendChild(svgAltSize( l[i], l[i] + "px"));
			if( i < l.length-1 ) p.appendChild(document.createTextNode(", "));
                }
		p.appendChild(document.createTextNode("."));
		var info = getElementsByClassName( file.parentNode, 'div', 'fullMedia' )[0];
		if( info ) info.appendChild(p);
	}
};
addOnloadHook( SVGThumbs );

// <noscript>-Emulation via <div class="noscript"></div>
appendCSS('.noscript {display:none;}');

/*
 * Description: Stay on the secure server as much as possible
 */
if(wgServer == 'https://secure.wikimedia.org') {
    importScript( 'MediaWiki:Common.js/secure.js');
}


// Verwendung von OpenStreetMap in Wikipedia.
// (c) 2008 by Magnus Manske
// Released under GPL

function openStreetMapInit() {
  var c = document.getElementById('coordinates');
  if (!c) return;

  var a = c.getElementsByTagName('a');
  var geohack = false;
  for (var i = 0; i < a.length; i++) {
    var h = a[i].href;
    if (!h.match(/geohack/)) continue;
    geohack = true;
    break;
  }
  if (!geohack) return;

  var na = document.createElement('a');
  na.href = '#';
  na.onclick = openStreetMapToggle ;
  na.appendChild(document.createTextNode('Karte'));
  c.appendChild(document.createTextNode(' ('));
  c.appendChild(na);
  c.appendChild(document.createTextNode(')     '));
}

function openStreetMapToggle() {
  var c = document.getElementById('coordinates');
  if (!c) return; 
  var cs = document.getElementById('contentSub');
  var osm = document.getElementById('openstreetmap');

  if (cs && osm) {
    if (osm.style.display == 'none') {
      osm.style.display = 'block';
    } else {
      osm.style.display = 'none';
    }
    return false;
  }

  var found_link = false;
  var a = c.getElementsByTagName('a');
  var h;
  for (var i = 0; i < a.length; i++) {
    h = a[i].href;
    if (!h.match(/geohack/)) continue;
    found_link = true;
    break;
  }
  if (!found_link) return; // No geohack link found

  h = h.split('params=')[1];
  
  var i = document.createElement('iframe');
  var url = 'http://toolserver.org/~kolossos/openlayers/kml-on-ol.php?lang=de&uselang=' + wgUserLanguage + '&params=' + h;

  i.id = 'openstreetmap';
  i.style.width = '100%';
  i.style.height = '350px';
  i.style.clear = 'both';
  i.src = url;
  cs.appendChild(i);
  return false;
}

addOnloadHook(openStreetMapInit);