MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus Pornopedia, der geilen Enzyklopädie
Till Kraemer (Diskussion | Beiträge)
Keine Bearbeitungszusammenfassung
Till Kraemer (Diskussion | Beiträge)
Keine Bearbeitungszusammenfassung
 
Zeile 2: Zeile 2:


/* From https://en.wikipedia.org/wiki/MediaWiki:Common.js */
/* From https://en.wikipedia.org/wiki/MediaWiki:Common.js */
/**
* 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, $ */
/* global mw, $ */
Zeile 9: Zeile 21:
/* Begin of mw.loader.using callback */
/* Begin of mw.loader.using callback */


/**
* 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 ( mw.config.get( 'wgPageName' ) === 'Main_Page' || mw.config.get( 'wgPageName' ) === 'Talk:Main_Page' ) {
$( function () {
mw.util.addPortletLink( 'p-lang', '//meta.wikimedia.org/wiki/List_of_Wikipedias',
'Complete list', 'interwiki-completelist', 'Complete list of Wikipedias' );
} );
}


if ( /^MediaWiki(\/.+)?$/.test( wgPageName ) && wgAction == "view" ) {
/**
    addOnloadHook(function(){
* Redirect User:Name/skin.js and skin.css to the current skin's pages
        document.body.className+=" mainpage";
* (unless the 'skin' page really exists)
        document.write('<style type="text/css">/*<![CDATA[*/ #lastmod, #siteSub, h1.firstHeading { display: none !important; } #content { padding-top: 1em; }/*]]>*/</style>'); /*REMOVE THIS LINE AFTER 22/01/2009 */
* @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.getUrl( userSkinPage + '.js' );
} else if ( titleParts.slice( -1 ) == 'skin.css' ) {
window.location.href = mw.util.getUrl( userSkinPage + '.css' );
}
}
}
}
/* From https://en.wikipedia.org/wiki/MediaWiki:Common.js */


/**
/**
Zeile 62: Zeile 97:
}
}


 
/**
/* Force preview for anons */
  * WikiMiniAtlas
/* by Marc Mongenet, 2006, fr.wikipedia */
 
function forcePreview() {
  if (wgUserName != null || wgAction != "edit") return;
  saveButton = document.getElementById("wpSave");
  if (!saveButton) return;
  saveButton.disabled = true;
  saveButton.value = "Save page (use preview first)";
  saveButton.style.fontWeight = "normal";
  document.getElementById("wpPreview").style.fontWeight = "bold";
}
addOnloadHook(forcePreview);
 
/* End of forcePreview */
 
/** includePage ************
  * force the loading of another JavaScript file
  *
  *
  * Maintainer: [[Commons:User:Dschwen]]
  * 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.
* Note - use of this service is recommended to be repalced with mw:Help:Extension:Kartographer
  */
  */
( function () {
function includePage( name )
var require_wikiminiatlas = false;
{
var coord_filter = /geohack/;
document.write('<script type="text/javascript" src="/w/index.php?title='
$( function () {
  + name
$( 'a.external.text' ).each( function( key, link ) {
  + '&action=raw&ctype=text/javascript"><\/script>'  
if ( link.href && coord_filter.exec( link.href ) ) {
);
require_wikiminiatlas = true;
}
// break from loop
/* End of includePage */
return false;
 
}
/* Including extra .js pages */
} );
 
if ( $( 'div.kmldata' ).length ) {
// switches for scripts
require_wikiminiatlas = true;
// TODO: migrate to JSConfig
}
// var load_extratabs = true;
if ( require_wikiminiatlas ) {
var load_edittools = true;
mw.loader.load( '//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript' );
 
}
// extra drop down menu on editing for adding special characters
} );
includePage( 'MediaWiki:Edittools.js' );
} )();
 
//Editpage scripts
if (wgAction=='edit' || wgAction == 'submit')
  importScript('MediaWiki:Editpage.js')
 
/* End of extra pages */


/**
/**
  * Collapsible tables
  * Collapsible tables; reimplemented with mw-collapsibe
  *
* Styling is also in place to avoid FOUC
  * Allows tables to be collapsed, showing only the header. See [[Wikipedia:NavFrame]].
  *  
  * @maintainer [[User:R. Koot]] (on Wikipedia)
  * 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
  */
  */
function makeCollapsibleMwCollapsible( $content ) {
var $tables = $content
.find( 'table.collapsible:not(.mw-collapsible)' )
.addClass( 'mw-collapsible' );


var autoCollapse = 2;
$.each( $tables, function( index, table ) {
var collapseCaption = 'Verbergen';
// mw.log.warn( 'This page is using the deprecated class collapsible. Please replace it with mw-collapsible.');
var expandCaption = 'Anzeigen';
if( $( table ).hasClass( 'collapsed') ) {
 
$( table ).addClass( 'mw-collapsed' );
function hasClass( element, className ) {
// mw.log.warn( 'This page is using the deprecated class collapsed. Please replace it with mw-collapsed.');
var Classes = element.className.split( " " );
for ( var i = 0; i < Classes.length; i++ ) {
if ( Classes[i] == className ) {
return true;
}
}
} );
if( $tables.length > 0 ) {
mw.loader.using( 'jquery.makeCollapsible' ).then( function() {
$tables.makeCollapsible();
} );
}
}
return false;
}
}
mw.hook( 'wikipage.content' ).add( makeCollapsibleMwCollapsible );


function collapseTable( tableIndex ) {
/**
var i;
* Add support to mw-collapsible for autocollapse, innercollapse and outercollapse
var Button = document.getElementById( 'collapseButton' + tableIndex );
*
var Table = document.getElementById( 'collapsibleTable' + tableIndex );
* Maintainers: TheDJ
 
*/
if ( !Table || !Button ) {
function mwCollapsibleSetup( $collapsibleContent ) {
return false;
var $element,
}
$toggle,
 
autoCollapseThreshold = 2;
var Rows = Table.getElementsByTagName( 'tr' );
$.each( $collapsibleContent, function (index, element) {
 
$element = $( element );
if ( Button.firstChild.data == collapseCaption ) {
if ( $element.hasClass( 'collapsible' ) ) {
for ( i = 1; i < Rows.length; i++ ) {
$element.find('tr:first > th:first').prepend( $element.find('tr:first > * > .mw-collapsible-toggle'));
Rows[i].style.display = 'none';
}
}
Button.firstChild.data = expandCaption;
if ( $collapsibleContent.length >= autoCollapseThreshold && $element.hasClass( 'autocollapse' ) ) {
} else {
$element.data( 'mw-collapsible' ).collapse();
for ( i = 1; i < Rows.length; i++ ) {
} else if ( $element.hasClass( 'innercollapse' ) ) {
Rows[i].style.display = Rows[0].style.display;
if ( $element.parents( '.outercollapse' ).length > 0 ) {
$element.data( 'mw-collapsible' ).collapse();
}
}
}
Button.firstChild.data = collapseCaption;
// because of colored backgrounds, style the link in the text color
}
// to ensure accessible contrast
}
$toggle = $element.find( '.mw-collapsible-toggle' );
 
if ( $toggle.length ) {
function createCollapseButtons() {
// Make the toggle inherit text color
var i;
if( $toggle.parent()[0].style.color ) {
var tableIndex = 0;
$toggle.find( 'a' ).css( 'color', 'inherit' );
var NavigationBoxes = {};
var Tables = document.getElementsByTagName( 'table' );
 
for ( i = 0; i < Tables.length; i++ ) {
if ( hasClass( Tables[i], 'collapsible' ) ) {
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.style.styleFloat = 'right';
Button.style.cssFloat = 'right';
Button.style.fontWeight = 'normal';
Button.style.textAlign = 'right';
Button.style.width = '6em';
 
ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex );
ButtonLink.setAttribute( 'href', 'javascript:collapseTable(' + tableIndex + ');' );
ButtonLink.appendChild( ButtonText );
 
Button.appendChild( document.createTextNode( '[' ) );
Button.appendChild( ButtonLink );
Button.appendChild( document.createTextNode( ']' ) );
 
var Header = Tables[i].getElementsByTagName( 'tr' )[0].getElementsByTagName( 'th' )[0];
/* only add button and increment count if there is a header row to work with */
if (Header) {
Header.insertBefore( Button, Header.childNodes[0] );
tableIndex++;
}
}
}
}
}
} );
 
for ( i = 0; i < tableIndex; i++ ) {
if ( hasClass( NavigationBoxes[i], 'collapsed' ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], 'autocollapse' ) ) ) {
collapseTable( i );
}
}
}
}


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


/**
/**
  * Dynamic Navigation Bars (experimental)
  * Dynamic Navigation Bars (experimental)
  *
  *
  * See [[Wikipedia:NavFrame]].
  * Description: See [[Wikipedia:NavFrame]].
* Maintainers: UNMAINTAINED
  */
  */
var collapseCaption = 'hide';
var expandCaption = 'show';


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


// shows and hides content and picture (if available) of navigation bars
/**
// Parameters:
* Shows and hides content and picture (if available) of navigation bars.
// indexNavigationBar: the index of navigation bar to be toggled
*
function toggleNavigationBar(indexNavigationBar) {
* @param {number} indexNavigationBar The index of navigation bar to be toggled
var NavChild;
* @param {jQuery.Event} event Event object
var NavToggle = document.getElementById( 'NavToggle' + indexNavigationBar);
*/
var NavFrame = document.getElementById( 'NavFrame' + indexNavigationBar);
function toggleNavigationBar( indexNavigationBar, event ) {
var navToggle = document.getElementById( 'NavToggle' + indexNavigationBar );
var navFrame = document.getElementById( 'NavFrame' + indexNavigationBar );
var navChild;


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


// if shown now
// If shown now
if (NavToggle.firstChild.data == NavigationBarHide) {
if ( navToggle.firstChild.data === navigationBarHide ) {
for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
for ( navChild = navFrame.firstChild; navChild !== null; navChild = navChild.nextSibling ) {
if ( hasClass( NavChild, 'NavPic' ) ) {
if ( $( navChild ).hasClass( 'NavContent' ) ) {
NavChild.style.display = 'none';
navChild.style.display = 'none';
}
}
if ( hasClass( NavChild, 'NavContent') ) {
}
NavChild.style.display = 'none';
navToggle.firstChild.data = navigationBarShow;
// If hidden now
} else if ( navToggle.firstChild.data === navigationBarShow ) {
for ( navChild = navFrame.firstChild; navChild !== null; navChild = navChild.nextSibling ) {
if ( $( navChild ).hasClass( 'NavContent' ) ) {
navChild.style.display = 'block';
}
}
}
}
NavToggle.firstChild.data = NavigationBarShow;
navToggle.firstChild.data = navigationBarHide;
}


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


// adds show/hide-button to navigation bars
/**
function createNavigationBarToggleButton(){
* Adds show/hide-button to navigation bars.
var indexNavigationBar = 0;
*
// iterate over all < div >-elements
* @param {jQuery} $content
var divs = document.getElementsByTagName( 'div' );
*/
for (var i = 0; NavFrame = divs[i]; i++) {
function createNavigationBarToggleButton( $content ) {
// if found a navigation bar
var i, j, navChild, navToggle, navToggleText, isCollapsed,
if ( hasClass(NavFrame, 'NavFrame' )) {
indexNavigationBar = 0;
 
// Iterate over all < div >-elements
indexNavigationBar++;
var $divs = $content.find( 'div.NavFrame:not(.mw-collapsible)' );
var NavToggle = document.createElement('a');
$divs.each( function ( i, navFrame ) {
NavToggle.className = 'NavToggle';
indexNavigationBar++;
NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
navToggle = document.createElement( 'a' );
NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
navToggle.className = 'NavToggle';
navToggle.setAttribute( 'id', 'NavToggle' + indexNavigationBar );
navToggle.setAttribute( 'href', '#' );
$( navToggle ).on( 'click', $.proxy( toggleNavigationBar, null, indexNavigationBar ) );


var NavToggleText = document.createTextNode(NavigationBarHide);
isCollapsed = $( navFrame ).hasClass( 'collapsed' );
for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
/**
if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
* Check if any children are already hidden.  This loop is here for backwards compatibility:
if (NavChild.style.display == 'none') {
* the old way of making NavFrames start out collapsed was to manually add style="display:none"
NavToggleText = document.createTextNode(NavigationBarShow);
* to all the NavPic/NavContent elements.  Since this was bad for accessibility (no way to make
break;
* 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 ( navChild = navFrame.firstChild; navChild !== null && !isCollapsed; navChild = navChild.nextSibling ) {
if ( $( navChild ).hasClass( 'NavPic' ) || $( navChild ).hasClass( 'NavContent' ) ) {
if ( navChild.style.display === 'none' ) {
isCollapsed = true;
}
}
}
}
 
}
NavToggle.appendChild(NavToggleText);
if ( isCollapsed ) {
// Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
for ( navChild = navFrame.firstChild; navChild !== null; navChild = navChild.nextSibling ) {
for(var j=0; j < NavFrame.childNodes.length; j++) {
if ( $( navChild ).hasClass( 'NavPic' ) || $( navChild ).hasClass( 'NavContent' ) ) {
if (hasClass(NavFrame.childNodes[j], 'NavHead')) {
navChild.style.display = 'none';
NavFrame.childNodes[j].appendChild(NavToggle);
}
}
}
}
NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
}
}
}
navToggleText = document.createTextNode( isCollapsed ? navigationBarShow : navigationBarHide );
}
navToggle.appendChild( navToggleText );


$( createNavigationBarToggleButton );
// Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
 
for ( j = 0; j < navFrame.childNodes.length; j++ ) {
/* From https://en.wikipedia.org/wiki/User:Alex_21/script-functions.js */
if ( $( navFrame.childNodes[j] ).hasClass( 'NavHead' ) ) {
 
navToggle.style.color = navFrame.childNodes[j].style.color;
/* HTML colour names */
navFrame.childNodes[j].appendChild( navToggle );
var colour_names = {};
}
colour_names.aliceblue = "f0f8ff";
colour_names.antiquewhite = "faebd7";
colour_names.aqua = "00ffff";
colour_names.aquamarine = "7fffd4";
colour_names.azure = "f0ffff";
colour_names.beige = "f5f5dc";
colour_names.bisque = "ffe4c4";
colour_names.black = "000000";
colour_names.blanchedalmond = "ffebcd";
colour_names.blue = "0000ff";
colour_names.blueviolet = "8a2be2";
colour_names.brown = "a52a2a";
colour_names.burlywood = "deb887";
colour_names.cadetblue = "5f9ea0";
colour_names.chartreuse = "7fff00";
colour_names.chocolate = "d2691e";
colour_names.coral = "ff7f50";
colour_names.cornflowerblue = "6495ed";
colour_names.cornsilk = "fff8dc";
colour_names.crimson = "dc143c";
colour_names.cyan = "00ffff";
colour_names.darkblue = "00008b";
colour_names.darkcyan = "008b8b";
colour_names.darkgoldenrod = "b8860b";
colour_names.darkgray = "a9a9a9";
colour_names.darkgrey = "a9a9a9";
colour_names.darkgreen = "006400";
colour_names.darkkhaki = "bdb76b";
colour_names.darkmagenta = "8b008b";
colour_names.darkolivegreen = "556b2f";
colour_names.darkorange = "ff8c00";
colour_names.darkorchid = "9932cc";
colour_names.darkred = "8b0000";
colour_names.darksalmon = "e9967a";
colour_names.darkseagreen = "8fbc8f";
colour_names.darkslateblue = "483d8b";
colour_names.darkslategray = "2f4f4f";
colour_names.darkslategrey = "2f4f4f";
colour_names.darkturquoise = "00ced1";
colour_names.darkviolet = "9400d3";
colour_names.deeppink = "ff1493";
colour_names.deepskyblue = "00bfff";
colour_names.dimgray = "696969";
colour_names.dimgrey = "696969";
colour_names.dodgerblue = "1e90ff";
colour_names.firebrick = "b22222";
colour_names.floralwhite = "fffaf0";
colour_names.forestgreen = "228b22";
colour_names.fuchsia = "ff00ff";
colour_names.gainsboro = "dcdcdc";
colour_names.ghostwhite = "f8f8ff";
colour_names.gold = "ffd700";
colour_names.goldenrod = "daa520";
colour_names.gray = "808080";
colour_names.grey = "808080";
colour_names.green = "008000";
colour_names.greenyellow = "adff2f";
colour_names.honeydew = "f0fff0";
colour_names.hotpink = "ff69b4";
colour_names.indianred = "cd5c5c";
colour_names.indigo = "4b0082";
colour_names.ivory = "fffff0";
colour_names.khaki = "f0e68c";
colour_names.lavender = "e6e6fa";
colour_names.lavenderblush = "fff0f5";
colour_names.lawngreen = "7cfc00";
colour_names.lemonchiffon = "fffacd";
colour_names.lightblue = "add8e6";
colour_names.lightcoral = "f08080";
colour_names.lightcyan = "e0ffff";
colour_names.lightgoldenrodyellow = "fafad2";
colour_names.lightgray = "d3d3d3";
colour_names.lightgrey = "d3d3d3";
colour_names.lightgreen = "90ee90";
colour_names.lightpink = "ffb6c1";
colour_names.lightsalmon = "ffa07a";
colour_names.lightseagreen = "20b2aa";
colour_names.lightskyblue = "87cefa";
colour_names.lightslategray = "778899";
colour_names.lightslategrey = "778899";
colour_names.lightsteelblue = "b0c4de";
colour_names.lightyellow = "ffffe0";
colour_names.lime = "00ff00";
colour_names.limegreen = "32cd32";
colour_names.linen = "faf0e6";
colour_names.magenta = "ff00ff";
colour_names.maroon = "800000";
colour_names.mediumaquamarine = "66cdaa";
colour_names.mediumblue = "0000cd";
colour_names.mediumorchid = "ba55d3";
colour_names.mediumpurple = "9370db";
colour_names.mediumseagreen = "3cb371";
colour_names.mediumslateblue = "7b68ee";
colour_names.mediumspringgreen = "00fa9a";
colour_names.mediumturquoise = "48d1cc";
colour_names.mediumvioletred = "c71585";
colour_names.midnightblue = "191970";
colour_names.mintcream = "f5fffa";
colour_names.mistyrose = "ffe4e1";
colour_names.moccasin = "ffe4b5";
colour_names.navajowhite = "ffdead";
colour_names.navy = "000080";
colour_names.oldlace = "fdf5e6";
colour_names.olive = "808000";
colour_names.olivedrab = "6b8e23";
colour_names.orange = "ffa500";
colour_names.orangered = "ff4500";
colour_names.orchid = "da70d6";
colour_names.palegoldenrod = "eee8aa";
colour_names.palegreen = "98fb98";
colour_names.paleturquoise = "afeeee";
colour_names.palevioletred = "db7093";
colour_names.papayawhip = "ffefd5";
colour_names.peachpuff = "ffdab9";
colour_names.peru = "cd853f";
colour_names.pink = "ffc0cb";
colour_names.plum = "dda0dd";
colour_names.powderblue = "b0e0e6";
colour_names.purple = "800080";
colour_names.rebeccapurple = "663399";
colour_names.red = "ff0000";
colour_names.rosybrown = "bc8f8f";
colour_names.royalblue = "4169e1";
colour_names.saddlebrown = "8b4513";
colour_names.salmon = "fa8072";
colour_names.sandybrown = "f4a460";
colour_names.seagreen = "2e8b57";
colour_names.seashell = "fff5ee";
colour_names.sienna = "a0522d";
colour_names.silver = "c0c0c0";
colour_names.skyblue = "87ceeb";
colour_names.slateblue = "6a5acd";
colour_names.slategray = "708090";
colour_names.slategrey = "708090";
colour_names.snow = "fffafa";
colour_names.springgreen = "00ff7f";
colour_names.steelblue = "4682b4";
colour_names.tan = "d2b48c";
colour_names.teal = "008080";
colour_names.thistle = "d8bfd8";
colour_names.tomato = "ff6347";
colour_names.turquoise = "40e0d0";
colour_names.violet = "ee82ee";
colour_names.wheat = "f5deb3";
colour_names.white = "ffffff";
colour_names.whitesmoke = "f5f5f5";
colour_names.yellow = "ffff00";
colour_names.yellowgreen = "9acd32";
 
function colourCompliance(bground,fground){
var ratio;
bground = bground.trim().toLowerCase();;
if (colour_names[bground]) bground = colour_names[bground];
if (fground === false) {
        var ratio_w = getColorsRatio(bground,'FFFFFF');
        var ratio_b = getColorsRatio(bground,'000000');
        fground = (ratio_w > ratio_b ? 'FFFFFF' : '000000');
        ratio = (ratio_w > ratio_b ? ratio_w : ratio_b);
} else {
ratio = getColorsRatio(bground,fground);
}
 
if (ratio <= 7) {
hsv = RGBtoHSV(br,bg,bb);
bh = hsv.h; bs = hsv.s; bv = hsv.v;
if (bv < 100 && bv > 0) {
bv += (fground == 'FFFFFF' ? -1 : 1);
} else {
bs += (fground == 'FFFFFF' ? 1 : -1);
}
}
var new_bground = HSVtoRGB(bh,bs,bv);
navFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar );
new_bground = RGBtoHEX(new_bground[0],new_bground[1],new_bground[2]);
} );
return colourCompliance(new_bground,fground,false);
} else {
if (bground.length == 3) bground = bground[0]+bground[0]+bground[1]+bground[1]+bground[2]+bground[2];
return bground.toUpperCase();
}
}
}


function getColorsRatio(bground,fground) {
mw.hook( 'wikipage.content' ).add( createNavigationBarToggleButton );
    var bgroundH = HEXtoRGB(bground);
    var fgroundH = HEXtoRGB(fground);
   
br = bgroundH.r; bg = bgroundH.g; bb = bgroundH.b;
    fr = fgroundH.r; fg = fgroundH.g; fb = fgroundH.b;
var ratio = 1;
var l1 = getLuminance([fr/255, fg/255, fb/255]);
var l2 = getLuminance([br/255, bg/255, bb/255]);


if (l1 >= l2) {
/**
ratio = (l1 + 0.05) / (l2 + 0.05);
* Magic editintros ****************************************************
} else {
*
ratio = (l2 + 0.05) / (l1 + 0.05);
* Description: Adds editintros on disambiguation pages and BLP pages.
}
* Maintainers: [[User:RockMFR]]
ratio = Math.round(ratio * 100) / 100;
*/
function addEditIntro( name ) {
return ratio;
$( '.mw-editsection, #ca-edit, #ca-ve-edit' ).find( 'a' ).each( function ( i, el ) {
el.href = $( this ).attr( 'href' ) + '&editintro=' + name;
} );
}
}


function getLuminance(rgb){
if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) {
for (var i = 0; i < rgb.length; i++) {
$( function () {
if (rgb[i] <= 0.03928) {
if ( document.getElementById( 'disambigbox' ) ) {
rgb[i] = rgb[i] / 12.92;
addEditIntro( 'Template:Disambig_editintro' );
} else {
rgb[i] = Math.pow( ((rgb[i]+0.055)/1.055), 2.4 );
}
}
}
} );
var l = (0.2126 * rgb[0]) + (0.7152 * rgb[1]) + (0.0722 * rgb[2]);
return l;
}


function componentToHex(c) {
$( function () {
    var hex = parseInt(c).toString(16).toUpperCase();
var cats = mw.config.get('wgCategories');
    return hex.length == 1 ? "0" + hex : hex;
if ( !cats ) {
return;
}
if ( $.inArray( 'Living people', cats ) !== -1 || $.inArray( 'Possibly living people', cats ) !== -1 ) {
addEditIntro( 'Template:BLP_editintro' );
}
} );
}
}


function RGBtoHEX(r, g, b) {
/* Actions specific to the edit page */
    return componentToHex(r) + componentToHex(g) + componentToHex(b);
if ( mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit' ) {
}
/**
 
* Fix edit summary prompt for undo
function HEXtoRGB(hex) {
*
if (hex.length == 6) {
*  Fixes the fact that the undo function combined with the "no edit summary prompter"
return {
*  complains about missing editsummary, if leaving the edit summary unchanged.
r: parseInt(hex[0]+''+hex[1], 16),
*  Added by [[User:Deskana]], code by [[User:Tra]].
g: parseInt(hex[2]+''+hex[3], 16),
*  See also [[phab:T10912]].
b: parseInt(hex[4]+''+hex[5], 16)
*/
};
$(function () {
} else {
if (document.location.search.indexOf('undo=') !== -1 && document.getElementsByName('wpAutoSummary')[0]) {
return {
document.getElementsByName('wpAutoSummary')[0].value = '1';
r: parseInt(hex[0]+''+hex[0], 16),
}
g: parseInt(hex[1]+''+hex[1], 16),
});
b: parseInt(hex[2]+''+hex[2], 16)
};
}
}
}


function RGBtoHSV() {
/* End of mw.loader.using callback */
    var rr, gg, bb,
} );
        r = arguments[0] / 255,
/* DO NOT ADD CODE BELOW THIS LINE */
        g = arguments[1] / 255,
        b = arguments[2] / 255,
        h, s,
        v = Math.max(r, g, b),
        diff = v - Math.min(r, g, b),
        diffc = function(c){
            return (v - c) / 6 / diff + 1 / 2;
        };
 
    if (diff === 0) {
        h = s = 0;
    } else {
        s = diff / v;
        rr = diffc(r);
        gg = diffc(g);
        bb = diffc(b);
 
        if (r === v) {
            h = bb - gg;
        }else if (g === v) {
            h = (1 / 3) + rr - bb;
        }else if (b === v) {
            h = (2 / 3) + gg - rr;
        }
        if (h < 0) {
            h += 1;
        }else if (h > 1) {
            h -= 1;
        }
    }
    return {
        h: Math.round(h * 360),
        s: Math.round(s * 100),
        v: Math.round(v * 100)
    };
}
 
function HSVtoRGB(h,s,v) {
    s = s / 100,
v = v / 100;
 
    var hi = Math.floor((h/60) % 6);
    var f = (h / 60) - hi;
    var p = v * (1 - s);
    var q = v * (1 - f * s);
    var t = v * (1 - (1 - f) * s);
 
    var rgb = [];
 
    switch (hi) {
        case 0: rgb = [v,t,p];break;
        case 1: rgb = [q,v,p];break;
        case 2: rgb = [p,v,t];break;
        case 3: rgb = [p,q,v];break;
        case 4: rgb = [t,p,v];break;
        case 5: rgb = [v,p,q];break;
    }
 
    var r = Math.min(255, Math.round(rgb[0]*256)),
        g = Math.min(255, Math.round(rgb[1]*256)),
        b = Math.min(255, Math.round(rgb[2]*256));
 
    return [r,g,b];
 
}
 
function RGBSTRtoHEX(rgb) {
if (colour_names[rgb]) return '#'+colour_names[rgb];
rgb = rgb.split(',');
rgb.r=parseInt(rgb[0].substring(4)).toString(16);
rgb.g=parseInt(rgb[1]).toString(16);
rgb.b=parseInt(rgb[2]).toString(16);
var hex="#"+(rgb.r.length==1?'0':'')+rgb.r+(rgb.g.length==1?'0':'')+rgb.g+(rgb.b.length==1?'0':'')+rgb.b;
return hex.toUpperCase();
}
 
function copyContent(text) {
var textArea = document.createElement("textarea");
textArea.innerHTML = text;
document.body.appendChild(textArea);
textArea.select();
if (!document.execCommand('copy')) console.log(text);
document.body.removeChild(textArea);
}
 
function newContentHeader(title,id) {
var div = document.createElement('div');
div.className = 'portal';
div.setAttribute('role','navigation');
div.setAttribute('id',id);
div.setAttribute('aria-labelledby','p-tb-label');
document.getElementById('p-tb').parentNode.insertBefore(div, document.getElementById('p-tb').nextSibling);
 
var h3 = document.createElement('h3');
h3.id = id+'-label';
h3.innerHTML = title;
document.getElementById(id).appendChild(h3);
 
var divB = document.createElement('div');
divB.className = 'body';
document.getElementById(id).appendChild(divB);
}
 
newContentHeader('TV Tools','p-tv');
 
 
/* Based on https://en.wikipedia.org/wiki/User:Alex_21/script-redlinks.js */
 
$(document).ready( function () {
    // Remove redlinks if they exist upon pageload
    redlinks_removeall();
});
$(function($) {
mw.loader.using( ['mediawiki.util'] ).then( function () {
var portletlink = mw.util.addPortletLink('p-tb', '#', 'Remove redlinks');
$(portletlink).click( function(e) {
e.preventDefault();
// Default parameters, and begin script on regular view of article
var loc = window.location.href;
var redlinks; var i;
// Gather all redlinks with class "new"
redlinks = [];
var a = document.getElementsByTagName('a');
for (i = 0; i < a.length; i++) {
if (a[i].getAttribute('class') == "new") {
redlinks[redlinks.length] = a[i].href.replace('https://de.pornopedia.com/w/index.php?title=','').replace('&action=edit&redlink=1','');
redlinks[redlinks.length-1] = redlinks[redlinks.length-1].replace(/_/g,' ');
redlinks[redlinks.length-1] = decodeURIComponent(redlinks[redlinks.length-1]);
}
}
// Save all redlinks
if (redlinks.length > 0) {
localStorage.redlinks = JSON.stringify(redlinks);
// If we are in the edit page, then remove redlinks automatically; if we are on the reading page, then go to the edit page
if (window.location.href.indexOf('action') >= 0) redlinks_removeall();
else window.location = window.location.href.substr(0, window.location.href.indexOf('#'))+"?action=edit";
} else {
alert('No redlinks!');
}
});
});
});
 
function redlinks_removeall() {
// Automatic removal of redlinks when stored.
    if (localStorage.redlinks !== "" && localStorage.redlinks !== undefined) {
// Gather saved redlinks
var redlinks = JSON.parse(localStorage.redlinks);
// Regular expression to escape special characters
var totalredlinks = 0;
RegExp.quote = function(str) { return str.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&"); };
var wpTextbox1 = document.getElementById('wpTextbox1');
for (i = 0; i < redlinks.length; i++) {
// Regular expression for piped links and direct links
var reglink1 = new RegExp('\\[\\[\\s*('+RegExp.quote(redlinks[i]).replace(/\s/g, "[\\s\\_]*")+')\\s*\\|\\s*([^\\]]*)\\s*\\]\\]','gi');
var reglink2 = new RegExp('\\[\\[\\s*('+RegExp.quote(redlinks[i]).replace(/\s/g, "[\\s\\_]*")+')\\s*\\]\\]','gi');
// Add total number of matches for both
if (wpTextbox1.value.match(reglink1) !== null) totalredlinks += wpTextbox1.value.match(reglink1).length;
if (wpTextbox1.value.match(reglink2) !== null) totalredlinks += wpTextbox1.value.match(reglink2).length; // Includes categories
// Remove category rather than simply convert it to unlinked text
if (redlinks[i].substr(0,9) == "Category:") {
var reglink3 = new RegExp('\\[\\[\\s*('+RegExp.quote(redlinks[i])+')\\s*\\]\\]\\n','gi');
wpTextbox1.value = wpTextbox1.value.replace(reglink3,"");
}
// Remove redlinks and convert to unlinked text
wpTextbox1.value = wpTextbox1.value.replace(reglink1,"$2");
wpTextbox1.value = wpTextbox1.value.replace(reglink2,"$1");
}
// Alert for summary of removed redlinks; total in edit summary
if (totalredlinks > 0) {
document.getElementById('wpSummary').value += "Removed "+totalredlinks+" redlink"+(totalredlinks==1?"":"s")+" via [[User:Till Kraemer/script-redlinks|script]].";
alert("Automatically removed "+totalredlinks+" redlink"+(totalredlinks==1?"":"s")+"!");
} else {
// Redlinks were seen in the article but none were found in the wikicode - check the nevigational boxes for these redlinks
alert('No redlinks in the article! (Check transcluded templates and the navigational boxes.)');
}
// Remove the template(s)
wpTextbox1.value = wpTextbox1.value.replace(/\{\{[Cc]leanup-?\s*[Rr]ed\s*[Ll]inks?[^\}]*\}\}/g, "");
wpTextbox1.value = wpTextbox1.value.replace(/\{\{[Rr]ed\s*links?[^\}]*\}\}/g, "");
wpTextbox1.value = wpTextbox1.value.replace(/\{\{[Tt]oo many red links[^\}]*\}\}/g, "");
// Clear all saved redlinks
localStorage.redlinks = '';
}
}

Aktuelle Version vom 2. Juni 2019, 12:57 Uhr

/* Any JavaScript here will be loaded for all users on every page load. */

/* From https://en.wikipedia.org/wiki/MediaWiki:Common.js */
/**
 * 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.user', 'mediawiki.util', 'mediawiki.notify'] ).done( function () {
/* Begin of mw.loader.using callback */

/**
 * 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 ( mw.config.get( 'wgPageName' ) === 'Main_Page' || mw.config.get( 'wgPageName' ) === 'Talk:Main_Page' ) {
	$( function () {
		mw.util.addPortletLink( 'p-lang', '//meta.wikimedia.org/wiki/List_of_Wikipedias',
			'Complete list', 'interwiki-completelist', 'Complete list of Wikipedias' );
	} );
}

/**
 * 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.getUrl( userSkinPage + '.js' );
		} else if ( titleParts.slice( -1 ) == 'skin.css' ) {
			window.location.href = mw.util.getUrl( userSkinPage + '.css' );
		}
	}
}

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

/**
 * Extract a URL parameter from the current URL
 * @deprecated: Use mw.util.getParamValue with proper escaping
 */
mw.log.deprecate( window, 'getURLParamValue', mw.util.getParamValue, 'Use mw.util.getParamValue instead' );

/**
 * Test if an element has a certain class
 * @deprecated:  Use $(element).hasClass() instead.
 */
mw.log.deprecate( window, 'hasClass', function ( element, className ) {
	return $( element ).hasClass( className );
}, 'Use jQuery.hasClass() 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 meta because it is used by many projects.
 *              See [[Meta:WikiMiniAtlas]] for more information.
 * Note - use of this service is recommended to be repalced with mw:Help:Extension:Kartographer
 */
( function () {
	var require_wikiminiatlas = false;
	var coord_filter = /geohack/;
	$( function () {
		$( 'a.external.text' ).each( function( key, link ) {
			if ( link.href && coord_filter.exec( link.href ) ) {
				require_wikiminiatlas = true;
				// break from loop
				return false;
			}
		} );
		if ( $( 'div.kmldata' ).length ) {
			require_wikiminiatlas = true;
		}
		if ( require_wikiminiatlas ) {
			mw.loader.load( '//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript' );
		}
	} );
} )();

/**
 * Collapsible tables; reimplemented with mw-collapsibe
 * 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
 */
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
			if( $toggle.parent()[0].style.color ) {
				$toggle.find( 'a' ).css( 'color', 'inherit' );
			}
		}
	} );
}

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

/**
 * Dynamic Navigation Bars (experimental)
 *
 * Description: See [[Wikipedia:NavFrame]].
 * Maintainers: UNMAINTAINED
 */
 
var collapseCaption = 'hide';
var expandCaption = 'show';

// Set up the words in your language
var navigationBarHide = '[' + collapseCaption + ']';
var navigationBarShow = '[' + expandCaption + ']';

/**
 * Shows and hides content and picture (if available) of navigation bars.
 *
 * @param {number} indexNavigationBar The index of navigation bar to be toggled
 * @param {jQuery.Event} event Event object
 */
function toggleNavigationBar( indexNavigationBar, event ) {
	var navToggle = document.getElementById( 'NavToggle' + indexNavigationBar );
	var navFrame = document.getElementById( 'NavFrame' + indexNavigationBar );
	var navChild;

	if ( !navFrame || !navToggle ) {
		return false;
	}

	// If shown now
	if ( navToggle.firstChild.data === navigationBarHide ) {
		for ( navChild = navFrame.firstChild; navChild !== null; navChild = navChild.nextSibling ) {
			if ( $( navChild ).hasClass( 'NavContent' ) ) {
				navChild.style.display = 'none';
			}
		}
		navToggle.firstChild.data = navigationBarShow;
	
	// If hidden now
	} else if ( navToggle.firstChild.data === navigationBarShow ) {
		for ( navChild = navFrame.firstChild; navChild !== null; navChild = navChild.nextSibling ) {
			if ( $( navChild ).hasClass( 'NavContent' ) ) {
				navChild.style.display = 'block';
			}
		}
		navToggle.firstChild.data = navigationBarHide;
	}

	event.preventDefault();
}

/**
 * Adds show/hide-button to navigation bars.
 *
 * @param {jQuery} $content
 */
function createNavigationBarToggleButton( $content ) {
	var i, j, navChild, navToggle, navToggleText, isCollapsed,
		indexNavigationBar = 0;
	// Iterate over all < div >-elements
	var $divs = $content.find( 'div.NavFrame:not(.mw-collapsible)' );
	$divs.each( function ( i, navFrame ) {
		indexNavigationBar++;
		navToggle = document.createElement( 'a' );
		navToggle.className = 'NavToggle';
		navToggle.setAttribute( 'id', 'NavToggle' + indexNavigationBar );
		navToggle.setAttribute( 'href', '#' );
		$( navToggle ).on( 'click', $.proxy( toggleNavigationBar, null, indexNavigationBar ) );

		isCollapsed = $( navFrame ).hasClass( '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 ( navChild = navFrame.firstChild; navChild !== null && !isCollapsed; navChild = navChild.nextSibling ) {
			if ( $( navChild ).hasClass( 'NavPic' ) || $( navChild ).hasClass( 'NavContent' ) ) {
				if ( navChild.style.display === 'none' ) {
					isCollapsed = true;
				}
			}
		}
		if ( isCollapsed ) {
			for ( navChild = navFrame.firstChild; navChild !== null; navChild = navChild.nextSibling ) {
				if ( $( navChild ).hasClass( 'NavPic' ) || $( navChild ).hasClass( 'NavContent' ) ) {
					navChild.style.display = 'none';
				}
			}
		}
		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 ( j = 0; j < navFrame.childNodes.length; j++ ) {
			if ( $( navFrame.childNodes[j] ).hasClass( 'NavHead' ) ) {
				navToggle.style.color = navFrame.childNodes[j].style.color;
				navFrame.childNodes[j].appendChild( navToggle );
			}
		}
		navFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar );
	} );
}

mw.hook( 'wikipage.content' ).add( createNavigationBarToggleButton );

/**
 * Magic editintros ****************************************************
 *
 * Description: Adds editintros on disambiguation pages and BLP pages.
 * Maintainers: [[User:RockMFR]]
 */
function addEditIntro( name ) {
	$( '.mw-editsection, #ca-edit, #ca-ve-edit' ).find( 'a' ).each( function ( i, el ) {
		el.href = $( this ).attr( 'href' ) + '&editintro=' + name;
	} );
}

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

	$( function () {
		var cats = mw.config.get('wgCategories');
		if ( !cats ) {
			return;
		}
		if ( $.inArray( 'Living people', cats ) !== -1 || $.inArray( 'Possibly living people', cats ) !== -1 ) {
			addEditIntro( 'Template:BLP_editintro' );
		}
	} );
}

/* Actions specific to the edit page */
if ( mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit' ) {
	/**
	 * Fix edit summary prompt for undo
	 *
	 *  Fixes the fact that the undo function combined with the "no edit summary prompter"
	 *  complains about missing editsummary, if leaving the edit summary unchanged.
	 *  Added by [[User:Deskana]], code by [[User:Tra]].
	 *  See also [[phab:T10912]].
	 */
	$(function () {
		if (document.location.search.indexOf('undo=') !== -1 && document.getElementsByName('wpAutoSummary')[0]) {
			document.getElementsByName('wpAutoSummary')[0].value = '1';
		}
	});
}

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