MediaWiki:Common.js: Różnice pomiędzy wersjami

Z Minecraft Wiki Polska
Przejdź do nawigacji Przejdź do wyszukiwania
Ivan-r (dyskusja | edycje)
dNie podano opisu zmian
dNie podano opisu zmian
 
(Nie pokazano 52 wersji utworzonych przez 5 użytkowników)
Linia 8: Linia 8:
  var oldEditsectionLinks=true;
  var oldEditsectionLinks=true;
*/
*/
/* ( function() {
 
( function() {
'use strict';
'use strict';
*/
 
/* Variables for interface text used throughout the script, for ease of translating */
/** Variables for interface text used throughout the script, for ease of translating */
var i18n = {
var i18n = {
// Collapsible elements and page loader
// Collapsible elements and page loader
hideText: 'скрыть',
hideText: 'ukryj',
showText: 'показать',
showText: 'pokaż',
// Page loader
// Page loader
Linia 21: Linia 22:
// File upload
// File upload
defaultLicense: 'License'
defaultLicense: 'Licencja'
};
};
/**
* Instead of cluttering up the global scope with
* variables, they should instead be set as a
* property of this global variable
*
* E.g: Instead of
*  myVar = 'blah';
* use
*  mcw.myVar = 'blah';
*/
var mcw = window.mcw = {};
mw.hook( 'wikipage.content' ).add( function( $wikipageContent ) {
// Ukrywa przyciski jeśli brakuje na nie miejsca
$("li[id*='ca-watch']").addClass('collapsible');
$("li[id*='ca-unwatch']").addClass('collapsible');
$("li[id*='ca-edit']").addClass('collapsible');
$("li[id*='ca-view']").addClass('collapsible');
$("li[id*='ca-ve-edit']").addClass('collapsible');
$("li[id*='ca-viewsource']").addClass('collapsible');


/**
/**
Linia 147: Linia 170:
// End Collapsible function
// End Collapsible function


/*
/**
    Dodawanie ciasteczek wygasających po pewnym czasie
* Element animator
*
* Will cycle the active class on any child elements
* within an element with the animated class.
*/
( function() {
if ( !mcw.animate ) {
mcw.animate = setInterval( function() {
$( '.animated' ).each( function() {
var $elem = $( this );
var $current = $elem.children( '.active' );
var $next = $current.nextAll( ':not(.skip):first' );
// Loop back to the start
if ( !$next.length ) {
$next = $elem.children( ':not(.skip):first' );
}
$current.removeClass( 'active' );
$next.addClass( 'active' );
} );
}, 2000 );
}
}() );


    name - nazwa ciasteczka
    value - wartość do ustawienia
   
    // opcje (wszystkie opcjonalne)
    options = {days:7, path:'/'}    // defaults
*/
function addLongTermCookie(name, value, options)
{
    // options
    if (typeof(options)!='object')
    {
        options = new Object();
    }
    var days = (options.days) ? options.days : 7;
    var path = (options.path) ? options.path : '/';
   
    // setup date
    var dt = new Date();
    dt = new Date(dt.getTime()+days*24*3600000); //(ilość sekund * 1000)
   
    // set
    document.cookie = name+"="+value+"; path="+path+"; expires=" + dt.toGMTString();
}


/*
/**
==== funkcja insertTagsTo_ ====
* Page loader
; Author: phpBB Team, WikiMedia, Maciej Jaros [[:pl:User:Nux]]
*
; Licence: [http://opensource.org/licenses/gpl-license.php GNU General Public License v2]
* Allows a page to be downloaded and displayed on demand.
; Description: Apply tagOpen/tagClose to selection in given textarea/input, use sampleText instead of selection if there is none. Copied and adapted from phpBB
* Use with [[Template:LoadPage]] and [[Template:LoadBox]]
*/
*/
// outputid = 'some_id_of_a_textarea_or_a_text_input'
( function() {
function insertTagsTo_(tagOpen, tagClose, sampleText, outputid) {
var $loadPage = $wikipageContent.find( '.load-page' );
    var txtarea = document.getElementById(outputid);
if ( !$loadPage.length ) {
    if (!txtarea)
return;
        return
}
    ;
// We need the spinner to show loading is happening, but we don't want
// to have a delay while the module downloads, so we'll load this now,
// regardless of if something is clicked
mw.loader.load( 'jquery.spinner' );
// Create button starting with hide text
// Will be changed to the show text while calculating the maximum button size
var $buttonTemplate = $( '<span>' ).addClass( 'mw-editsection-like load-page-button' )
.append( '[', $( '<span>' ).addClass( 'jslink' ).text( i18n.hideText ), ']' );
var extractList = function( $contentContainer, listClass ) {
var $content = $contentContainer.find( '> ul > li > ul' ).children( ':not(.nbttree-inherited)' );
if ( listClass ) {
$content.addClass( listClass );
}
return $content;
};
$loadPage.each( function() {
var $body = $( this );
var page = $body.data( 'page' );
if ( !page ) {
return;
}
var template = $body.data( 'template' );
var treeview = $body.data( 'treeview' );
var treeviewClass = $body.data( 'treeviewclass' );
var $heading;
var $contentContainer;
var $content;
var $button = $buttonTemplate.clone();
var $buttonLink = $button.find( '.jslink' );
if ( treeview ) {
$heading = $body;
$contentContainer = $( '<div>' );
} else {
$heading = $body.children().first();
$contentContainer = $body.find( '.load-page-content' );
}
// Add the button
$heading.append( $button );
// Move the edit button to the right spot
$contentContainer.find( '.mw-editsection, .mw-editsection-like' ).insertAfter( $button );
// Find max button width, and set its min-width to it
var hideWidth = $button.width();
$buttonLink.text( i18n.showText );
var showWidth = $button.width();
if ( hideWidth !== showWidth ) {
$button.css( 'min-width', hideWidth > showWidth ? hideWidth : showWidth );
}
$buttonLink.click( function() {
if ( $body.hasClass( 'pageloader-contentloaded' ) ) {
if ( $buttonLink.text() === i18n.showText ) {
if ( treeview ) {
$content.insertAfter( $body );
} else {
$contentContainer.show();
}
$buttonLink.text( i18n.hideText );
} else {
if ( treeview ) {
$content.detach();
} else {
$contentContainer.hide();
}
$buttonLink.text( i18n.showText );
}
return;
}
// See if this was loaded elsewhere before making a request
var gotContent;
$( '.pageloader-contentloaded' ).each( function() {
var $fLoader = $( this );
if ( $fLoader.data( 'page' ) === page && $fLoader.data( 'mw-pageloader-content' ) ) {
$contentContainer.html( $fLoader.data( 'mw-pageloader-content' ) ).removeClass( 'noscript' );
mw.hook( 'wikipage.content' ).fire( $contentContainer );
if ( treeview ) {
$body.find( '.noscript' ).remove();
$content = extractList( $contentContainer, treeviewClass );
$content.insertAfter( $body );
}
$buttonLink.text( i18n.hideText );
$body.addClass( 'pageloader-contentloaded' );
gotContent = true;
return false;
}
} );
if ( gotContent ) {
return;
}
// Just in-case the spinner module is still not ready yet
var $spinner = $();
mw.loader.using( 'jquery.spinner', function() {
// $spinner will be false if the content somehow loaded before the module did
if ( $spinner ) {
$spinner = $.createSpinner().addClass( 'mw-editsection-like' )
.css( 'min-width', $button.css( 'min-width' ) );
$button.hide().after( $spinner );
}
} );
var requestData = {
action: 'parse',
prop: 'text'
};
if ( template ) {
requestData.page = page;
} else {
requestData.title = mw.config.get( 'wgPageName' );
requestData.text = '{' + '{:' + page + '}}';
}
new mw.Api().get( requestData ).done( function( data ) {
var html = data.parse.text['*'];
$contentContainer.html( html ).removeClass( 'noscript' );
// Resolve self-links
if ( template ) {
var curPage = '/' + mw.config.get( 'wgPageName' );
$contentContainer.find( 'a' ).each( function() {
var $link = $( this );
if ( $link.attr( 'href' ) === curPage ) {
$link.replaceWith( $( '<strong>' ).addClass( 'selflink' ).append( $link.contents() ) );
}
} );
html = $contentContainer.html();
}
$body.data( 'mw-pageloader-content', html );
// Fire content hook on the new content, running all this stuff again and more :)
mw.hook( 'wikipage.content' ).fire( $contentContainer );
if ( treeview ) {
$body.find( '.noscript' ).remove();
$content = extractList( $contentContainer, treeviewClass );
$content.insertAfter( $body );
}
$spinner.remove();
$spinner = false;
$buttonLink.text( i18n.hideText );
$button.show();
$body.addClass( 'pageloader-contentloaded' );
} ).fail( function( _, error ) {
$spinner.remove();
$spinner = false;
$button.show();
var errorText = '';
if ( error.textStatus ) {
errorText = error.textStatus;
} else if ( error.error ) {
errorText = error.error.info;
}
mw.notify( errorText, { title: i18n.loadErrorTitle, autoHide: false } );
} );
} );
} );
}() );


    // IE
( function() {
    if (document.selection  && !is_gecko) {
        var theSelection = document.selection.createRange().text;
$('div.mw-body-content > ul > li > a.mw-userlink[href*="U%C5%BCytkownik:Filtr_nadu%C5%BCy%C4%87"]').closest('li').hide();
        if (!theSelection)
            theSelection=sampleText;
/** dofollow (plainlinks) */
        txtarea.focus();
$wikipageContent.find('span.dofollow > a').each(function()
        if (theSelection.charAt(theSelection.length - 1) == " ") { // exclude ending space char, if any
{
            theSelection = theSelection.substring(0, theSelection.length - 1);
$(this).removeAttr('rel');
            document.selection.createRange().text = tagOpen + theSelection + tagClose + " ";
});
        } else {
            document.selection.createRange().text = tagOpen + theSelection + tagClose;
/** allow robots */
        }
if($wikipageContent.find('div#allowrobots').length || mw.config.get('wgPageName') == 'Specjalna:Ostatnie_zmiany')
{
$('head > meta[name=robots]').attr('content', 'all,max-image-preview:standard');
}
/** metadesc (description) */
var $meta = $('head > meta[name=description]');
$wikipageContent.find('span#metadesc').each(function()
{
$meta.attr('content', $(this).text());
$(this).remove();
});
/** NoTitle */
$wikipageContent.find('span#notitle').each(function()
{
mw.loader.addStyleTag('body.mediawiki > div#content > h1#firstHeading { display:none; }');
$(this).remove();
});
var $indicators = $('body.skin-vector-legacy > #content > .mw-indicators');
if($indicators.length)
$indicators.parent().find('h1#firstHeading').each(function()
{
$indicators.css('display', $(this).css('display'));
});
} () );


    // Mozilla
} );
    } else if(txtarea.selectionStart || txtarea.selectionStart == '0') {
/* End wiki content hook */
        var replaced = false;
        var startPos = txtarea.selectionStart;
        var endPos = txtarea.selectionEnd;
        if (endPos-startPos)
            replaced = true;
        var scrollTop = txtarea.scrollTop;
        var myText = (txtarea.value).substring(startPos, endPos);
        if (!myText)
            myText=sampleText;
        if (myText.charAt(myText.length - 1) == " ") { // exclude ending space char, if any
            subst = tagOpen + myText.substring(0, (myText.length - 1)) + tagClose + " ";
        } else {
            subst = tagOpen + myText + tagClose;
        }
        txtarea.value = txtarea.value.substring(0, startPos) + subst +
            txtarea.value.substring(endPos, txtarea.value.length);
        txtarea.focus();
        //set new selection
        if (replaced) {
            var cPos = startPos+(tagOpen.length+myText.length+tagClose.length);
            txtarea.selectionStart = cPos;
            txtarea.selectionEnd = cPos;
        } else {
            txtarea.selectionStart = startPos+tagOpen.length;
            txtarea.selectionEnd = startPos+tagOpen.length+myText.length;
        }
        txtarea.scrollTop = scrollTop;
    }
    // reposition cursor if possible
    if (txtarea.createTextRange)
        txtarea.caretPos = document.selection.createRange().duplicate();
}


/*
/** Fires when DOM is ready */
==== Dodanie linka [edytuj] dla sekcji nagłówkowej ====
$( function() {
; Pomysł: [[:en:User:Pile0nades]]
; Wykonanie: Maciej Jaros [[:pl:User:Nux]]
; Licencja: [http://opensource.org/licenses/gpl-license.php GNU General Public License v2]
*/
// Liczba nagłówków drugiego, trzeciego i czwartego stopnia
// jakie muszą się pojawić w artykule, żeby pojawił się link
/* var addEditTopLinkNumHeaders = 2;  dla 2 => dla dwóch i więcej się pojawi
function addEditTopLink() {
    //
    // somehow it gets run twice on some pages - stop that
    if (window.addEditTopLinkDone)
        return
    ;
    window.addEditTopLinkDone = true;
 
    //   
    // if this is preview page or there is no edit tab, stop
    if (!wgIsArticle)
        return
    ;
 
    //   
    // if there are no edit-section links then stop
    var spans = document.getElementById("bodyContent").getElementsByTagName("span");
    var i;
    for (i = 0; i < spans.length; i++) {
        if (spans[i].className == 'editsection')
            break
        ;
    }
    if (i>=spans.length)
        return
    ;
 
    //
    // additional checkup to stop
    var test = document.getElementById("bodyContent").getElementsByTagName("h2").length +
        document.getElementById("bodyContent").getElementsByTagName("h3").length +
        document.getElementById("bodyContent").getElementsByTagName("h4").length;
    // note that there is always siteSub (h3)
    if (test<=addEditTopLinkNumHeaders)
        return
    ;
   
    //
    // get first header element
    var fst_h1 = document.getElementById("content").getElementsByTagName("h1")[0];
 
    //
    // Creating elements
    //
    // create div
    var div = document.createElement("DIV");
    div.className = 'editsection';
    // create link
    var link = document.createElement("A");
    link.href = document.getElementById("ca-edit").getElementsByTagName("a")[0].href + '&section=0';
    link.setAttribute('title', 'edytuj sekcję nagłówkową artykułu');
    link.appendChild(document.createTextNode('edytuj'));
    // append link and stuff to div
    div.appendChild(document.createTextNode('['));
    div.appendChild(link);
    div.appendChild(document.createTextNode(']'));


    //
    // Styling
    //
    div.style.cssText = 'padding:.7em 0 0 1.0em; float:right; font-size:x-small;';


    //
/**  
    // Insert edit div into h1 and content of h1 to div (it has to be like that so that FF doesn't select the edit link on double click)
* Fix edit summary prompt for undo
    //
    var div_h1 = document.createElement("div");
    // move children
    while(fst_h1.childNodes.length)
    {
        div_h1.appendChild(fst_h1.firstChild)
    }
    fst_h1.appendChild(div);    // edit link
    fst_h1.appendChild(div_h1);    // previous h1 content
}
if (skin=='vector' || skin=='monobook')
{
    addOnloadHook(addEditTopLink);
}
*/
/*
== Przesunięcie linków [ edytuj ] przy sekcjach ==
; Autor: Copyright 2006, Marc Mongenet
; Opis: Wyszukuje &lt;span class="editsection"> i przesuwa na koniec ich rodzica (nagłówka sekcji) wyświetlając ''inline'' ze zmniejszoną czcionką.
; Licencja:
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
 
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 
http://www.gnu.org/licenses/gpl.html
*/
addOnloadHook(function() {
try {
    if (!(typeof oldEditsectionLinks == 'undefined' || oldEditsectionLinks == false)) return;
    var spans = document.getElementsByTagName("span");
    for (var s = 0; s < spans.length; ++s) {
        var span = spans[s];
        if (span.className == "editsection") {
            span.style.cssText = 'float:none; font-size:x-small; font-weight: normal;';
            span.parentNode.appendChild(document.createTextNode(" "));
            span.parentNode.appendChild(span);
        }
    }
} catch (e) { /* błąd */ }
});
 
 
/** Interwiki links to featured articles ***************************************
  *
  *
  * Description: Highlights interwiki links to featured articles (or
  * Fixes the fact that the undo function combined with the "no edit summary prompter"
*              equivalents) by changing the bullet before the interwiki link
  * causes problems if leaving the edit summary unchanged.
  *               into a star.
  * Added by [[wikipedia:User:Deskana]], code by [[wikipedia:User:Tra]].
  * Maintainers: [[User:R. Koot]]
* See https://bugzilla.wikimedia.org/show_bug.cgi?id=8912
  */
  */
 
if ( document.location.search.indexOf( "undo=" ) !== -1 && document.getElementsByName( 'wpAutoSummary' )[0] ) {
function LinkFA()
document.getElementsByName( 'wpAutoSummary' )[0].value='1';
{
    if ( window.LinkFADone )
        return;
   
    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 = "Artykuł w tym języku jest na medal";
            }
            else if ( document.getElementById( InterwikiLinks[i].className + "-ga" ) ) {
                InterwikiLinks[i].className += " GArt"
                InterwikiLinks[i].title = "Artykuł w tym języku jest dobrym artykułem";
            }
        }
    }
   
    window.LinkFADone = true;
}
}
addOnloadHook( LinkFA );


/* 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);
    };
})();


/** Collapsible tables *********************************************************
/**
  *
* Pause grid GUI templates (e.g. [[Template:Grid/Crafting Table]]) on mouseover
  *  Description: Allows tables to be collapsed, showing only the header. See
  *              [[en:Wikipedia:NavFrame]].
  *  Maintainers: [[User:R. Koot]]
  */
/*
var autoCollapse = 2;
var collapseCaption = "ukryj";
var expandCaption = "pokaż";
 
 
function createCollapseButtons()
{
    var tableIndex = 0;
    var NavigationBoxes = new Object();
    var Tables = document.getElementsByTagName( "table" );
 
    for ( var i = 0; i < Tables.length; i++ ) {
       
    }
 
    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 );
 
*/
/** Dynamic Navigation Bars (experimental) *************************************
  *
  *
  * Description: See [[Wikipedia:NavFrame]].
  * This is so people have a chance to look at each image on the cell
  * Maintainers: UNMAINTAINED
  * and click on pages they want to view.
  */
  */
/*
$( '#mw-content-text' ).on( {
// set up the words in your language
'mouseenter': function() {  
var NavigationBarHide = '[' + collapseCaption + ']';
$( this ).find( '.animated' ).removeClass( 'animated' ).addClass( 'paused' );
var NavigationBarShow = '[' + expandCaption + ']';
},
 
'mouseleave': function() {
// shows and hides content and picture (if available) of navigation bars
$( this ).find( '.paused' ).removeClass( 'paused' ).addClass( 'animated' );
// Parameters:
}
//    indexNavigationBar: the index of navigation bar to be toggled
}, '.grid-generic, .grid-Crafting_Table, .grid-Furnace, .grid-Brewing_Stand, .mcui' );
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, 'NavPic' ) ) {
                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 (var 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()
{
    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")) {
                    NavFrame.childNodes[j].appendChild(NavToggle);
                }
            }
            NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
        }
    }
}


addOnloadHook( createNavigationBarToggleButton );
*/
/**
/**
  * Skrypt dla Szablon:Galeria
  * Make simple search suggestions box separately styled
  */
  */
function toggleImage(group, remindex, shwindex) {
mw.loader.using( 'mediawiki.searchSuggest', function() {
  document.getElementById("ImageGroupsGr"+group+"Im"+remindex).style.display="none";
$( '.suggestions:first' ).addClass( 'searchbar' );
  document.getElementById("ImageGroupsGr"+group+"Im"+shwindex).style.display="inline";
} );
}
function ImageGroup(){
  if (document.URL.match(/printable/g)) return;
  var divs=document.getElementsByTagName("div");
  var i = 0, j = 0;
  var units, search;
  var currentimage;
  var UnitNode;
  for (i = 0; i < divs.length ; i++) {
    if (divs[i].className != "ImageGroup") continue;
    UnitNode=undefined;
    search=divs[i].getElementsByTagName("div");
    for (j = 0; j < search.length ; j++) {
      if (search[j].className != "ImageGroupUnits") continue;
      UnitNode=search[j];
      break;
    }
    if (UnitNode==undefined) continue;
    units=Array();
    for (j = 0 ; j < UnitNode.childNodes.length ; j++ ) {
      var temp = UnitNode.childNodes[j];
      if (temp.className=="center") units.push(temp);
    }
    for (j = 0 ; j < units.length ; j++) {
      currentimage=units[j];
      currentimage.id="ImageGroupsGr"+i+"Im"+j;
      var imghead = document.createElement("div");
      var leftlink = document.createElement("a");
      var rightlink = document.createElement("a");
      if (j != 0) {
        leftlink.href = "javascript:toggleImage("+i+","+j+","+(j-1)+");";
        leftlink.innerHTML="◀";
      }
      if (j != units.length - 1) {
        rightlink.href = "javascript:toggleImage("+i+","+j+","+(j+1)+");";
        rightlink.innerHTML="▶";
      }
      var comment = document.createElement("tt");
      comment.innerHTML = "("+ (j+1) + "/" + units.length + ")";
      with(imghead) {
        style.fontSize="110%";
        style.fontweight="bold";
        appendChild(leftlink);
        appendChild(comment);
        appendChild(rightlink);
      }
      if (units.length>1) currentimage.insertBefore(imghead,currentimage.childNodes[0]);
      if (j != 0) currentimage.style.display="none";
    }
  }
}
addOnloadHook(ImageGroup);


//
// "Focus the cursor in the search bar on loading the Main Page"
// Autor: [[:en:User:Nihiltres]]
// Zaimportowany z http://en.wikipedia.org/wiki/MediaWiki:Gadget-searchFocus.js wg stanu na 7 paź. 2008
//
// opis działania: skrypt ustawia automatycznie kursor w polu wyszukiwania.
if (wgPageName == "Strona_główna") {
    addOnloadHook(function() {
        var searchInput = document.getElementById("searchInput");
        if (searchInput)
            searchInput.focus();
    });
}


//
/**
// search box for anonimous users (styles in Common.css)
  * Set unlicensed as the default license on file pages
//
if (
(wgPageName == "Strona_główna" && wgUserGroups == null)
|| (wgPageName == "Strona_główna/Nowa")
)
{
    addOnloadHook(function()
    {
        var strFromHtml = ''
            +'<form id="mp_search" action="/wiki/Specjalna:Szukaj">'
                +'<div class="search_area">'
                    +'<div>'
                        +'<input type="text" onclick="this.value=\'\'; this.className=\'\'" class="wyszarz" value="Wpisz tutaj szukane pojęcie, hasło, artykuł" id="mp_sz_inp" name="search" />'
                        +'<a title="Pomoc:Przeszukiwanie" href="/wiki/Pomoc:Przeszukiwanie"><img alt="Pomoc" src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/c4/Ambox_blue_question.svg/30px-Ambox_blue_question.svg.png"></a>'
                    +'</div>'
                +'</div>'
                +'<div class="button_area"><input type="submit" value="Szukaj" name="fulltext" id="mp_sz_btn"></div>'
                +'<div class="last_area"></div>'
            +'</form>'
        ;
       
        var el = document.getElementById('mp_searchbox_container');
        if (el)
        {
            el.innerHTML=strFromHtml;
            el.style.display="block";
        }
    });
}
 
/////////////////////////////////////////
/////      Skrypty zewnętrzne    //////
/////////////////////////////////////////
 
 
// Importowanie funkcji działających podczas edycji. Patrz: [[MediaWiki:Common-edit.js]]
 
if (wgAction == 'edit' || wgAction == 'submit')
{
    if (wgNamespaceNumber > -1)
    {
        importScript( "MediaWiki:Common-edit.js" );
        importScript( "MediaWiki:Gadget-edit-buttons.js" );
        importScript( "MediaWiki:nuxedtoolkit.js" ); // tworzenie przycisków w toolbarach edycyjnych
        importScript( "MediaWiki:NuxTBKeys.js" ); // Autokorekta
    }
}
importScript( "MediaWiki:sel_t.js" ); // zaznaczenie tekstu
importScript( "MediaWiki:SftJSmsg.js" ); // klasa obsługi komunikatów JS-HTML
 
importScript( "MediaWiki:HeadingIcons.js"); // poprawa ikonek nagłówka
 
if (wgUserGroups == null) {
    // Importowanie skryptów i stylów tylko dla anomimowych użytkowników.
    importScript( "MediaWiki:Common-Anon.js" );
    //importStylesheet( "MediaWiki:Common-Anon.css" );
    appendCSS('.anon_hide_block{display:none}');
}
else
{
    appendCSS('.nonanon_hide_block{display:none}');
}
 
 
var beau$userGroups = {};
 
if (wgUserGroups) {
    for (var i = 0; i < wgUserGroups.length; i++) {
        beau$userGroups[ wgUserGroups[i] ] = true;
    }
}
 
if ( beau$userGroups["sysop"] ) {
    // Importowanie skryptów tylko dla administratorów.
    // Patrz: [[MediaWiki:Common-Sysop.js]]
    importScript( "MediaWiki:Common-Sysop.js" )
}
else {
    // Dla osób nie będących administratorami
    // Popup do zgłaszania błędów. Patrz: [[MediaWiki:Wikibugs.js]]
    importScript( "MediaWiki:Wikibugs.js" )
}
 
if (wgCanonicalSpecialPageName == 'Upload') {
    // Skrypty na stronie przesyłania plików
    importScript("MediaWiki:Common-Upload.js");
}
else if (wgCanonicalSpecialPageName == 'Search') {
    // Skrypty na stronie wyszukiwania
    importScript("MediaWiki:Common-Search.js");
}
else if ( wgPageName == "Wikipedia:CommonsTicker" ) {
    // Pobieranie styli CSS dla [[Wikipedia:CommonsTicker]]
    importStylesheet( "MediaWiki:CommonsTicker.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]]
  */
 
if (wgServer == "https://secure.wikimedia.org") {
    var metaBase = "https://secure.wikimedia.org/wikipedia/meta";
} else {
    var metaBase = "http://meta.wikimedia.org";
}
importScriptURI(metaBase+"/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400");
 
var wma_settings =
{
    height : 400,
    width : 700
}
 
/** extract a URL parameter from the current URL **********
* From [[en:User:Lupin/autoedit.js]]
* Local Maintainer: [[User:Saper]]
*/
function getParamValue( paramName, url)
{
if (typeof (url) == 'undefined' ) url = document.location.href;
var cmdRe=RegExp( '[&?]' + paramName + '=([^&]*)' );
var m=cmdRe.exec(url);
if (m) {
  try {
  return decodeURIComponent(m[1]);
  } catch (someError) {}
}
return null;
}
/** Parametr &withJS= *******
* Spróbuj załadować dodatkowy skrypt z przestrzeni MediaWiki
* bez potrzeby edytowania [[Special:Mypage/monobook.js]]
  *
  *
  * Maintainer: commons: [[User:Platonides]], plwiki: [[User:Saper]]
  * That way the file will be categorised so someone can find a license for the file
  */
  */
{
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload' ) {
var extraJS = getParamValue("withJS");
if ( $( '#wpLicense' ).val() === '' ) {
if (extraJS)
$( '#wpLicense' ).val( i18n.defaultLicense );
  if (extraJS.match("^MediaWiki:[^&<>=%]*\.js$"))
}
  importScript(extraJS);
  else
  alert("Plik " + extraJS + " nie powinien byc ladowany.");
}
 
/*
/*
== Drobne skrypty ==
mw.loader.using( 'mediawiki.special.upload', function() {
; Author: Maciej Jaros [[:pl:User:Nux]]
var change = setInterval( function() {
; License: Public domain
if ( licenseSelectorCheck ) {
$( '#wpLicense' ).change();
clearInterval( change );
}
}, 500 );
} );
*/
*/
//
// Zaznacza wszystkie elementy typu "checkbox" na stronie - wywołanie javascript:ZaznaczWszystkie()
//
function ZaznaczWszystkie()
{
    var inpt = document.getElementsByTagName('input');
    for (var i=inpt.length-1; i>=0; i--)
        if (inpt[i].type=='checkbox')
            inpt[i].checked=true;
}
//
// RSS kategorii
//
if (wgNamespaceNumber == 14)
{
    addOnloadHook(function()
    {
        var rsslink = 'http://toolserver.org/~cspurrier/rss/rss.php'
            +'?lang=pl&family=wikipedia'
            +'&desc=RSS%20kategorii%20Wikipedii'
            +'&title='+encodeURIComponent(wgTitle)
            +'&categories='+encodeURIComponent(wgTitle);
           
        mw.util.addPortletLink('p-tb', rsslink, 'RSS kategorii', 't-katrss', 'RSS kategorii ' + wgTitle, null, null);
    });
}
//
// Array.indexOf() dla kompatybilności różnych skryptów z IE
// (skrypt z Mozilli)
if (!Array.prototype.indexOf)
{
    Array.prototype.indexOf = function(elt /*, from*/)
    {
        var len = this.length;
        var from = Number(arguments[1]) || 0;
        from = (from < 0) ? Math.ceil(from) : Math.floor(from);
        if (from < 0)
            from += len;
        for (; from < len; from++)
        {
            if (from in this && this[from] === elt)
                return from;
        }
        return -1;
    };
}
}
//
// Ustawienie wysokości "Usunięcie" pustego elementu contentSub
//
addOnloadHook(function()
{
    var el=document.getElementById('mw-revisiontag');
    if (el && el.className.indexOf('flaggedrevs_short')!=-1)
    {
        if (el.parentNode.id=='contentSub') el.parentNode.style.height='17px';
    }
});


addOnloadHook(function()
{
    var fn = getElementsByClassName(document, 'table', 'navbox');
    if (fn.length) fn[0].className+=' firstNavbox';
})
/*
=== Link do brudnopisów w menu osobistym ===
; autor: [[Wikipedysta:Herr Kriss]]
*/
var disableSandboxLink = 0;    // ustawienie tego na 1 lub true w swoim monobook.js pozwoli wyłączyć tę funkcjonalność
addOnloadHook(function()
{
    if (wgUserName != null && disableSandboxLink == 0)
    {
        var caption = 'Mój brudnopis'
        if (wgUserLanguage != 'pl')
            caption = 'My sandbox';
        mw.util.addPortletLink('p-personal', wgServer + wgScript + '?title=Special:Mypage/brudnopis', caption, 'pt-sandbox', caption, '', document.getElementById('pt-preferences'));
    }
});
/*
* Description: Redirects from User:UserName/skin.js or .css to the user's actual skin page
* Maintainer: Nux
*/
if (wgNamespaceNumber==2 && wgArticleId==0 && wgAction=="view"    // Nonexistent User:... page in view mode
    && wgUserName    // Logged in User
    && wgTitle.indexOf(wgUserName+"/skin.")===0
    && wgTitle.search(/\/skin.(js|css)/)>0
    )
{
    window.location.href = window.location.href.replace(/\/skin.(css|js)/i, '/' + skin + '.$1');
}
//
// Import usergroup-specific stylesheet, only for admins atm
//
for( var key=0; wgUserGroups && key < wgUserGroups.length; key++ )
{
  if (wgUserGroups[key] =="sysop")
  {
      importStylesheet("MediaWiki:Admin.css");
      break;
  }
}
/* START MINECRAFT WIKI SCRIPT */
/** Grid/slide **/
// this needs to be unminified; MediaWiki automatically minifies all CSS and JS before
// serving it to users, so minifying it here just makes it nigh-unmaintainable
jQuery(function(){jQuery(".GridSlide").each(function(){jQuery("div.GridSlideChild:first",this).addClass("active").show()});setInterval(function(){jQuery(".GridSlide").each(function(){var b=jQuery("div.active",this),a=b.next();a.length<1&&(a=jQuery("div.GridSlideChild:first",this));b.removeClass("active").hide();a.addClass("active").show()})},2E3)});
jQuery(function(){jQuery("div.grid-input-slide").each(function(){jQuery("span.grid-input:first",this).addClass("active").show();jQuery("span.grid-input-numbers:first",this).addClass("active").show()});jQuery("div.grid-output-slide").each(function(){jQuery("span.grid-output:first",this).addClass("active").show();jQuery("span.grid-output-numbers:first",this).addClass("active").show()});setInterval(function(){jQuery("div.grid-input-slide").each(function(){var b=jQuery("span.grid-input.active",this),
a=b.next();if(a.length<1||!a.hasClass("grid-input"))a=jQuery("span.grid-input:first",this);b.removeClass("active").hide();a.addClass("active").show();b=jQuery("span.grid-input-numbers.active",this);a=b.next();a.length<1&&(a=jQuery("span.grid-input-numbers:first",this));b.removeClass("active").hide();a.addClass("active").show()});jQuery("div.grid-output-slide").each(function(){var b=jQuery("span.grid-output.active",this),a=b.next();if(a.length<1||!a.hasClass("grid-output"))a=jQuery("span.grid-output:first",
this);b.removeClass("active").hide();a.addClass("active").show();b=jQuery("span.grid-output-numbers.active",this);a=b.next();a.length<1&&(a=jQuery("span.grid-output-numbers:first",this));b.removeClass("active").hide();a.addClass("active").show()})},2E3)});
// Element animator (used in [[Template:Grid]])
if ($('.animated').length) {
    setInterval(function(){
        $('.animated').each(function(){
            var current = $(this).find('.animated-active').removeClass('animated-active active');
                next = current.next().length?current.next():$(this).children().eq(0);
            next.addClass('animated-active active');
        });
    },2000);
}


/**
/**
  * Collapsible tables
  * Creates minecraft style tooltips
  *
  *
  * Based on http://www.mediawiki.org/wiki/Manual:Collapsible_tables#Common.js_script_.28before_1.18.29
  * Replaces normal tooltips. Supports minecraft [[formatting codes]] (except k), and a description with line breaks (/).
*
* @maintainers [[User:Ultradude25]]
*/
if ( $( 'table.collapsible' ).length ) {
    var collapseText = 'Ukryj', expandText = 'Pokaż', collapseButton,
        buttonText = ' <span class="collapsible-button">[<span class="jslink">' + collapseText + '</span>]</span> ';
   
    $( 'table.collapsible' ).each( function() {
        var table = $( this ), header;
       
        if ( table.find( '.collapse-button' ).length ) {
            header = table.find( 'tr:first .collapse-button' );
        } else {
            header = table.find( 'tr:first th:first' );
        }
       
        if ( !header.length || !table.find( 'tr' ).not( 'tr:first' ).text().replace( /\n/g, '' ).length ) {
          return true;
        }
       
        if ( table.hasClass( 'collapse-button-none' ) ) {
            header.append( buttonText );
        } else {
            header.prepend( buttonText );
        }
       
        collapseButton = table.find( '.collapsible-button .jslink' );
       
        if ( table.hasClass( 'collapsed' ) ) {
            collapseButton.text( expandText );
        }
       
        collapseButton.click( function( e ) {
            // Stop table sorting activating when clicking link
            e.stopPropagation();
           
            if ( table.hasClass( 'collapsed' ) ) {
                table.removeClass( 'collapsed' ).addClass( 'expanded' );
                $( this ).text( collapseText );
            } else {
                table.removeClass( 'expanded' ).addClass( 'collapsed' );
                $( this ).text( expandText );
            }
        } );
    } );
}
/**
* Element animator
*
* Will cycle the active class on any child elements
* within an element with the animated class.
* Script from: http://minecraft.gamepedia.com/
  */
  */
window.mcw = {};
( function() {
( function() {
var $content = $( '#mw-content-text' );
var escapeChars = { '\\&': '&#38;', '<': '&#60;', '>': '&#62;' };
var advanceFrame = function( parentElem ) {
var escape = function( text ) {
var curFrame = parentElem.querySelector( '* > .animated-active, * > .active' );
// "\" must be escaped first
$( curFrame ).removeClass( 'animated-active active' );
return text.replace( /\\\\/g, '&#92;' )
var $nextFrame = $( curFrame.nextElementSibling || parentElem.firstElementChild );
.replace( /\\&|[<>]/g, function( char ) { return escapeChars[char]; } );
return $nextFrame.addClass( 'animated-active active' );
};
};
setInterval( function() {
var $tooltip = $();
$content.find( '.animated' ).each( function() {
var $win = $( window ), winWidth, winHeight, width, height;
var $nextFrame = advanceFrame( this );
if ( $nextFrame.hasClass( 'animated-subframe' ) ) {
$( '#mw-content-text' ).on( {
advanceFrame( $nextFrame[0] );
'mouseenter.minetip': function( e ) {
$tooltip.remove();
var $elem = $( this ), title = $elem.attr( 'data-minetip-title' );
if ( title === undefined ) {
title = $elem.attr( 'title' );
if ( title !== undefined ) {
title = $.trim( title.replace( /&/g, '\\&' ) );
$elem.attr( 'data-minetip-title', title );
}
}
// No title or title only contains formatting codes
if ( title === undefined || title !== '' && title.replace( /&([0-9a-fl-or])/g, '' ) === '' ) {
// Find deepest child title
var childElem = $elem[0], childTitle;
do {
if ( childElem.hasAttribute( 'title' ) ) {
childTitle = childElem.title;
}
childElem = childElem.firstChild;
} while( childElem && childElem.nodeType === 1 );
if ( childTitle === undefined ) {
return;
}
// Append child title as title may contain formatting codes
if ( !title ) {
title = '';
}
title += $.trim( childTitle.replace( /&/g, '\\&' ) );
// Set the retrieved title as data for future use
$elem.attr( 'data-minetip-title', title );
}
}
} );
}, 2000 );
if ( !$elem.data( 'minetip-ready' ) ) {
// Remove title attributes so the native tooltip doesn't get in the way
$elem.find( '[title]' ).addBack().removeAttr( 'title' );
$elem.data( 'minetip-ready', true );
}
if ( title === '' ) {
return;
}
var content = '<span class="minetip-title">' + escape( title ) + '&r</span>';
var description = $.trim( $elem.attr( 'data-minetip-text' ) );
if ( description ) {
// Apply normal escaping plus "/"
description = escape( description ).replace( /\\\//g, '&#47;' );
content += '<span class="minetip-description">' + description.replace( /\//g, '<br>' ) + '&r</span>';
}
// Add classes for minecraft formatting codes
while ( content.search( /&[0-9a-fl-o]/ ) > -1 ) {
content = content.replace( /&([0-9a-fl-o])(.*?)(&r|$)/g, '<span class="format-$1">$2</span>&r' );
}
// Remove reset formatting
content = content.replace( /&r/g, '' );
$tooltip = $( '<div id="minetip-tooltip">' );
$tooltip.html( content ).appendTo( 'body' );
// Cache current window and tooltip size
winWidth = $win.width();
winHeight = $win.height();
width = $tooltip.outerWidth( true );
height = $tooltip.outerHeight( true );
// Trigger a mouse movement to position the tooltip
$elem.trigger( 'mousemove', e );
},
'mousemove.minetip': function( e, trigger ) {
if ( !$tooltip.length ) {
$( this ).trigger( 'mouseenter' );
return;
}
// Get event data from remote trigger
e = trigger || e;
// Get mouse position and add default offsets
var top = e.clientY - 34;
var left = e.clientX + 14;
// If going off the right of the screen, go to the left of the cursor
if ( left + width > winWidth ) {
left -= width + 36;
}
// If now going off to the left of the screen, resort to going above the cursor
if ( left < 0 ) {
left = 0;
top -= height - 22;
// Go below the cursor if too high
if ( top < 0 ) {
top += height + 47;
}
// Don't go off the top of the screen
} else if ( top < 0 ) {
top = 0;
// Don't go off the bottom of the screen
} else if ( top + height > winHeight ) {
top = winHeight - height;
}
// Apply the positions
$tooltip.css( { top: top, left: left } );
},
'mouseleave.minetip': function() {
if ( !$tooltip.length ) {
return;
}
$tooltip.remove();
$tooltip = $();
}
}, '.minetip, .grid > .item, .invslot-item' );
}() );
}() );
mcw.animation();


/**
* Pause grid GUI templates (e.g. [[Template:Grid/Crafting Table]]) on mouseover
*
* This is so people have a chance to look at each image on the cell
* and click on pages they want to view.
*/
$( '#mw-content-text' ).on( {
'mouseenter': function() {
$( this ).find( '.animated' ).removeClass( 'animated' ).addClass( 'paused' );
},
'mouseleave': function() {
$( this ).find( '.paused' ).removeClass( 'paused' ).addClass( 'animated' );
}
}, '.grid-generic, .grid-Crafting_Table, .grid-Furnace, .grid-Brewing_Stand, .mcui' );


} );
/* End DOM ready */
/* End DOM ready */
/*
 


}() );
}() );
*/

Aktualna wersja na dzień 03:05, 30 maj 2025

/*
UWAGA! Ten JavaScript działa dla wszystkich skórek. Należy zachować szczególną ostrożność wprowadzając tutaj zmiany!

'''Wyłączenie poszczególnych możliwości/skryptów'''
* Oznaczanie artykułów medalowych i dobrych artykułów (dla interwiki)
 window.LinkFADone = true;
* Przesunięcie linków [ edytuj ] przy sekcjach
 var oldEditsectionLinks=true;
*/

( function() {
'use strict';

/** Variables for interface text used throughout the script, for ease of translating */
var i18n = {
	// Collapsible elements and page loader
	hideText: 'ukryj',
	showText: 'pokaż',
	
	// Page loader
	loadErrorTitle: '"Błąd podczas ładowania danych',
	
	// File upload
	defaultLicense: 'Licencja'
};

/**
 * Instead of cluttering up the global scope with
 * variables, they should instead be set as a
 * property of this global variable
 *
 * E.g: Instead of
 *   myVar = 'blah';
 * use
 *   mcw.myVar = 'blah';
 */
var mcw = window.mcw = {};

mw.hook( 'wikipage.content' ).add( function( $wikipageContent ) {

// Ukrywa przyciski jeśli brakuje na nie miejsca
$("li[id*='ca-watch']").addClass('collapsible');
$("li[id*='ca-unwatch']").addClass('collapsible');
$("li[id*='ca-edit']").addClass('collapsible');
$("li[id*='ca-view']").addClass('collapsible');
$("li[id*='ca-ve-edit']").addClass('collapsible');
$("li[id*='ca-viewsource']").addClass('collapsible');

/**
 * Collapsible elements
 *
 * Add the "collapsible" class to an element and the child element with class "collapsible-content"
 * (or everything but the header row if a table) will be hidden when the element is collapsed.
 *
 * * Add the class "collapsed" to the element to make it start out collapsed.
 * * Add either "collapsetoggle-left" or "collapsetoggle-inline" to the element to choose the collapse
 *   toggle alignment (defaults to right).
 * * Add an ID in the format of "collapsible-<x>" to the element to make any element with the class
 *  "collapsetoggle-custom" and a matching class in the format of "collapsible-<x>-toggle" control
 *   the collapsing instead of the standard button.
 *   If the custom toggle contains an element with the "jslink" class, only that will be clickable.
 */
( function() {
	var $collapsibles = $wikipageContent.find( '.collapsible' );
	if ( !$collapsibles.length ) {
		return;
	}
	
	var $toggleTemplate = $( '<span>' ).addClass( 'collapsetoggle' ).append(
		'[', $( '<span>' ).addClass( 'jslink' ), ']'
	);
	$collapsibles.each( function() {
		var $collapsible = $( this );
		if ( $collapsible.data( 'made-collapsible' ) ) {
			return true;
		}
		
		var $children = $collapsible.children();
		var showText = $collapsible.data( 'expandtext' ) || i18n.showText;
		var hideText = $collapsible.data( 'collapsetext' ) || i18n.hideText;
		
		// If there is no content area, add it
		if ( !$collapsible.is( 'table' ) && !$children.filter( '.collapsible-content' ).length ) {
			if ( $collapsible.is( 'tr' ) ) {
				$children.addClass( 'collapsible-content' );
			} else {
				$collapsible.wrapInner( '<div class="collapsible-content">' );
			}
		}
		
		var $toggle;
		var id = $collapsible.attr( 'id' );
		if ( id && id.match( /^collapsible-./ ) ) {
			$toggle = $( $wikipageContent[0].getElementsByClassName( id + '-toggle' ) )
				.filter( '.collapsetoggle-custom' ).css( 'visibility', 'visible' );
		}
		
		// Create and insert the toggle button if there is no custom one
		if ( !$toggle || !$toggle.length ) {
			var $toggleContainer;
			if ( $collapsible.is( 'table' ) ) {
				var $rows = $children.filter( 'thead' ).children();
				if ( !$rows.length ) {
					$rows = $children.filter( 'tbody' ).first().children();
					if ( !$rows.length ) {
						$rows = $children.filter( 'tr' );
					}
				}
				$toggleContainer = $rows.first().children().last();
			} else {
				$toggleContainer = $children.first();
				if ( $toggleContainer.hasClass( 'collapsible-content' ) ) {
					$toggleContainer = $collapsible;
				}
			}
			
			$toggle = $toggleTemplate.clone();
			if ( $collapsible.hasClass( 'collapsetoggle-inline' ) || $collapsible.hasClass( 'collapse-button-none' ) ) {
				$toggleContainer.append( $toggle );
			} else {
				$toggleContainer.prepend( $toggle );
			}
		}
		
		var $toggleLink = $toggle.find( '.jslink' );
		if ( !$toggleLink.length ) {
			$toggleLink = $toggle;
		}
		$toggleLink.attr( 'tabindex', 0 ).text( hideText );
		
		// Find max toggle size, and set its min-width to it
		var hideWidth = $toggle.width();
		$toggleLink.text( showText );
		var showWidth = $toggle.width();
		if ( hideWidth !== showWidth ) {
			$toggle.css( 'min-width', hideWidth > showWidth ? hideWidth : showWidth );
		}
		
		// Set the text back to hide if it's not collapsed to begin with
		if ( !$collapsible.hasClass( 'collapsed' ) ) {
			$toggleLink.text( hideText );
		}
		
		$toggleLink.on( 'click keydown', function( e ) {
			// Only trigger on enter press
			if ( e.keyCode && e.keyCode !== 13 ) {
				return;
			}
			
			// Don't toggle when clicking buttons or links inside the toggle
			var $target = $( e.target );
			if ( $target.is( 'button' ) || $target.is( 'a' ) ) {
				return;
			}
			
			$collapsible.toggleClass( 'collapsed' );
			if ( $collapsible.hasClass( 'collapsed' ) ) {
				$toggleLink.text( showText );
			} else {
				$toggleLink.text( hideText );
			}
			
			// Stop table sorting activating when clicking the link
			e.stopPropagation();
		} );
		
		$collapsible.data( 'made-collapsible', true );
	} );
}() );
// End Collapsible function

/**
 * Element animator
 *
 * Will cycle the active class on any child elements
 * within an element with the animated class.
 */
( function() {
	if ( !mcw.animate ) {
		mcw.animate = setInterval( function() {
			$( '.animated' ).each( function() {
				var $elem = $( this );
				var $current = $elem.children( '.active' );
				var $next = $current.nextAll( ':not(.skip):first' );
				// Loop back to the start
				if ( !$next.length ) {
					$next = $elem.children( ':not(.skip):first' );
				}
				$current.removeClass( 'active' );
				$next.addClass( 'active' );
			} );
		}, 2000 );
	}
}() );


/**
 * Page loader
 *
 * Allows a page to be downloaded and displayed on demand.
 * Use with [[Template:LoadPage]] and [[Template:LoadBox]]
 */
( function() {
	var $loadPage = $wikipageContent.find( '.load-page' );
	if ( !$loadPage.length ) {
		return;
	}
	
	// We need the spinner to show loading is happening, but we don't want
	// to have a delay while the module downloads, so we'll load this now,
	// regardless of if something is clicked
	mw.loader.load( 'jquery.spinner' );
	
	// Create button starting with hide text
	// Will be changed to the show text while calculating the maximum button size
	var $buttonTemplate = $( '<span>' ).addClass( 'mw-editsection-like load-page-button' )
		.append( '[', $( '<span>' ).addClass( 'jslink' ).text( i18n.hideText ), ']' );
	
	var extractList = function( $contentContainer, listClass ) {
		var $content = $contentContainer.find( '> ul > li > ul' ).children( ':not(.nbttree-inherited)' );
		if ( listClass ) {
			$content.addClass( listClass );
		}
		
		return $content;
	};
	
	$loadPage.each( function() {
		var $body = $( this );
		var page = $body.data( 'page' );
		if ( !page ) {
			return;
		}
		
		var template = $body.data( 'template' );
		var treeview = $body.data( 'treeview' );
		var treeviewClass = $body.data( 'treeviewclass' );
		var $heading;
		var $contentContainer;
		var $content;
		var $button = $buttonTemplate.clone();
		var $buttonLink = $button.find( '.jslink' );
		if ( treeview ) {
			$heading = $body;
			$contentContainer = $( '<div>' );
		} else {
			$heading = $body.children().first();
			$contentContainer = $body.find( '.load-page-content' );
		}
		
		// Add the button
		$heading.append( $button );
		
		// Move the edit button to the right spot
		$contentContainer.find( '.mw-editsection, .mw-editsection-like' ).insertAfter( $button );
		
		// Find max button width, and set its min-width to it
		var hideWidth = $button.width();
		$buttonLink.text( i18n.showText );
		var showWidth = $button.width();
		
		if ( hideWidth !== showWidth ) {
			$button.css( 'min-width', hideWidth > showWidth ? hideWidth : showWidth );
		}
		
		$buttonLink.click( function() {
			if ( $body.hasClass( 'pageloader-contentloaded' ) ) {
				if ( $buttonLink.text() === i18n.showText ) {
					if ( treeview ) {
						$content.insertAfter( $body );
					} else {
						$contentContainer.show();
					}
					$buttonLink.text( i18n.hideText );
				} else {
					if ( treeview ) {
						$content.detach();
					} else {
						$contentContainer.hide();
					}
					$buttonLink.text( i18n.showText );
				}
				return;
			}
			
			// See if this was loaded elsewhere before making a request
			var gotContent;
			$( '.pageloader-contentloaded' ).each( function() {
				var $fLoader = $( this );
				if ( $fLoader.data( 'page' ) === page && $fLoader.data( 'mw-pageloader-content' ) ) {
					$contentContainer.html( $fLoader.data( 'mw-pageloader-content' ) ).removeClass( 'noscript' );
					mw.hook( 'wikipage.content' ).fire( $contentContainer );
					
					if ( treeview ) {
						$body.find( '.noscript' ).remove();
						$content = extractList( $contentContainer, treeviewClass );
						$content.insertAfter( $body );
					}
					
					$buttonLink.text( i18n.hideText );
					$body.addClass( 'pageloader-contentloaded' );
					gotContent = true;
					return false;
				}
			} );
			if ( gotContent ) {
				return;
			}
			
			// Just in-case the spinner module is still not ready yet
			var $spinner = $();
			mw.loader.using( 'jquery.spinner', function() {
				// $spinner will be false if the content somehow loaded before the module did
				if ( $spinner ) {
					$spinner = $.createSpinner().addClass( 'mw-editsection-like' )
						.css( 'min-width', $button.css( 'min-width' ) );
					$button.hide().after( $spinner );
				}
			} );
			
			var requestData = {
				action: 'parse',
				prop: 'text'
			};
			if ( template ) {
				requestData.page = page;
			} else {
				requestData.title = mw.config.get( 'wgPageName' );
				requestData.text = '{' + '{:' + page + '}}';
			}
			new mw.Api().get( requestData ).done( function( data ) {
				var html = data.parse.text['*'];
				$contentContainer.html( html ).removeClass( 'noscript' );
				
				// Resolve self-links
				if ( template ) {
					var curPage = '/' + mw.config.get( 'wgPageName' );
					$contentContainer.find( 'a' ).each( function() {
						var $link = $( this );
						if ( $link.attr( 'href' ) === curPage ) {
							$link.replaceWith( $( '<strong>' ).addClass( 'selflink' ).append( $link.contents() ) );
						}
					} );
					html = $contentContainer.html();
				}
				
				$body.data( 'mw-pageloader-content', html );
				
				// Fire content hook on the new content, running all this stuff again and more :)
				mw.hook( 'wikipage.content' ).fire( $contentContainer );
				
				if ( treeview ) {
					$body.find( '.noscript' ).remove();
					$content = extractList( $contentContainer, treeviewClass );
					$content.insertAfter( $body );
				}
				
				$spinner.remove();
				$spinner = false;
				$buttonLink.text( i18n.hideText );
				$button.show();
				$body.addClass( 'pageloader-contentloaded' );
			} ).fail( function( _, error ) {
				$spinner.remove();
				$spinner = false;
				$button.show();
				
				var errorText = '';
				if ( error.textStatus ) {
					errorText = error.textStatus;
				} else if ( error.error ) {
					errorText = error.error.info;
				}
				
				mw.notify( errorText, { title: i18n.loadErrorTitle, autoHide: false } );
			} );
		} );
	} );
}() );

( function() {
	
	$('div.mw-body-content > ul > li > a.mw-userlink[href*="U%C5%BCytkownik:Filtr_nadu%C5%BCy%C4%87"]').closest('li').hide();
	
	/** dofollow (plainlinks) */
	$wikipageContent.find('span.dofollow > a').each(function()
	{
		$(this).removeAttr('rel');
	});
	
	/** allow robots */
	if($wikipageContent.find('div#allowrobots').length || mw.config.get('wgPageName') == 'Specjalna:Ostatnie_zmiany')
	{
		$('head > meta[name=robots]').attr('content', 'all,max-image-preview:standard');
	}
	
	/** metadesc (description) */
	var $meta = $('head > meta[name=description]');
	$wikipageContent.find('span#metadesc').each(function()
	{
		$meta.attr('content', $(this).text());
		$(this).remove();
	});
	
	/** NoTitle */
	$wikipageContent.find('span#notitle').each(function()
	{
		mw.loader.addStyleTag('body.mediawiki > div#content > h1#firstHeading { display:none; }');
		$(this).remove();
	});
	var $indicators = $('body.skin-vector-legacy > #content > .mw-indicators');
	if($indicators.length)
		$indicators.parent().find('h1#firstHeading').each(function()
		{
			$indicators.css('display', $(this).css('display'));
		});
	
} () );

} );
/* End wiki content hook */

/** Fires when DOM is ready */
$( function() {


/** 
 * Fix edit summary prompt for undo
 *
 * Fixes the fact that the undo function combined with the "no edit summary prompter"
 * causes problems if leaving the edit summary unchanged.
 * Added by [[wikipedia:User:Deskana]], code by [[wikipedia:User:Tra]].
 * See https://bugzilla.wikimedia.org/show_bug.cgi?id=8912
 */
if ( document.location.search.indexOf( "undo=" ) !== -1 && document.getElementsByName( 'wpAutoSummary' )[0] ) {
	document.getElementsByName( 'wpAutoSummary' )[0].value='1';
}


/**
 * Pause grid GUI templates (e.g. [[Template:Grid/Crafting Table]]) on mouseover
 *
 * This is so people have a chance to look at each image on the cell
 * and click on pages they want to view.
 */
$( '#mw-content-text' ).on( {
	'mouseenter': function() { 
		$( this ).find( '.animated' ).removeClass( 'animated' ).addClass( 'paused' );
	},
	'mouseleave': function() {
		$( this ).find( '.paused' ).removeClass( 'paused' ).addClass( 'animated' );
	}
}, '.grid-generic, .grid-Crafting_Table, .grid-Furnace, .grid-Brewing_Stand, .mcui' );


/**
 * Make simple search suggestions box separately styled
 */
mw.loader.using( 'mediawiki.searchSuggest', function() {
	$( '.suggestions:first' ).addClass( 'searchbar' );
} );


/**
 * Set unlicensed as the default license on file pages
 *
 * That way the file will be categorised so someone can find a license for the file
 */
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload' ) {
	if ( $( '#wpLicense' ).val() === '' ) {
		$( '#wpLicense' ).val( i18n.defaultLicense );
	}
	
/*
	mw.loader.using( 'mediawiki.special.upload', function() {
		var change = setInterval( function() {
			if ( licenseSelectorCheck ) {
				$( '#wpLicense' ).change();
				clearInterval( change );
			}
		}, 500 );
	} );
*/
}


/**
 * Creates minecraft style tooltips
 *
 * Replaces normal tooltips. Supports minecraft [[formatting codes]] (except k), and a description with line breaks (/).
 */
( function() {
	var escapeChars = { '\\&': '&#38;', '<': '&#60;', '>': '&#62;' };
	var escape = function( text ) {
		// "\" must be escaped first
		return text.replace( /\\\\/g, '&#92;' )
			.replace( /\\&|[<>]/g, function( char ) { return escapeChars[char]; } );
	};
	var $tooltip = $();
	var $win = $( window ), winWidth, winHeight, width, height;
	
	$( '#mw-content-text' ).on( {
		'mouseenter.minetip': function( e ) {
			$tooltip.remove();
			
			var $elem = $( this ), title = $elem.attr( 'data-minetip-title' );
			if ( title === undefined ) {
				title = $elem.attr( 'title' );
				if ( title !== undefined ) {
					title = $.trim( title.replace( /&/g, '\\&' ) );
					$elem.attr( 'data-minetip-title', title );
				}
			}
			
			// No title or title only contains formatting codes
			if ( title === undefined || title !== '' && title.replace( /&([0-9a-fl-or])/g, '' ) === '' ) {
				// Find deepest child title
				var childElem = $elem[0], childTitle;
				do {
					if ( childElem.hasAttribute( 'title' ) ) {
						childTitle = childElem.title;
					}
					childElem = childElem.firstChild;
				} while( childElem && childElem.nodeType === 1 );
				if ( childTitle === undefined ) {
					return;
				}
				
				// Append child title as title may contain formatting codes
				if ( !title ) {
					title = '';
				}
				title += $.trim( childTitle.replace( /&/g, '\\&' ) );
				
				// Set the retrieved title as data for future use
				$elem.attr( 'data-minetip-title', title );
			}
			
			if ( !$elem.data( 'minetip-ready' ) ) {
				// Remove title attributes so the native tooltip doesn't get in the way
				$elem.find( '[title]' ).addBack().removeAttr( 'title' );
				$elem.data( 'minetip-ready', true );
			}
			
			if ( title === '' ) {
				return;
			}
			
			var content = '<span class="minetip-title">' + escape( title ) + '&r</span>';
			
			var description = $.trim( $elem.attr( 'data-minetip-text' ) );
			if ( description ) {
				// Apply normal escaping plus "/"
				description = escape( description ).replace( /\\\//g, '&#47;' );
				content += '<span class="minetip-description">' + description.replace( /\//g, '<br>' ) + '&r</span>';
			}
			
			// Add classes for minecraft formatting codes
			while ( content.search( /&[0-9a-fl-o]/ ) > -1 ) {
				content = content.replace( /&([0-9a-fl-o])(.*?)(&r|$)/g, '<span class="format-$1">$2</span>&r' );
			}
			// Remove reset formatting
			content = content.replace( /&r/g, '' );
			
			$tooltip = $( '<div id="minetip-tooltip">' );
			$tooltip.html( content ).appendTo( 'body' );
			
			// Cache current window and tooltip size
			winWidth = $win.width();
			winHeight = $win.height();
			width = $tooltip.outerWidth( true );
			height = $tooltip.outerHeight( true );
			
			// Trigger a mouse movement to position the tooltip
			$elem.trigger( 'mousemove', e );
		},
		'mousemove.minetip': function( e, trigger ) {
			if ( !$tooltip.length ) {
				$( this ).trigger( 'mouseenter' );
				return;
			}
			
			// Get event data from remote trigger
			e = trigger || e;
			
			// Get mouse position and add default offsets
			var top = e.clientY - 34;
			var left = e.clientX + 14;
			
			// If going off the right of the screen, go to the left of the cursor
			if ( left + width > winWidth ) {
				left -= width + 36;
			}
			
			// If now going off to the left of the screen, resort to going above the cursor
			if ( left < 0 ) {
				left = 0;
				top -= height - 22;
				
				// Go below the cursor if too high
				if ( top < 0 ) {
					top += height + 47;
				}
			// Don't go off the top of the screen
			} else if ( top < 0 ) {
				top = 0;
			// Don't go off the bottom of the screen
			} else if ( top + height > winHeight ) {
				top = winHeight - height;
			}
			
			// Apply the positions
			$tooltip.css( { top: top, left: left } );
		},
		'mouseleave.minetip': function() {
			if ( !$tooltip.length ) {
				return;
			}
			
			$tooltip.remove();
			$tooltip = $();
		}
	}, '.minetip, .grid > .item, .invslot-item' );
}() );


} );
/* End DOM ready */


}() );