MediaWiki:Common.js: Unterschied zwischen den Versionen

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


//=============================================================
/**
//*** Configuration for "star" logo in front of interwiki links to Featured Articles
* Redirect User:Name/skin.js and skin.css to the current skin's pages
//*** and green symbol in front of interwiki links to Good Articles
* (unless the 'skin' page really exists)
* @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' );
}
}
}


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


/** description that is displayed when cursor hovers above FA interwiki links */
/** &withCSS= and &withJS= URL parameters *******
var linkFA_description = "Dieser Artikel wurde als exzellent bewertet.";
* Allow to try custom scripts from MediaWiki space
var linkGA_description = "Dieser Artikel wurde als lesenswert bewertet.";
* without editing personal .css or .js files
*/
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);
}


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


/** style to use for the linkFA_bullet/LinkGA_bullet img */
/* Import more specific scripts if necessary */
var linkFA_style = "margin-right: 0.2em;";
if (wgAction == 'edit' || wgAction == 'submit' || wgPageName == 'Special:Upload') { //scripts specific to editing pages
var linkGA_style = "margin-right: 0.2em;";
    importScript('MediaWiki:Common.js/edit.js');
}
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 ) {
  * star logo for featured articles in other languages,
    importScript('MediaWiki:Common.js/file.js');
  * 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]].
  */
  */
addOnloadHook(function() {
if ( $.inArray( 'sysop', wgUserGroups) > -1 ) {
    // early exit when disabled
importStylesheet('MediaWiki:Sysop.css');
    if (!linkFA_enabled) return;
if ( !window.disableSysopJS ) {
  $(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();
    }


    /** skin == "monobook" || skin == "simple" || skin="modern" || skin== "vector"*/
/** WikiMiniAtlas *******************************************************
    function linkFA_CSS() {
  *
        // links are to replaced in p-lang only
  *  Description: WikiMiniAtlas is a popup click and drag world map.
        var pLang = document.getElementById("p-lang");
  *               This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
        if (!pLang) return;
  *               The script itself is located on meta because it is used by many projects.
        var lis = pLang.getElementsByTagName("li");
  *               See [[Meta:WikiMiniAtlas]] for more information.  
        for (var i = 0; i < lis.length; i++) {
  *  Maintainers: [[User:Dschwen]]
            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" */
var metaBase = 'http://meta.wikimedia.org';
    function linkFA_decorate() {
if ( mw.config.get( 'wgServer' ) == 'https://secure.wikimedia.org' ) {
        // these root elements can contain FA-/GA-links
var metaBase = 'https://secure.wikimedia.org/wikipedia/meta';
        var rootIds = new Array("topbar", "footer");
}
        for (var i=0; i<rootIds.length; i++) {
mw.loader.load(metaBase + '/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
            var root    = document.getElementById(rootIds[i]);
            if (!root) continue;


            // if the root exists, try to decorate all the links within
/* Scripts specific to Internet Explorer */
            var links  = root.getElementsByTagName("a");
if (navigator.appName == 'Microsoft Internet Explorer'){
            for (var j=0; j<links.length; j++) {
    /** Internet Explorer bug fix **************************************************
                decorate(links[j], "-fa", linkFA_bullet, linkFA_description, linkFA_style);
    *
                decorate(links[j], "-ga", linkGA_bullet, linkGA_description, linkGA_style);
    *  Description: Fixes IE horizontal scrollbar bug
            }
    *  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;
          
          
// build an image-node for the FA-star
        oldWidth = docEl.clientWidth;
var img = document.createElement("img");
    };
img.setAttribute("src",     bullet);
   
img.setAttribute("alt",    description);
    var doFixIEScroll = function () {
img.setAttribute("style",   style);
        docEl.style.overflowX = (docEl.scrollWidth - docEl.clientWidth < 4) ? "hidden" : "";
// decorate the link with the image
    };
link.appendChild(img);
   
link.appendChild(link.removeChild(link.firstChild));
    document.attachEvent("onreadystatechange", fixIEScroll);
link.setAttribute("title", description);
    document.attachEvent("onresize", fixIEScroll);
      
    // 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; }');
 
    // IE zoomfix
    // Use to fix right floating div/table inside tables
    mw.util.addCSS('.iezoomfix div, .iezoomfix table { zoom: 1;}');
   
    // Import scripts specific to Internet Explorer 6
    if (navigator.appVersion.substr(22, 1) == '6') {
        importScript('MediaWiki:Common.js/IE60Fixes.js');
     }
     }
});
}


/*
/* Load fixes for Windows font rendering */
## ProjektLinks ##
if( navigator.platform.indexOf( "Win" ) != -1 ) {
by Skript von [[user:Merlissimo]] (Idee basierend auf http://de.wiktionary.org/wiki/MediaWiki:Common.js von [[User:Pathoschild]] und [[wikt:de:User:Melancholie]])
     importStylesheet( 'MediaWiki:Common.css/WinFixes.css' );
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
/* Test if an element has a certain class
    var sisterprojectnav = document.createElement("div");
* Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]
    sisterprojectnav.id = "p-sisterprojects";
*
    sisterprojectnav.className = sistersibling.className
* @deprecated:  Use $(element).hasClass() instead.
    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 hasClass = (function () {
     var sisternext = document.getElementById("p-lang");
     var reCache = {};
     if ( sisternext && sisternext.parentNode == sisterparent ){
     return function (element, className) {
         sisterparent.insertBefore( sisterprojectnav, sisternext );
         return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
     }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);
    }
});


//==============================================================================
/** Interwiki links to featured articles ***************************************
//*** Fügt einen Link "Alle Sprachen" auf der Hauptseite unter die Sprachverweise hinzu
*
*  Description: Highlights interwiki links to featured articles (or
*              equivalents) by changing the bullet before the interwiki link
*               into a star.
* Maintainers: [[User:R. Koot]]
*/


addOnloadHook(function() {
function LinkFA() {
    // only on the main page
     if ( document.getElementById( "p-lang" ) ) {
     if ( wgPageName != wgMainPageTitle) return;
        var InterwikiLinks = document.getElementById( "p-lang" ).getElementsByTagName( "li" );


    try {
         for ( var i = 0; i < InterwikiLinks.length; i++ ) {
         var completelist = addPortletLink("p-lang", "http://de.wikipedia.org/wiki/Wikipedia:Sprachen", "Alle Sprachen", "interwiki-completelist", "Alle Sprachen");
            if ( document.getElementById( InterwikiLinks[i].className + "-fa" ) ) {
        completelist.className='interwiki-completelist';
                InterwikiLinks[i].className += " FA"
    } catch(e) {
                InterwikiLinks[i].title = "This is a featured article in another language.";
         // lets just ignore what's happened
            } else if ( document.getElementById( InterwikiLinks[i].className + "-ga" ) ) {
                InterwikiLinks[i].className += " GA"
                InterwikiLinks[i].title = "This is a good article in another language.";
            }
         }
     }
     }
});
}


//================================================================================
$( LinkFA );
//*** force the loading of another JavaScript file
// Deprecated function, function alias kept for backward compatibility


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


//==============================================================================
/** Collapsible tables *********************************************************
//*** Fügt der Suche weitere Suchengines hinzu (kopiert aus eswp)
*
// 2009-07-02: Auskommentiert, da das neue Suchformular anders funktioniert. Raymond.
*  Description: Allows tables to be collapsed, showing only the header. See
// 2009-08-03: code jetzt reparierter . Pmartin
*              [[Wikipedia:NavFrame]].
// 2009-08-03: Nochmals auskommentiert, siehe Diskussionsseite
*  Maintainers: [[User:R. Koot]]
//if (wgCanonicalSpecialPageName == "Search") {
*/
//    importScript("MediaWiki:SpezialSuche.js");
 
//}
var autoCollapse = 2;
var collapseCaption = "hide";
var expandCaption = "show";


//================================================================================
function collapseTable( tableIndex ){
//*** import Onlyifuploading-functions
    var Button = document.getElementById( "collapseButton" + tableIndex );
// SEE ALSO [[MediaWiki:Onlyifuploading.js]]
    var Table = document.getElementById( "collapsibleTable" + tableIndex );


if (wgCanonicalSpecialPageName == "Upload") {
    if ( !Table || !Button ) {
    importScript("MediaWiki:Onlyifuploading.js");
        return false;
     importScript("MediaWiki:Onlyifediting.js");
     }
}


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


if (wgCanonicalSpecialPageName == "Watchlist") {
    if ( Button.firstChild.data == collapseCaption ) {
    importScript("MediaWiki:Common.js/watchlist.js");
        for ( var i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = "none";
        }
        Button.firstChild.data = expandCaption;
    } else {
        for ( var i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = Rows[0].style.display;
        }
        Button.firstChild.data = collapseCaption;
    }
}
}


//================================================================================
function createCollapseButtons(){
//*** Dynamic Navigation Bars
    var tableIndex = 0;
    var NavigationBoxes = new Object();
    var Tables = document.getElementsByTagName( "table" );
 
    for ( var i = 0; i < Tables.length; i++ ) {
        if ( hasClass( Tables[i], "collapsible" ) ) {


// set up the words in your language
            /* only add button and increment count if there is a header row to work with */
var NavigationBarHide = 'Einklappen';
            var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0];
var NavigationBarShow = 'Ausklappen';
            if (!HeaderRow) continue;
            var Header = HeaderRow.getElementsByTagName( "th" )[0];
            if (!Header) continue;


// set up max count of Navigation Bars on page,
            NavigationBoxes[ tableIndex ] = Tables[i];
// if there are more, all will be hidden
            Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );
// 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
            var Button    = document.createElement( "span" );
addOnloadHook(function() {
            var ButtonLink = document.createElement( "a" );
// shows and hides content and picture (if available) of navigation bars
            var ButtonText = document.createTextNode( collapseCaption );
// Parameters:
//    indexNavigationBar: the index of navigation bar to be toggled
function toggleNavigationBar(NavToggle, NavFrame)
{
  if (!NavFrame || !NavToggle) {
  return false;
  }


  // if shown now
            Button.className = "collapseButton"; //Styles are declared in Common.css
  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
            ButtonLink.style.color = Header.style.color;
  } else if (NavToggle.firstChild.data == NavigationBarShow) {
            ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
  for (
            ButtonLink.setAttribute( "href", "#" );
  var NavChild = NavFrame.firstChild;
            addHandler( ButtonLink,  "click", new Function( "evt", "collapseTable(" + tableIndex + " ); return killEvt( evt );") );
  NavChild != null;
            ButtonLink.appendChild( ButtonText );
  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) {
            Button.appendChild( document.createTextNode( "[" ) );
return function() {
            Button.appendChild( ButtonLink );
toggleNavigationBar(NavToggle, NavFrame);
            Button.appendChild( document.createTextNode( "]" ) );
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);
}
}
});


//================================================================================
            Header.insertBefore( Button, Header.childNodes[0] );
//*** import Onlyifediting-functions
            tableIndex++;
// SEE ALSO [[MediaWiki:Onlyifediting.js]]
        }
    }


if ( wgAction == 'edit' || wgAction == 'submit' ) {
    for ( var i = 0;  i < tableIndex; i++ ) {
    importScript("MediaWiki:Onlyifediting.js");
        if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
            collapseTable( i );
        }
        else if ( hasClass( NavigationBoxes[i], "innercollapse" ) ) {
            var element = NavigationBoxes[i];
            while (element = element.parentNode) {
                if ( hasClass( element, "outercollapse" ) ) {
                    collapseTable ( i );
                    break;
                }
            }
        }
    }
}
}


//================================================================================
$( createCollapseButtons );
 


/** Skript für Vorlage:Galerie */
/** Dynamic Navigation Bars (experimental) *************************************
addOnloadHook(function() {
*
  if (document.URL.match(/printable/g)) return;
*  Description: See [[Wikipedia:NavFrame]].
*  Maintainers: UNMAINTAINED
*/


  function toggleImageFunction(group,  remindex, shwindex) {
// set up the words in your language
     return function() {
var NavigationBarHide = '[' + collapseCaption + ']';
      document.getElementById("ImageGroupsGr" + group + "Im" + remindex).style["display"] = "none";
var NavigationBarShow = '[' + expandCaption + ']';
      document.getElementById("ImageGroupsGr" + group + "Im" + shwindex).style["display"] = "block";
 
      return false;
// shows and hides content and picture (if available) of navigation bars
    };
// Parameters:
  }
//     indexNavigationBar: the index of navigation bar to be toggled
function toggleNavigationBar(indexNavigationBar){
    var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
    var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);


  var divs = document.getElementsByTagName("div");
     if (!NavFrame || !NavToggle) {
  var i = 0, j = 0;
        return false;
  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 shown now
    if (NavToggle.firstChild.data == NavigationBarHide) {
        for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
            if (hasClass(NavChild, 'NavContent') || hasClass(NavChild, 'NavPic')) {
                NavChild.style.display = 'none';
            }
        }
    NavToggle.firstChild.data = NavigationBarShow;


if( window.wgUserGroups ) {
    // if hidden now
  for(var i = 0; i < wgUserGroups.length; ++i) {
    } else if (NavToggle.firstChild.data == NavigationBarShow) {
    if(wgUserGroups[i] === "sysop") {
        for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
  // importScript("MediaWiki:Group-sysop.js"); kann bei Bedarf ent-auskommentiert werden
            if (hasClass(NavChild, 'NavContent') || hasClass(NavChild, 'NavPic')) {
      importStylesheet("MediaWiki:Group-sysop.css");
                NavChild.style.display = 'block';
      break;
            }
        }
        NavToggle.firstChild.data = NavigationBarHide;
     }
     }
  }
}
}


//==============================================================================
// adds show/hide-button to navigation bars
//*** Fügt eine Betreffzeile auf leeren Diskussionsseiten ein
function createNavigationBarToggleButton(){
    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")) {


addOnloadHook(function() {
            indexNavigationBar++;
        if(wgNamespaceNumber != 0 && wgNamespaceNumber != 1) return;
            var NavToggle = document.createElement("a");
var tab = document.getElementById( 'ca-talk' );
            NavToggle.className = 'NavToggle';
if( !tab || tab.className != 'new' ) return;
            NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
var link = tab.getElementsByTagName( 'a' )[0];
            NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
if( !link ) return;
link.href += '&section=new';
});


            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;
                    }
                }
            }
            if (isCollapsed) {
                for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
                    if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
                        NavChild.style.display = 'none';
                    }
                }
            }
            var NavToggleText = document.createTextNode(isCollapsed ? NavigationBarShow : NavigationBarHide);
            NavToggle.appendChild(NavToggleText);


// Lokaler Bilddiskussionsseitenlink eines Commonsbildes verweist nach Commons
            // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
            for(var j=0; j < NavFrame.childNodes.length; j++) {
                if (hasClass(NavFrame.childNodes[j], "NavHead")) {
                    NavToggle.style.color = NavFrame.childNodes[j].style.color;
                    NavFrame.childNodes[j].appendChild(NavToggle);
                }
            }
            NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
        }
    }
}


if (wgNamespaceNumber === 6) addOnloadHook( function() {
$( createNavigationBarToggleButton );
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 */
/** Main Page layout fixes *********************************************************
function SVGThumbs() {
*
var file = document.getElementById("file"); // might fail if MediaWiki can't render the SVG
*  Description: Adds an additional link to the complete list of languages available.
if (file && wgIsArticle && wgTitle.match(/\.svg$/i)) {
  * Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]]
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>
if (wgPageName == 'Main_Page' || wgPageName == 'Talk:Main_Page') {
appendCSS('.noscript {display:none;}');
    $(function () {
 
        mw.util.addPortletLink('p-lang', 'http://meta.wikimedia.org/wiki/List_of_Wikipedias',
/*
                'Complete list', 'interwiki-completelist', 'Complete list of Wikipedias');
* Description: Stay on the secure server as much as possible
        var nstab = document.getElementById('ca-nstab-main');
*/
        if (nstab && wgUserLanguage=='en') {
if(wgServer == 'https://secure.wikimedia.org') {
            while (nstab.firstChild) { nstab = nstab.firstChild; }
    importScript( 'MediaWiki:Common.js/secure.js');
            nstab.nodeValue = 'Main Page';
        }
    });
}
}




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


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


   var a = c.getElementsByTagName('a');
/***** uploadwizard_newusers ********
  var geohack = false;
* Switches in a message for non-autoconfirmed users at [[Wikipedia:Upload]]
  for (var i = 0; i < a.length; i++) {
*
    var h = a[i].href;
*  Maintainers: [[User:Krimpet]]
    if (!h.match(/geohack/)) continue;
*/
    geohack = true;
function uploadwizard_newusers() {
     break;
   if (wgNamespaceNumber == 4 && wgTitle == "Upload" && wgAction == "view") {
    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 na = document.createElement('a');
var __ipv6wwwtest_factor = 100;
  na.href = '#';
var __ipv6wwwtest_done = 0;
  na.onclick = openStreetMapToggle ;
if ((wgServer != "https://secure.wikimedia.org") && (Math.floor(Math.random()*__ipv6wwwtest_factor)==42)) {
  na.appendChild(document.createTextNode('Karte'));
    importScript("MediaWiki:Common.js/IPv6.js");
  c.appendChild(document.createTextNode(' ('));
  c.appendChild(na);
  c.appendChild(document.createTextNode(')    '));
}
}


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


  if (cs && osm) {
function addEditIntro(name){
    if (osm.style.display == 'none') {
  var el = document.getElementById('ca-edit');
      osm.style.display = 'block';
  if (!el) {
    } else {
    return;
      osm.style.display = 'none';
  }
    }
  el = el.getElementsByTagName('a')[0];
    return false;
  if (el) {
    el.href += '&editintro=' + name;
   }
   }
}


  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];
if (wgNamespaceNumber === 0) {
    
   $(function(){
  var i = document.createElement('iframe');
    if (document.getElementById('disambigbox')) {
  var url = 'http://toolserver.org/~kolossos/openlayers/kml-on-ol.php?lang=de&uselang=' + wgUserLanguage + '&params=' + h;
      addEditIntro('Template:Disambig_editintro');
    }
  });


   i.id = 'openstreetmap';
   $(function(){
  i.style.width = '100%';
    var cats = document.getElementById('mw-normal-catlinks');
  i.style.height = '350px';
    if (!cats) {
  i.style.clear = 'both';
      return;
  i.src = url;
    }
  cs.appendChild(i);
    cats = cats.getElementsByTagName('a');
   return false;
    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;
      }
    }
   });
}
}


addOnloadHook(openStreetMapInit);
/**
 
  * Description: Stay on the secure server as much as possible
/** Collapsible tables *********************************************************
  * Maintainers: [[User:TheDJ]]
  *
Description: Allows tables to be collapsed, showing only the header. See
*                        http://www.mediawiki.org/wiki/Manual:Collapsible_tables.
  * Maintainers: [[en:User:R. Koot]]
  */
  */
if ( mw.config.get('wgServer') == 'https://secure.wikimedia.org' ) {
var autoCollapse = 2;
    importScript( 'MediaWiki:Common.js/secure.js');
var collapseCaption = 'hide';
var expandCaption = 'show';
function collapseTable( tableIndex ) {
        var Button = document.getElementById( 'collapseButton' + tableIndex );
        var Table = document.getElementById( 'collapsibleTable' + tableIndex );
        if ( !Table || !Button ) {
                return false;
        }
        var Rows = Table.rows;
        if ( Button.firstChild.data == collapseCaption ) {
                for ( var i = 1; i < Rows.length; i++ ) {
                        Rows[i].style.display = 'none';
                }
                Button.firstChild.data = expandCaption;
        } else {
                for ( var i = 1; i < Rows.length; i++ ) {
                        Rows[i].style.display = Rows[0].style.display;
                }
                Button.firstChild.data = collapseCaption;
        }
}
}
 
function createCollapseButtons() {
/** Text area function for the account creation process */
        var tableIndex = 0;
jQuery(function(){
        var NavigationBoxes = new Object();
  if (!(document.getElementById('signupuserpagefillmagic'))) return;
        var Tables = document.getElementsByTagName( 'table' );
  /*
  * Puts an userpage edit-box inside a div with the ID 'signupuserpagefillmagic'
        for ( var i = 0; i < Tables.length; i++ ) {
  * Created for [[:outreach:Account Creation Improvement Project]] by
                if ( hasClass( Tables[i], 'collapsible' ) ) {
  * [[:sv:User:Sertion]] on the behalf of [[:outreach:User:Hannibal]]
  *
                        /* only add button and increment count if there is a header row to work with */
  * Below are variables for internationalization. Please use \n for linebreaks
                        var HeaderRow = Tables[i].getElementsByTagName( 'tr' )[0];
  * and escape all single quotation marks (') with \'
                        if ( !HeaderRow ) {
  */
                                continue;
  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. --\>',
                        var Header = HeaderRow.getElementsByTagName( 'th' )[0];
      preSubmitButton ='Do not forget to click SAVE PAGE when you get to the next page!',
                        if ( !Header ) {
      submitText = 'Create my user page for me now!',
                                continue;
      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.';
  /*
                        NavigationBoxes[tableIndex] = Tables[i];
    * The actual magic:
                        Tables[i].setAttribute( 'id', 'collapsibleTable' + tableIndex );
    * 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
                        var Button = document.createElement( 'span' );
    * filled), an automated edit summary and the label of the submit button.
                        var ButtonLink = document.createElement( 'a' );
    * 'fakewpTextbox1' is used to hide the assembling of the final output that
                        var ButtonText = document.createTextNode( collapseCaption );
    * is made below.
    */
                        Button.className = 'collapseButton'; // Styles are declared in [[MediaWiki:Common.css]]
  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.
                        ButtonLink.style.color = Header.style.color;
  jQuery('#signupuserpagefillmagic form').live('submit',function(r){
                        ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex );
    // Stops the form from submitting
                        ButtonLink.setAttribute( 'href', "javascript:collapseTable(" + tableIndex + ");" );
    r.preventDefault()
                        ButtonLink.appendChild( ButtonText );
    /*
      * Uses the previously defined variables preComment and postComment
                        Button.appendChild( document.createTextNode( '[' ) );
      * to assemble the final output in the hidden textarea.
                        Button.appendChild( ButtonLink );
      */
                        Button.appendChild( document.createTextNode( ']' ) );
    $('#wpTextbox1').text(preComment+jQuery('#fakewpTextbox1').text()+postComment)
    /*
                        Header.insertBefore( Button, Header.childNodes[0] );
      * Submits the form.
                        tableIndex++;
      * 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()
        for ( var i = 0;  i < tableIndex; i++ ) {
  })
                if ( hasClass( NavigationBoxes[i], 'collapsed' ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], 'autocollapse' ) ) ) {
})
                        collapseTable( i );
                } else if ( hasClass( NavigationBoxes[i], 'innercollapse' ) ) {
                        var element = NavigationBoxes[i];
                        while ( element = element.parentNode ) {
                                if ( hasClass( element, 'outercollapse' ) ) {
                                        collapseTable( i );
                                        break;
                                }
                        }
                }
        }
}
addOnloadHook( createCollapseButtons );
/** Test if an element has a certain class **************************************
*
* Description: Uses regular expressions and caching for better performance.
* Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]
*/
var hasClass = ( function() {
        var reCache = {};
        return function( element, className ) {
                return ( reCache[className] ? reCache[className] : ( reCache[className] = new RegExp( "(?:\\s|^)" + className + "(?:\\s|$)" ) ) ).test( element.className );
        };
})();

Version vom 31. Mai 2011, 09:52 Uhr

window.addPortletLink = mw.util.addPortletLink;

/**
 * Redirect User:Name/skin.js and skin.css to the current skin's pages
 * (unless the 'skin' page really exists)
 * @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 **********
 *
 * @deprecated: Use mw.util.getParamValue with proper escaping
 */
function getURLParamValue(paramName, url){
	return mw.util.getParamValue(paramName, url);
}

/** &withCSS= and &withJS= URL parameters *******
 * Allow to try custom scripts from MediaWiki space 
 * without editing personal .css or .js files
 */
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)
importStylesheet('MediaWiki:JQuery-makeCollapsible.css');
importScript('MediaWiki:JQuery-makeCollapsible.js'); 


/* Import more specific scripts if necessary */
if (wgAction == 'edit' || wgAction == 'submit' || wgPageName == 'Special:Upload') { //scripts specific to editing pages
    importScript('MediaWiki:Common.js/edit.js');
}
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');
}

/** 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 ) {
 importStylesheet('MediaWiki:Sysop.css');
 if ( !window.disableSysopJS ) {
  $(function(){
   importScript('MediaWiki:Sysop.js');
  });
 }
} else if ( $.inArray( 'accountcreator', wgUserGroups ) > -1 ) {
 importStylesheet('MediaWiki:Accountcreator.css');
}


/** WikiMiniAtlas *******************************************************
  *
  *  Description: WikiMiniAtlas is a popup click and drag world map.
  *               This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
  *               The script itself is located on meta because it is used by many projects.
  *               See [[Meta:WikiMiniAtlas]] for more information. 
  *  Maintainers: [[User:Dschwen]]
  */

var metaBase = 'http://meta.wikimedia.org';
if ( mw.config.get( 'wgServer' ) == 'https://secure.wikimedia.org' ) {
 var metaBase = 'https://secure.wikimedia.org/wikipedia/meta';
}
mw.loader.load(metaBase + '/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');

/* Scripts specific to Internet Explorer */
if (navigator.appName == 'Microsoft Internet Explorer'){
    /** Internet Explorer bug fix **************************************************
     *
     *  Description: Fixes IE horizontal scrollbar bug
     *  Maintainers: [[User:Tom-]]?
     */
    
    var oldWidth;
    var docEl = document.documentElement;
    
    var fixIEScroll = function() {
        if (!oldWidth || docEl.clientWidth > oldWidth) {
            doFixIEScroll();
        } else {
            setTimeout(doFixIEScroll, 1);
        }
        
        oldWidth = docEl.clientWidth;
    };
    
    var doFixIEScroll = function () {
        docEl.style.overflowX = (docEl.scrollWidth - docEl.clientWidth < 4) ? "hidden" : "";
    };
    
    document.attachEvent("onreadystatechange", fixIEScroll);
    document.attachEvent("onresize", fixIEScroll);
    
    // 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; }');

    // IE zoomfix
    // Use to fix right floating div/table inside tables
    mw.util.addCSS('.iezoomfix div, .iezoomfix table { zoom: 1;}');
    
    // Import scripts specific to Internet Explorer 6
    if (navigator.appVersion.substr(22, 1) == '6') {
        importScript('MediaWiki:Common.js/IE60Fixes.js');
    }
}

/* Load fixes for Windows font rendering */
if( navigator.platform.indexOf( "Win" ) != -1 ) {
    importStylesheet( 'MediaWiki:Common.css/WinFixes.css' );
}

/* Test if an element has a certain class
 * Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]
 *
 * @deprecated:  Use $(element).hasClass() instead.
 */

var hasClass = (function () {
    var reCache = {};
    return function (element, className) {
        return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
    };
})();


/** Interwiki links to featured articles ***************************************
 *
 *  Description: Highlights interwiki links to featured articles (or
 *               equivalents) by changing the bullet before the interwiki link
 *               into a star.
 *  Maintainers: [[User:R. Koot]]
 */

function LinkFA() {
    if ( document.getElementById( "p-lang" ) ) {
        var InterwikiLinks = document.getElementById( "p-lang" ).getElementsByTagName( "li" );

        for ( var i = 0; i < InterwikiLinks.length; i++ ) {
            if ( document.getElementById( InterwikiLinks[i].className + "-fa" ) ) {
                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 );


/** Collapsible tables *********************************************************
 *
 *  Description: Allows tables to be collapsed, showing only the header. See
 *               [[Wikipedia:NavFrame]].
 *  Maintainers: [[User:R. Koot]]
 */

var autoCollapse = 2;
var collapseCaption = "hide";
var expandCaption = "show";

function collapseTable( tableIndex ){
    var Button = document.getElementById( "collapseButton" + tableIndex );
    var Table = document.getElementById( "collapsibleTable" + tableIndex );

    if ( !Table || !Button ) {
        return false;
    }

    var Rows = Table.rows;

    if ( Button.firstChild.data == collapseCaption ) {
        for ( var i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = "none";
        }
        Button.firstChild.data = expandCaption;
    } else {
        for ( var i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = Rows[0].style.display;
        }
        Button.firstChild.data = collapseCaption;
    }
}

function createCollapseButtons(){
    var tableIndex = 0;
    var NavigationBoxes = new Object();
    var Tables = document.getElementsByTagName( "table" );

    for ( var i = 0; i < Tables.length; i++ ) {
        if ( hasClass( Tables[i], "collapsible" ) ) {

            /* only add button and increment count if there is a header row to work with */
            var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0];
            if (!HeaderRow) continue;
            var Header = HeaderRow.getElementsByTagName( "th" )[0];
            if (!Header) continue;

            NavigationBoxes[ tableIndex ] = Tables[i];
            Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );

            var Button     = document.createElement( "span" );
            var ButtonLink = document.createElement( "a" );
            var ButtonText = document.createTextNode( collapseCaption );

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

            ButtonLink.style.color = Header.style.color;
            ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
            ButtonLink.setAttribute( "href", "#" );
            addHandler( ButtonLink,  "click", new Function( "evt", "collapseTable(" + tableIndex + " ); return killEvt( evt );") );
            ButtonLink.appendChild( ButtonText );

            Button.appendChild( document.createTextNode( "[" ) );
            Button.appendChild( ButtonLink );
            Button.appendChild( document.createTextNode( "]" ) );

            Header.insertBefore( Button, Header.childNodes[0] );
            tableIndex++;
        }
    }

    for ( var i = 0;  i < tableIndex; i++ ) {
        if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
            collapseTable( i );
        } 
        else if ( hasClass( NavigationBoxes[i], "innercollapse" ) ) {
            var element = NavigationBoxes[i];
            while (element = element.parentNode) {
                if ( hasClass( element, "outercollapse" ) ) {
                    collapseTable ( i );
                    break;
                }
            }
        }
    }
}

$( createCollapseButtons );


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

// set up the words in your language
var NavigationBarHide = '[' + collapseCaption + ']';
var NavigationBarShow = '[' + expandCaption + ']';

// shows and hides content and picture (if available) of navigation bars
// Parameters:
//     indexNavigationBar: the index of navigation bar to be toggled
function toggleNavigationBar(indexNavigationBar){
    var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
    var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);

    if (!NavFrame || !NavToggle) {
        return false;
    }

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

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

// adds show/hide-button to navigation bars
function createNavigationBarToggleButton(){
    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;
                    }
                }
            }
            if (isCollapsed) {
                for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
                    if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
                        NavChild.style.display = 'none';
                    }
                }
            }
            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)
            for(var j=0; j < NavFrame.childNodes.length; j++) {
                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 );


/** 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 (wgPageName == 'Main_Page' || wgPageName == 'Talk:Main_Page') {
    $(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 ************************************************
  *
  *  Description: Disables code in table sorting routine to set classes on even/odd rows
  *  Maintainers: [[User:Random832]]
  */
ts_alternate_row_colors = false;


/***** uploadwizard_newusers ********
 * Switches in a message for non-autoconfirmed users at [[Wikipedia:Upload]]
 *
 *  Maintainers: [[User:Krimpet]]
 */
function uploadwizard_newusers() {
  if (wgNamespaceNumber == 4 && wgTitle == "Upload" && wgAction == "view") {
    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;
    }
  }
}
$(uploadwizard_newusers);


/** IPv6 AAAA connectivity testing **/

var __ipv6wwwtest_factor = 100;
var __ipv6wwwtest_done = 0;
if ((wgServer != "https://secure.wikimedia.org") && (Math.floor(Math.random()*__ipv6wwwtest_factor)==42)) {
    importScript("MediaWiki:Common.js/IPv6.js");
}

/** Magic editintros ****************************************************
 *
 *  Description: Adds editintros on disambiguation pages and BLP pages.
 *  Maintainers: [[User:RockMFR]]
 */

function addEditIntro(name){
  var el = document.getElementById('ca-edit');
  if (!el) {
    return;
  }
  el = el.getElementsByTagName('a')[0];
  if (el) {
    el.href += '&editintro=' + name;
  }
}


if (wgNamespaceNumber === 0) {
  $(function(){
    if (document.getElementById('disambigbox')) {
      addEditIntro('Template:Disambig_editintro');
    }
  });

  $(function(){
    var cats = document.getElementById('mw-normal-catlinks');
    if (!cats) {
      return;
    }
    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;
      }
    }
  });
}

/**
 * Description: Stay on the secure server as much as possible
 * Maintainers: [[User:TheDJ]]
 */
if ( mw.config.get('wgServer') == 'https://secure.wikimedia.org' ) {
    importScript( 'MediaWiki:Common.js/secure.js');
}

/** Text area function for the account creation process */
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()
   })
})