MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus HuskyWiki
Keine Bearbeitungszusammenfassung
KKeine Bearbeitungszusammenfassung
Markierung: Manuelle Zurücksetzung
 
(100 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
/* <nowiki> */
/**
  url = document.URL;
  * Keep code in MediaWiki:Common.js to a minimum as it is unconditionally
  function $(ID) {return document.getElementById(ID);}
  * loaded for all users on every wiki page. If possible create a gadget that is
  function $t(T) {return document.getElementsByTagName(T);}
* enabled by default instead of adding it here (since gadgets are fully
  bouncyWiki = "http://upload.wikimedia.org/wikipedia/commons/6/6c/Bouncywikilogo.gif";
  * optimized ResourceLoader modules with possibility to add dependencies etc.)
  barnStar = "http://upload.wikimedia.org/wikipedia/commons/a/a2/Tireless_Contributor_Barnstar.gif";
  *
   
* Since Common.js isn't a gadget, there is no place to declare its
// JavaScripts importieren; Quelle: [[w:als:MediaWiki:Monobook.js]]
* dependencies, so we have to lazy load them with mw.loader.using on demand and
  * then execute the rest in the callback. In most cases these dependencies will
function importScript(i) {
* be loaded (or loading) already and the callback will not be delayed. In case a
  var script = document.createElement("script");
* dependency hasn't arrived yet it'll make sure those are loaded before this.
  script.type = "text/javascript";
  */
  script.src = "/w/index.php?title=MediaWiki:If-"+i+".js&action=raw&ctype=text/javascript";
 
  $t("head")[0].appendChild(script);
/* global mw, $ */
}
/* jshint strict:false, browser:true */
 
// Link für Registrierung mit Bild
mw.loader.using( [ 'mediawiki.util' ] ).done( function () {
/* Begin of mw.loader.using callback */
function signUp() {
 
  if ($("pt-login")) {
/**
  var signUp = document.createElement("span");
* Map addPortletLink to mw.util
  signUp.setAttribute("style", "padding-right: 2px");
* @deprecated: Use mw.util.addPortletLink instead.
  signUp.innerHTML = ' \| <a href="/wiki/Spezial:Userlogin?type=signup" title="Neuanmeldung">Benutzerkonto erstellen<\/a><div class="signUp"><\/div>';
*/
  $("pt-login").appendChild(signUp);
mw.log.deprecate( window, 'addPortletLink', mw.util.addPortletLink, 'Use mw.util.addPortletLink instead' );
  }
 
}
/**
addOnloadHook(signUp);
* @source www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL
* @rev 6
*/
// Interprojekt-Links ([[mediazilla:708|Bug 708]])
var extraCSS = mw.util.getParamValue( 'withCSS' ),
extraJS = mw.util.getParamValue( 'withJS' );
document.write('<style type="text/css">#interProject, #sisterProjects {display: none; speak: none;} #p-tb .pBody {padding-right: 0;}<\/style>');
 
function iProject() {
if ( extraCSS ) {
  if ($("interProject")) {
if ( extraCSS.match( /^MediaWiki:[^&<>=%#]*\.css$/ ) ) {
  var iProject = $("interProject").innerHTML;
mw.loader.load( '/w/index.php?title=' + extraCSS + '&action=raw&ctype=text/css', 'text/css' );
  var interProject = document.createElement("div");
} else {
  interProject.style.marginTop = "0.7em";
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withCSS value' } );
  interProject.innerHTML = '<h5><a href="/wiki/Wiktionary:Schwesterprojekte">Schwesterprojekte<\/a><\/h5><div class="pBody">'+iProject+'<\/div>';
}
  $("p-tb").appendChild(interProject);
}
  }
 
}
if ( extraJS ) {
addOnloadHook(iProject);
if ( extraJS.match( /^MediaWiki:[^&<>=%#]*\.js$/ ) ) {
mw.loader.load( '/w/index.php?title=' + extraJS + '&action=raw&ctype=text/javascript' );
} else {
// Ausklappbare Navigationsleisten
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } );
}
var NavigationBarHide = 'Einklappen ▲';
}
var NavigationBarShow = 'Ausklappen ▼';
 
var NavigationBarShowDefault = 10;
/**
* WikiMiniAtlas
//Einstellungen ([[Wiktionary:Einstellungen]]):
*
if ( getCookie('WiktionaryUseJSPreferences') != 'true' ) {
* Description: WikiMiniAtlas is a popup click and drag world map.
        NavigationBarShowDefault = 999;
*              This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
    } else if ( getCookie('WiktionaryPreferencesHideNav') == 'true' ) {
*              The script itself is located on the Meta-Wiki because it is used by many projects.
        NavigationBarShowDefault = 0;
*              See [[Meta:WikiMiniAtlas]] for more information.
    } else if ( getCookie('WiktionaryPreferencesShowNav') == 'true' ) {
* Note - use of this service is recommended to be replaced with mw:Help:Extension:Kartographer
        NavigationBarShowDefault = 999;
*/
    } else {
$( function () {
        NavigationBarShowDefault = 999;
var requireWikiminiatlas = $( 'a.external.text[href*="geohack"]' ).length || $( 'div.kmldata' ).length;
    }
if ( requireWikiminiatlas ) {
mw.loader.load( 'ext.gadget.WikiMiniAtlas' );
function toggleNavigationBar(indexNavigationBar) {
}
  var NavToggle = $("NavToggle" + indexNavigationBar);
} );
  var NavFrame = $("NavFrame" + indexNavigationBar);
 
  if (!NavFrame || !NavToggle) {return false;}
/**
  if (NavToggle.firstChild.data == NavigationBarHide) {
* Collapsible tables; reimplemented with mw-collapsible
  for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
* Styling is also in place to avoid FOUC
    if (NavChild.className == 'NavPic') {NavChild.style.display = 'none';}
*
    if (NavChild.className == 'NavContent') {NavChild.style.display = 'none';}
* Allows tables to be collapsed, showing only the header. See [[Help:Collapsing]].
    if (NavChild.className == 'NavToggle') {NavChild.firstChild.data = NavigationBarShow;}
* @version 3.0.0 (2018-05-20)
  }
* @source https://www.mediawiki.org/wiki/MediaWiki:Gadget-collapsibleTables.js
  }
* @author [[User:R. Koot]]
  else if (NavToggle.firstChild.data == NavigationBarShow) {
* @author [[User:Krinkle]]
  for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
* @author [[User:TheDJ]]
    if (NavChild.className == 'NavPic') {NavChild.style.display = 'block';}
* @deprecated Since MediaWiki 1.20: Use class="mw-collapsible" instead which
    if (NavChild.className == 'NavContent') {NavChild.style.display = 'block';}
* is supported in MediaWiki core. Shimmable since MediaWiki 1.32
    if (NavChild.className == 'NavToggle') {NavChild.firstChild.data = NavigationBarHide;}
*
  }
* @param {jQuery} $content
  }
*/
}
function makeCollapsibleMwCollapsible( $content ) {
indexNavigationBar = 0;
var $tables = $content
function createNavigationBarToggleButton() {
.find( 'table.collapsible:not(.mw-collapsible)' )
  for (var i=0; NavFrame = $t("div")[i]; i++) {
.addClass( 'mw-collapsible' );
  if (NavFrame.className == "NavFrame") {
 
    indexNavigationBar++;
$.each( $tables, function ( index, table ) {
    var NavToggle = document.createElement("a");
// mw.log.warn( 'This page is using the deprecated class collapsible. Please replace it with mw-collapsible.');
    NavToggle.className = 'NavToggle';
if ( $( table ).hasClass( 'collapsed' ) ) {
    NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
$( table ).addClass( 'mw-collapsed' );
    NavToggle.setAttribute('href', 'javascript:toggleNavigationBar('+indexNavigationBar+')');
// mw.log.warn( 'This page is using the deprecated class collapsed. Please replace it with mw-collapsed.');
    var NavToggleText = document.createTextNode(NavigationBarHide);
}
    NavToggle.appendChild(NavToggleText);
} );
    NavFrame.insertBefore(NavToggle, NavFrame.firstChild);
if ( $tables.length > 0 ) {
    NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
mw.loader.using( 'jquery.makeCollapsible' ).then( function () {
  }
$tables.makeCollapsible();
  }
} );
  if (NavigationBarShowDefault < indexNavigationBar) {
}
  for (var i=1; i<=indexNavigationBar; i++) {toggleNavigationBar(i);}
}
  }
mw.hook( 'wikipage.content' ).add( makeCollapsibleMwCollapsible );
}
 
addOnloadHook(createNavigationBarToggleButton);
/**
* Add support to mw-collapsible for autocollapse, innercollapse and outercollapse
function closedNavBar() {
*
if ( getCookie('WiktionaryUseJSPreferences') != 'true' ) {
* Maintainers: TheDJ
        for (var i = 0; i < indexNavigationBar; i++) {
*/
          var j = i+1;
function mwCollapsibleSetup( $collapsibleContent ) {
          if (document.getElementById("closedNavBar")) {toggleNavigationBar(j);}
var $element,
          else { toggleNavigationBar(0); }
$toggle,
        }
autoCollapseThreshold = 2;
    } else if ( getCookie('WiktionaryPreferencesHideNav') == 'true' ) {
$.each( $collapsibleContent, function ( index, element ) {
        toggleNavigationBar(100);
$element = $( element );
    } else if ( getCookie('WiktionaryPreferencesShowNav') == 'true' ) {
if ( $element.hasClass( 'collapsible' ) ) {
        toggleNavigationBar(0);
$element.find( 'tr:first > th:first' ).prepend( $element.find( 'tr:first > * > .mw-collapsible-toggle' ) );
    } else {
}
        for (var i = 0; i < indexNavigationBar; i++) {
if ( $collapsibleContent.length >= autoCollapseThreshold && $element.hasClass( 'autocollapse' ) ) {
          var j = i+1;
$element.data( 'mw-collapsible' ).collapse();
          if (document.getElementById("closedNavBar")) {toggleNavigationBar(j);}
} else if ( $element.hasClass( 'innercollapse' ) ) {
          else { toggleNavigationBar(0); }
if ( $element.parents( '.outercollapse' ).length > 0 ) {
        }
$element.data( 'mw-collapsible' ).collapse();
    }
}
}
}
addOnloadHook(closedNavBar);
// because of colored backgrounds, style the link in the text color
// to ensure accessible contrast
$toggle = $element.find( '.mw-collapsible-toggle' );
// Import von MediaWiki:Onlyifsystem.js
if ( $toggle.length ) {
// Make the toggle inherit text color (Updated for T333357 2023-04-29)
if (url.indexOf("Spezial:") > 0 || url.indexOf("MediaWiki:") > 0 || url.indexOf("=Spezial") > 0 || url.indexOf("=MediaWiki") > 0) {
if ( $toggle.parent()[ 0 ].style.color ) {
  document.write('<script type="text/javascript" src="/w/index.php?title=MediaWiki:Onlyifsystem.js&amp;action=raw&amp;ctype=text/javascript&amp;dontcountme=s"><\/script>');
$toggle.css( 'color', 'inherit' );
}
$toggle.find( '.mw-collapsible-text' ).css( 'color', 'inherit' );
}
}
// Import von MediaWiki:Onlyifediting.js (Sonderzeichenmenü)
} );
}
if (url.indexOf("=edit") > 0 || url.indexOf("=submit") > 0) {
 
  document.write('<script type="text/javascript" src="/w/index.php?title=MediaWiki:Onlyifediting.js&amp;action=raw&amp;ctype=text/javascript&amp;dontcountme=s"><\/script>');
mw.hook( 'wikipage.collapsibleContent' ).add( mwCollapsibleSetup );
}
 
/* End of mw.loader.using callback */
} );
// Reload-Funktion
/* DO NOT ADD CODE BELOW THIS LINE */
function reload() {
  var reload = $("reload");
  if (reload) {
  reload.innerHTML = '<a href="javascript:location.reload(true)">Wiktionary neu laden!<\/a>';
  }
}
addOnloadHook(reload);
// Drop-down-Menü für MediaWiki:Noexactmatch
function addNogoSubsetMenu() {
  var nogomatch = $("nogomatch");
  if (nogomatch) {
  var menu = "<select style=\"float: left; display: inline; margin: 0.4em 0.5em 0 0;\" onChange=\"chooseCharSubset(selectedIndex)\">";
  menu += "<option>Bulgarisch</option>";
  menu += "<option>Englisch</option>";
  menu += "<option>Französisch</option>";
  menu += "<option>Italienisch</option>";
  menu += "<option>Russisch</option>";
  menu += "<option>Schwedisch</option>";
  menu += "<option>Serbisch</option>";
  menu += "<option>Spanisch</option>";
  menu += "</select>";
  nogomatch.innerHTML = menu + nogomatch.innerHTML;
  chooseCharSubset(0); // Standard-CharSubset
  }
}
addOnloadHook(addNogoSubsetMenu);
// Char-Subset
function chooseCharSubset(s) {
  var l = $('nogomatch').getElementsByTagName('table');
  for (var i = 0; i < l.length ; i++) {
    if (l[i].className == "foreignLanguage") {
      l[i].style.display = l[i].id == s ? 'block' : 'none';
    }
  }
}
// Drop-down-Menü für MediaWiki:Newarticletext
function addNewarticleSubsetMenu() {
  var newarticletext = $("newarticletext");
  if (newarticletext) {
  var menu = "<select style=\"display:inline\" onChange=\"chooseCharSubset2(selectedIndex)\">";
  menu += "<option>Deutsch</option>";
  menu += "<option>Bulgarisch</option>";
  menu += "<option>Englisch</option>";
  menu += "<option>Französisch</option>";
  menu += "<option>Italienisch</option>";
  menu += "<option>Russisch</option>";
  menu += "<option>Schwedisch</option>";
  menu += "<option>Serbisch</option>";
  menu += "<option>Spanisch</option>";
  menu += "</select>";
  newarticletext.innerHTML = menu + newarticletext.innerHTML;
  chooseCharSubset2(0); // Standard-CharSubset
  }
}
addOnloadHook(addNewarticleSubsetMenu);
// Char-Subset
function chooseCharSubset2(s) {
  var l = document.getElementById('newarticletext').getElementsByTagName('p');
  var l = $('newarticletext').getElementsByTagName('p');
  for (var i = 0; i < l.length ; i++) {
    l[i].style.display = i == s ? 'inline' : 'none';
  }
}
// Überschrift der Hauptseite verstecken
if (wgPageName == "Wiktionary:Hauptseite" && url.indexOf("diff=") < 0 && url.indexOf("oldid=") < 0) {
  if (wgAction == "view" || wgAction == "purge") {
  document.write('<style type="text/css">/*<![CDATA[*/ h1.firstHeading, #siteSub, #contentSub, #catlinks, #lastmod {display: none !important;} /*]]>*/</style>');
  }
}
// Sonderzeichen für das Suchfeld
//  Folgendes Script basiert auf einem Element aus User:Connel MacKenzie/custom.js im englischen
//  Wiktionary (http://en.wiktionary.org) und steht unter unter der GNU Lizenz für freie Dokumentation.
// Der Autor des Codes ist [[:en:User:Connel MacKenzie]].
function setCookie(cookieName, cookieValue) {
var today = new Date();
var expire = new Date();
var nDays = 30;
expire.setTime( today.getTime() + (3600000 * 24 * nDays) );
document.cookie = cookieName + "=" + escape(cookieValue)
                + ";path=/w"
                + ";expires="+expire.toGMTString();
document.cookie = cookieName + "=" + escape(cookieValue)
                + ";path=/wiki"
                + ";expires="+expire.toGMTString();
}
function getCookie(cookieName) {
  var start = document.cookie.indexOf( cookieName + "=" );
  if ( start == -1 ) return "";
  var len = start + cookieName.length + 1;
  if ( ( !start ) &&
    ( cookieName != document.cookie.substring( 0, cookieName.length ) ) )
      {
        return "";
      }
  var end = document.cookie.indexOf( ";", len );
  if ( end == -1 ) end = document.cookie.length;
  return unescape( document.cookie.substring( len, end ) );
}
function deleteCookie(cookieName) {
  if ( getCookie(cookieName) ) {
    document.cookie = name + "=" +
    ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
  }
}
document.write('<script '
          + 'type="text/javascript" src="http://de.wiktionary.org'
          + '/w/index.php?title=Benutzer:Spacebirdy'
          + '/custom.js&action=raw&ctype=text/javascript"><\/'
          + 'script>');
// Anpassung der [bearbeiten]-Links
//  Folgendes Script basiert auf einem Element aus dem MediaWiki:Monobook.js in der französischen
//  Wikipedia und steht unter unter der GNU Lizenz für freie Dokumentation. Der Autor des Codes ist
//  Marc Mongenet, Copyright 2006.
setModifySectionStyle = function()
{
try {
        if (!(typeof oldEditsectionLinks == 'undefined' || oldEditsectionLinks == false)) return;
        var spans = $t("span");
        for (var s = 0; s < spans.length; ++s) {
                var span = spans[s];
                if (span.className == "editsection") {
                        span.style.fontSize = "x-small";
                        span.style.fontWeight = "normal";
                        span.style.cssFloat = span.style.styleFloat = "none";
                        span.parentNode.appendChild(document.createTextNode(" "));
                        span.parentNode.appendChild(span);
                }
        }
} catch (e) { /* something went wrong */ }
}
addOnloadHook(setModifySectionStyle);
// Stabile Versionen
document.write('<style type="text/css">#dVban, #sVban {border-width: 0 0 1px; color: #000000; margin-left: -1em;} #p-cactions li#ca-nstab-main a.dVyellow {background-color: #FFFAEE;} #p-cactions li#ca-nstab-main a.sVgreen {background-color: #F3FFF3;} li#dVyellow.selected {background-color: #FFFCD9; border: 1px dashed #AAA;} #dVyellow {background-color: #FFFCD9;} li#sVgreen.selected {background-color: #E3FFE3; border: 1px dashed #AAA;} #sVgreen {background-color: #E3FFE3;} #firstRev {background-color: #F5F5F5;}<\/style>');
if (url.indexOf("stabil&oldid=") > 0) {
  document.write('<style type="text/css">#mw-revision-info, #mw-revision-nav {display: none; speak: none;}<\/style>');
}
// Stabil-/Entwicklungsversionen
var sID;
function stabVer() {
  if ($("copyright")) {sID = $("copyright").getElementsByTagName("a")[0].id;}
  if (sID) {
  var cnm = $("ca-nstab-main").getElementsByTagName("a")[0];
  var pCact = $("p-cactions").getElementsByTagName("ul")[0];
  if (wgCurRevisionId == sID && url.indexOf("oldid=") < 0 || url.indexOf("oldid="+sID) > 0 && url.indexOf("diff=") < 0) {
    cnm.className = "sVgreen";
    if (url.indexOf("action=edit&stabil") < 0) {
    cnm.href = "javascript:showBanner(1)";
    } else {
    cnm.href += "?stabil&oldid="+sID;
    }
    cnm.innerHTML = "Stabilversion";
    $t("h1")[0].innerHTML += '<a class="anti-hoax" id="vLink" style="background-color: #F0FFF0; cursor: help; font-size: 10px; line-height: 10px; margin-left: 0.7em;" href="javascript:showBanner(1)" title="Zeigt eine erweiterte Beschreibung">[Beständige Version]<\/a>';
    sVer = document.createElement("div");
    if (is_khtml) {
    sVer.setAttribute("style", "margin: -0.7em 115px 0.7em 165px;");
    }
    if (wgCurRevisionId == sID) {
    $("ca-edit").id = "ca-viewsource";
    pCact.getElementsByTagName("a")[2].innerHTML = "Eintrag weiterentwickeln";
    var dev = "";
    } else {
    var dVtab = document.createElement("li");
    dVtab.innerHTML = '<a href="/wiki/'+wgPageName+'?aktuell" title="Betrachte die brandaktuelle Version!">Entwicklungsversion<\/a>';
    pCact.insertBefore(dVtab, $("ca-nstab-main"));
    pCact.removeChild(pCact.getElementsByTagName("li")[3]);
    var dev = ' <small>(<a class="anti-hoax" href="/wiki/'+wgPageName+'?action=edit&stabil&oldid='+sID+'" title="Verwende den Quelltext der stabilen Version!">Quelltext<\/a>)<\/small>. Es gibt jedoch eine aktuellere <a class="anti-hoax" href="/wiki/'+wgPageName+'?aktuell" title="Betrachte die brandaktuelle Version!">Entwicklungsversion<\/a> <small>(<a class="anti-hoax" href="/wiki/'+wgPageName+'?diff=0&oldid='+sID+'" title="Vergleiche die beständige mit der aktuellen Version!">Unterschied<\/a>)<\/small>';
    }
    sVer.innerHTML = '<table id="sVban" style="border-style: solid; border-color: #32CD32; border-collapse: collapse; background-color: #F0FFF0; line-height: 1.8em;"><tr><td style="padding: 2px 9px 1px;">Diese Ausgabe des Wörterbucheintrages ist eine beständige <b>„<a class="anti-hoax" href="/wiki/Wiktionary:Stabilversionen" title="Was ist eine Stabilversion?">Stabilversion<\/a>“<\/b>'+dev+'.<\/td><\/tr><\/table>';
    if ($("dVban")) {
    $("lastmod").insertBefore(sVer, $("dVban"));
    $("lastmod").removeChild($("dVban"));
    } else {
    $("f-list").insertBefore(sVer, $("copyright"));
    }
  } else if (wgCurRevisionId != sID && url.indexOf("oldid=") < 0) {
    if ($("dVban")) {
    cnm.className = "dVyellow";
    cnm.href = "javascript:showBanner(1)";
    cnm.innerHTML = "Entwicklungsversion";
    var sVtab = document.createElement("li");
    sVtab.innerHTML = '<a href="/wiki/'+wgPageName+'?stabil&oldid='+sID+'" title="Betrachte die stabile Version!">Stabilversion<\/a>';
    pCact.insertBefore(sVtab, $("ca-talk"));
    $t("h1")[0].innerHTML += '<a class="anti-hoax" id="vLink" style="background-color: #FFFBDE; cursor: help; font-size: 10px; line-height: 10px; margin-left: 0.7em;" href="javascript:showBanner(1)" title="Zeigt eine erweiterte Beschreibung">[Änderbare Version]<\/a>';
    if (is_khtml) {
      $("dVban").setAttribute("style", "border-style: solid; border-color: #FFAA80; border-collapse: collapse; background-color: #FFFADE; line-height: 1.8em; margin: -0.7em 115px 0.7em 165px;");
    }
    }
  }
  }
}
addOnloadHook(stabVer);
function showBanner(x) {
  var a = $("ca-nstab-main").getElementsByTagName("a")[0];
  if (x != 1) {
  if ($("dVban")) {$("contentSub").removeChild($("dVban"));}
  if ($("sVban")) {$("contentSub").removeChild($("sVban"));}
  $("vLink").className = "hiddenStructure";
  a.href = url;
  } else {
  if ($("dVban")) {
    if (is_khtml) {
    $("dVban").setAttribute("style", "border-style: solid; border-color: #FFAA80; border-collapse: collapse; background-color: #FFFADE; line-height: 1.8em;");
    }
    $("contentSub").appendChild($("dVban"));
  }
  if ($("sVban")) {$("contentSub").appendChild($("sVban"));}
  $("vLink").setAttribute("style", "color: #778899; font-size: 10px; line-height: 10px; margin-left: 0.7em;");
  $("vLink").href = "javascript:showBanner(0)";
  a.href = "javascript:showBanner(0)";
  }
}
// Markierungen unter "Versionen/Autoren"
if (url.indexOf("=history") > 0) {
  function sVmark() {
  var sID = $("histlegend").className;
  if (sID) {
    var ip = $t("input");
    for (var i = 0; i < ip.length; i++) {
    if (ip[i].name == "oldid") {
      if (ip[i].value == wgCurRevisionId) {
      ip[i].parentNode.id = "dVyellow";
      }
      if (ip[i].parentNode.innerHTML.indexOf(") (Vorherige) ") > 0) {
      ip[i].parentNode.id = "firstRev";
      }
      if (ip[i].value == sID) {
      ip[i].parentNode.id = "sVgreen";
      }
    }
    }
    if ($("pagehistory").innerHTML.indexOf("<li>(Aktuell) (Vorherige)") > 0) {
    $("pagehistory").getElementsByTagName("li")[0].id = "sVgreen";
    }
  }
  }
  addOnloadHook(sVmark);
}
// Versionen als "stabil" markieren (SysOps)
if (wgNamespaceNumber == 0) {
  function makeStable() {
  if (wgUserGroups != null) {
    if (wgUserGroups[0] == "sysop" || wgUserGroups[1] == "sysop") {
    if (wgNamespaceNumber == 0 && url.indexOf("oldid=") > 0 && url.indexOf("diff=") < 0 && !(sID && url.indexOf("oldid="+sID) > 0)) {
      var oldid = url.replace(/.*?oldid=([0-9]+).*/, "$1");
      var span = document.createElement("span");
      span.setAttribute("style", "float: right; color: #000000; font-size: larger;");
      span.innerHTML = ' [<a style="color: #008000;" href="javascript:ask(\''+oldid+'\')">Zur stabilen Version machen<\/a>]';
      $("mw-revision-info").appendChild(span);
    }
    }
  }
  }
  addOnloadHook(makeStable);
}
xTimes = 0;
function ask(x) {
  var img = new Image();
  img.src = bouncyWiki;
  if (img.complete == true) {
  var ask = confirm("Diese Version wirklich zur Stabilversion machen?");
  if (ask == true) {
    location.href = "/wiki/MediaWiki:Stabilversion/"+wgPageName+"?action=edit&useID="+x;
  }
  } else {
  xTimes = xTimes +1;
  if (xTimes < 9) {
    window.setTimeout('ask('+x+')', 250);
  }
  }
}
// Versionsmarkierung (autoEdit)
if (url.indexOf("&useID=") > 0) {
  document.write('<style type="text/css">body {background: #f9f9f9 url('+bouncyWiki+') center 200px no-repeat;} #globalWrapper {display: none; speak: none;}<\/style>');
  function autoEdit() {
  var useID = url.replace(/.*?useID=([0-9]+).*/, "$1");
  var editForm = document.editform.wpTextbox1;
  editForm.value = useID;
  document.editform.wpSummary.value = '[['+wgPageName+'|'+useID+']]';
  var minorEdit = document.editform.wpMinoredit;
  var watchThis = document.editform.wpWatchthis;
  if (minorEdit.checked != true) {minorEdit.checked = true;}
  if (watchThis.checked == true) {watchThis.checked = false;}
  document.editform.submit();
  }
  addOnloadHook(autoEdit);
}
if (url.indexOf("MediaWiki:Stabilversion/") > 0 && url.indexOf("?") < 0) {
  document.write('<style type="text/css">body {background: #f9f9f9 url('+bouncyWiki+') center 200px no-repeat;} #globalWrapper {display: none; speak: none;}<\/style>');
  function autoRedirect() {
  var pageName = url.replace(/.*?Stabilversion\/(.*)/, "$1");
  location.href = '/wiki/'+pageName+'?stabil&oldid='+$("bodyContent").getElementsByTagName("p")[0].innerHTML;
  }
  addOnloadHook(autoRedirect);
}
// Versionsmarken aus RC ausblenden
function hideRevTagsLink() {
  var tRTL = $("hideRevTags");
  if (tRTL) {
  tRTL.innerHTML = 'Versionsmarken&nbsp;<a href="javascript:hideRevTags(1)" id="hideRTLink">ausblenden<\/a>';
  if (document.cookie.indexOf("hideRevTags=1") > -1) {hideRevTags(1);}
  }
}
addOnloadHook(hideRevTagsLink);
var doneRep;
function hideRevTags(x) {
  var li = $t("li");
  for (var i = 0; i < li.length; i++) {
  var a2 = li[i].getElementsByTagName("a")[1];
  if (a2) {
    var title = a2.title;
    var tBase = title.replace(/(.*?)\/.+/, "$1");
    if (tBase == "MediaWiki:Stabilversion") {
    if (x != 1) {
      li[i].className = "visibleStructure";
    } else {
      li[i].className = "hiddenStructure";
    }
    }
  }
  }
  if ($("RCM0")) {
  if (is_gecko) {var tag = "SPAN";} else {var tag = "DIV";}
  if (doneRep != 1) {
    var oldHTML = $("bodyContent").innerHTML.replace(/<(img src|span id)/gi, "&lt;$1");
    var mHTML = oldHTML.replace(/&lt;(img)(.*?)<(a)(.*?)(title="MediaWiki:Stabilversion)(.*?)<(br)(.*?)>/gi, '<'+tag+' class="sVrevTag"><$1$2<$3$4$5$6<$7$8></'+tag+'>');
    var nHTML = mHTML.replace(/&lt;(span id="RCM)(.*?)<(a href="\/)(.*?)(title="MediaWiki:Stabilversion)(.*?)<(br)(.*?)>/gi, '<'+tag+' class="sVrevTag"><$1$2<$3$4$5$6<$7$8></'+tag+'>');
    var newHTML = nHTML.replace(/&lt;(img src|span id)/gi, "<$1");
    $("bodyContent").innerHTML = newHTML;
    doneRep = 1;
  }
  var gTag = $t(tag);
  for (var j = 0; j < gTag.length; j++) {
    if (gTag[j].className.indexOf("sVrevTag") > -1) {
    if (x != 1) {
      gTag[j].className = "sVrevTag";
    } else {
      gTag[j].className = "hiddenStructure sVrevTag";
    }
    }
  }
  }
  if (x != 1) {
  document.cookie = "hideRevTags=0; path=/";
  $("hideRTLink").href = "javascript:hideRevTags(1)";
  $("hideRTLink").firstChild.nodeValue = "ausblenden";
  } else {
  document.cookie = "hideRevTags=1; path=/";
  $("hideRTLink").href = "javascript:hideRevTags(0)";
  $("hideRTLink").firstChild.nodeValue = "einblenden";
  }
}
//********Fügt einen Link "Alle Sprachen" auf der Hauptseite unter die Sprachverweise hinzu, aus http://en.wikipedia.org/wiki/MediaWiki:Common.js ********************
function mainPageAppendCompleteListLink() {
    try {
        var node = document.getElementById( "p-lang" )
                          .getElementsByTagName('div')[0]
                          .getElementsByTagName('ul')[0];
        var aNode = document.createElement( 'a' );
        var liNode = document.createElement( 'li' );
        aNode.appendChild( document.createTextNode( 'Alle Sprachen' ) );
        aNode.setAttribute( 'href' , 'http://de.wiktionary.org/wiki/Wiktionary:Liste_der_Wiktionarys_in_anderen_Sprachen' );
        liNode.appendChild( aNode );
        liNode.className = 'interwiki-completelist';
        liNode.style.fontWeight = 'bold';
        node.appendChild( liNode );
    } catch(e) {
      // lets just ignore what's happened
      return;
    }
}
if ( wgTitle == 'Hauptseite' && wgNamespaceNumber == 4 ) {
      addOnloadHook( mainPageAppendCompleteListLink );
}
//********Fügt einen Link "Alle Sprachen" auf der Hauptseite unter die Sprachverweise hinzu ********************
if ( wgCanonicalSpecialPageName == "Upload" ) {
function setSpecialUploadTemplate() {
    var editbox = document.getElementById('wpUploadDescription');
    if (!editbox)            return;
    if (editbox.value != '') return;
    editbox.value = "{"+"{Information\n"
                  + "|Beschreibung = \n"
                  + "|Quelle = \n"
                  + "|Urheber = \n"
                  + "|Datum = \n"
                  + "|Genehmigung = \n"
                  + "|Andere Versionen = \n"
                  + "|Anmerkungen = \n"
                  + "}"+"}";
}
addOnloadHook(setSpecialUploadTemplate);   
}
// Wiktionary zur Browser-Suchleiste hinzufügen (FF / IE7)
function aspWikt() {
  var asp = $("addWiktSearch");
  if (asp) {
  asp.innerHTML = '<a href="javascript:addWiktSearch()">Wiktionary zur Browser-Suchleiste hinzufügen!<\/a>';
  }
}
addOnloadHook(aspWikt);
function addWiktSearch() {
  if (typeof window.external == "object" && (typeof window.external.AddSearchProvider == "unknown" || typeof window.external.AddSearchProvider == "function") && !window.opera) {
  window.external.AddSearchProvider("http://de.wiktionary.org/w/opensearch_desc.php");
  } else {
  alert("Bei deinem Browser musst du das leider manuell machen!");
  }
}
/* </nowiki> */

Aktuelle Version vom 20. September 2024, 05:22 Uhr

/**
 * Keep code in MediaWiki:Common.js to a minimum as it is unconditionally
 * loaded for all users on every wiki page. If possible create a gadget that is
 * enabled by default instead of adding it here (since gadgets are fully
 * optimized ResourceLoader modules with possibility to add dependencies etc.)
 *
 * Since Common.js isn't a gadget, there is no place to declare its
 * dependencies, so we have to lazy load them with mw.loader.using on demand and
 * then execute the rest in the callback. In most cases these dependencies will
 * be loaded (or loading) already and the callback will not be delayed. In case a
 * dependency hasn't arrived yet it'll make sure those are loaded before this.
 */

/* global mw, $ */
/* jshint strict:false, browser:true */

mw.loader.using( [ 'mediawiki.util' ] ).done( function () {
	/* Begin of mw.loader.using callback */

	/**
	 * Map addPortletLink to mw.util
	 * @deprecated: Use mw.util.addPortletLink instead.
	 */
	mw.log.deprecate( window, 'addPortletLink', mw.util.addPortletLink, 'Use mw.util.addPortletLink instead' );

	/**
	 * @source www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL
	 * @rev 6
	 */
	var extraCSS = mw.util.getParamValue( 'withCSS' ),
		extraJS = mw.util.getParamValue( 'withJS' );

	if ( extraCSS ) {
		if ( extraCSS.match( /^MediaWiki:[^&<>=%#]*\.css$/ ) ) {
			mw.loader.load( '/w/index.php?title=' + extraCSS + '&action=raw&ctype=text/css', 'text/css' );
		} else {
			mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withCSS value' } );
		}
	}

	if ( extraJS ) {
		if ( extraJS.match( /^MediaWiki:[^&<>=%#]*\.js$/ ) ) {
			mw.loader.load( '/w/index.php?title=' + extraJS + '&action=raw&ctype=text/javascript' );
		} else {
			mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } );
		}
	}

	/**
	 * 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 the Meta-Wiki because it is used by many projects.
	 *              See [[Meta:WikiMiniAtlas]] for more information.
	 * Note - use of this service is recommended to be replaced with mw:Help:Extension:Kartographer
	 */
	$( function () {
		var requireWikiminiatlas = $( 'a.external.text[href*="geohack"]' ).length || $( 'div.kmldata' ).length;
		if ( requireWikiminiatlas ) {
			mw.loader.load( 'ext.gadget.WikiMiniAtlas' );
		}
	} );

	/**
	 * Collapsible tables; reimplemented with mw-collapsible
	 * Styling is also in place to avoid FOUC
	 *
	 * Allows tables to be collapsed, showing only the header. See [[Help:Collapsing]].
	 * @version 3.0.0 (2018-05-20)
	 * @source https://www.mediawiki.org/wiki/MediaWiki:Gadget-collapsibleTables.js
	 * @author [[User:R. Koot]]
	 * @author [[User:Krinkle]]
	 * @author [[User:TheDJ]]
	 * @deprecated Since MediaWiki 1.20: Use class="mw-collapsible" instead which
	 * is supported in MediaWiki core. Shimmable since MediaWiki 1.32
	 *
	 * @param {jQuery} $content
	 */
	function makeCollapsibleMwCollapsible( $content ) {
		var $tables = $content
			.find( 'table.collapsible:not(.mw-collapsible)' )
			.addClass( 'mw-collapsible' );

		$.each( $tables, function ( index, table ) {
			// mw.log.warn( 'This page is using the deprecated class collapsible. Please replace it with mw-collapsible.');
			if ( $( table ).hasClass( 'collapsed' ) ) {
				$( table ).addClass( 'mw-collapsed' );
				// mw.log.warn( 'This page is using the deprecated class collapsed. Please replace it with mw-collapsed.');
			}
		} );
		if ( $tables.length > 0 ) {
			mw.loader.using( 'jquery.makeCollapsible' ).then( function () {
				$tables.makeCollapsible();
			} );
		}
	}
	mw.hook( 'wikipage.content' ).add( makeCollapsibleMwCollapsible );

	/**
	 * Add support to mw-collapsible for autocollapse, innercollapse and outercollapse
	 *
	 * Maintainers: TheDJ
	 */
	function mwCollapsibleSetup( $collapsibleContent ) {
		var $element,
			$toggle,
			autoCollapseThreshold = 2;
		$.each( $collapsibleContent, function ( index, element ) {
			$element = $( element );
			if ( $element.hasClass( 'collapsible' ) ) {
				$element.find( 'tr:first > th:first' ).prepend( $element.find( 'tr:first > * > .mw-collapsible-toggle' ) );
			}
			if ( $collapsibleContent.length >= autoCollapseThreshold && $element.hasClass( 'autocollapse' ) ) {
				$element.data( 'mw-collapsible' ).collapse();
			} else if ( $element.hasClass( 'innercollapse' ) ) {
				if ( $element.parents( '.outercollapse' ).length > 0 ) {
					$element.data( 'mw-collapsible' ).collapse();
				}
			}
			// because of colored backgrounds, style the link in the text color
			// to ensure accessible contrast
			$toggle = $element.find( '.mw-collapsible-toggle' );
			if ( $toggle.length ) {
				// Make the toggle inherit text color (Updated for T333357 2023-04-29)
				if ( $toggle.parent()[ 0 ].style.color ) {
					$toggle.css( 'color', 'inherit' );
					$toggle.find( '.mw-collapsible-text' ).css( 'color', 'inherit' );
				}
			}
		} );
	}

	mw.hook( 'wikipage.collapsibleContent' ).add( mwCollapsibleSetup );

	/* End of mw.loader.using callback */
} );
/* DO NOT ADD CODE BELOW THIS LINE */