Иҫкәрмә: Күрәһең, битте һаҡлағандан һуң үҙгәртеүҙәрегеҙ күренһен өсөн, браузерығыҙҙың кэшын таҙартырға кәрәк.

  • Firefox / Safari: Shift төймәһенә баҫып, ебәрмәйенсә, панелдәге Яңыртырға төймәһенә баҫығыҙ, йәки Ctrl+F5 йә Ctrl+R (Mac-та ⌘-R) төймәләренә баҫығыҙ
  • Google Chrome: Ctrl+Shift+R төймәләренә баҫығыҙ (Mac-та ⌘-Shift+R)
  • Internet Explorer: Ctrl төймәһенә баҫып, ебәрмәйенсә, Яңыртырға төймәһенә йәки Ctrl+F5 төймәләренә баҫығыҙ
  • Opera: Ctrl+F5 төймәләренә баҫығыҙ.
/*WikiEditor/Викификатор*/
if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) {
        mw.loader.load( '//ru.wikipedia.org/w/index.php?title=MediaWiki:Wikificator.js&action=raw&ctype=text/javascript' );
}
 
var customizeToolbar = function() {
 
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'advanced',
        'group': 'format',
        'tools': {
                'wikify': {
                        label: 'Викификатор',
                        type: 'button',
                        icon: '//upload.wikimedia.org/wikipedia/commons/0/06/Wikify-toolbutton.png',
                             action: {
                                  type: 'callback',
                                       execute: function(context){
                                              Wikify();
                                       } 
                             }
                }
        }
} );
};
 
if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) {
        mw.loader.using( 'user.options', function () {
                if ( mw.user.options.get('usebetatoolbar') ) {
                        mw.loader.using( 'ext.wikiEditor', function () {
                                $( customizeToolbar );
                        } );
                }
        } );
}

importMW = function ( name ) {
	importScript( 'MediaWiki:' + name + '.js' );
};

importScript_ = importScript;
importScript = function ( page, proj ) {
	mw.loader.using( 'mediawiki.util', function () {
		if ( !proj ) {
			importScript_( page );
		} else {
			if ( proj.indexOf( '.' ) === -1 ) {
				proj += '.wikipedia.org';
			}
			mw.loader.load( '//' + proj + '/w/index.php?action=raw&ctype=text/javascript&title=' + mw.util.wikiUrlencode( page ) );
		}
	} );
};


mw.config.set( 'tableSorterCollation', { 'ё': 'е' } );


// Messages
var textFA = 'Башҡа тел бүлегендә';
var listFA = {
	fa: { item: 'Q17437796', text: 'был һайланған мәҡәлә' },
	fl: { item: 'Q17506997', text: 'был һайланған исемлек йәки портал' },
	ga: { item: 'Q17437798', text: 'был яҡшы мәҡәлә' }
};


var zeroSectionTip = 'Инеште төҙәтергә';

var NavigationBarHide = '[йәшерергә]',
	NavigationBarShow = '[күрһәтергә]',
	NavigationBarShowDefault = 2;

if ( /^en$/.test( mw.config.get( 'wgUserLanguage' ) ) ) {
	importMW( 'Common-' + mw.config.get( 'wgUserLanguage' ) );
}


function LinkFA() {
	$( '#p-lang li' ).each( function ( i, iw ) {
		var ll,
			s;
		ll = iw.className.replace( /^.*?(interwiki-)/, '$1' ).replace( /\s.*$/, '' ) + '-';
		for ( s in listFA ) {
			if ( document.getElementById( ll + s ) &&
				!$( iw ).hasClass( 'badge-featuredarticle' ) &&
				!$( iw ).hasClass( 'badge-goodarticle' ) &&
				!$( iw ).hasClass( 'badge-featuredlist' )
			) {
				$( iw )
					.addClass( s.toUpperCase() )
					.attr( 'title', listFA[s].text + textFA );
			}
		}
	} );
}


function editZeroSection() {
	if ( !mw.config.get( 'wgArticleId' ) ) {
		return;
	}
	mw.loader.using( 'mediawiki.util', function () {
		mw.util.$content.find( 'h2' )
			.children( '.mw-editsection:first' )
			.clone().prependTo( '#bodyContent' )
			.css( 'float', 'right' )
			.find( 'a' )
			.each( function( index ) { 
				$( this ).attr( 'title', zeroSectionTip );
				if ( $( this ).attr( 'class' ) === 'mw-editsection-visualeditor' ) { 
					$( this ).attr( 'href', mw.config.get( 'wgScript' ) + '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) ) + '&veaction=edit&vesection=0' );
				} else { 
					$( this ).attr( 'href', mw.config.get( 'wgScript' ) + '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) ) + '&action=edit&section=0' );
				} 
			} );
	} );
} 


// Collapsiblе: [[ВП:СБ]]

function collapsibleTables() {
	var $btn,
		$a,
		tblIdx = 0,
		colTables = [];

	$( 'table.collapsible' ).each( function() {
		var $table = $( this ),
			$row = $table.find( 'tr' ).first(),
			$cell = $row.find( 'th' ).first();
		if ( !$cell.length ) {
			return;
		}
		$table.attr( 'id', 'collapsibleTable' + tblIdx );
		$btn = $( '<span>' )
			.css( {
				'float': 'right',
				'font-weight': 'normal',
				'font-size': 'smaller'
			} );
		$a = $( '<a>' )
			.attr( 'id', 'collapseButton' + tblIdx )
			.attr( 'href', 'javascript:collapseTable(' + tblIdx + ');' )
			.css( 'color', $cell.css( 'color' ) )
			.text( NavigationBarHide )
			.appendTo( $btn );
		if ( $cell.contents().length ) {
			$btn.insertBefore( $cell.contents().first() );
		} else {
			$btn.appendTo( $cell );
		}
		colTables[tblIdx++] = $table;
	} );
	for ( var i = 0; i < tblIdx; i++ ) {
		if ( colTables[i].hasClass( 'collapsed' ) ||
			( tblIdx > NavigationBarShowDefault &&
				colTables[i].hasClass( 'autocollapse' )
			)
		) {
			collapseTable( i );
		}
	}
}

function collapseTable ( idx ) {
	var $table = $( '#collapsibleTable' + idx ),
		$rows = $table.find( 'tr' ),
		$btn = $( '#collapseButton' + idx );
	if ( !$table.length || !$rows.length || !$btn.length ) {
		return false;
	}

	var isShown = ( $btn.text() === NavigationBarHide ),
		cssDisplay = isShown ? 'none' : $rows.first().css( 'display' );

	$btn.text( isShown ? NavigationBarShow : NavigationBarHide );
	$rows.slice( 1 ).each( function() {
		$( this ).css( 'display', cssDisplay );
	} );
}

function collapsibleDivs() {
	var navIdx = 0,
		colNavs = [],
		i;
	$( '#mw-content-text div.NavFrame' ).each( function() {
		var $navFrame = $( this );
		$navFrame.attr( 'id', 'NavFrame' + navIdx );
		var $a = $( '<a>' )
			.addClass( 'NavToggle' )
			.attr( 'id', 'NavToggle' + navIdx )
			.attr( 'href', 'javascript:collapseDiv(' + navIdx + ');' )
			.text( NavigationBarHide );
		$navFrame.children( '.NavHead' ).append( $a );
		colNavs[navIdx++] = $navFrame;
	} );
	for ( i = 0; i < navIdx; i++ ) {
		if ( colNavs[i].hasClass( 'collapsed' ) ||
			( navIdx > NavigationBarShowDefault &&
				!colNavs[i].hasClass( 'expanded' )
			)
		) {
			collapseDiv( i );
		}
	}
}

function collapseDiv ( idx ) {
	var $div = $( '#NavFrame' + idx ),
		$btn = $( '#NavToggle' + idx );
	if ( !$div.length || !$btn.length ) {
		return false;
	}
	var isShown = ( $btn.text() === NavigationBarHide );
	$btn.text( isShown ? NavigationBarShow : NavigationBarHide );
	$div.children( '.NavContent,.NavPic' ).each( function() {
		$( this ).css( 'display', isShown ? 'none' : 'block' );
	} );
}


// Execution
mw.loader.using( 'mediawiki.util', function() {

	if ( mw.config.get( 'wgCanonicalNamespace' ) === 'Special' ) {
		if ( /^(Uplo|Sear|Stat|Spec|Abus|Prefe|Move|Watch|Newp|Log|Block$)/i.test( mw.config.get( 'wgCanonicalSpecialPageName' ) ) ) {
			importMW( mw.config.get( 'wgCanonicalSpecialPageName' ) );
		}

	} else {
		switch ( mw.config.get( 'wgAction' ) ) {

			case 'history':
		 		importMW( 'History' );
		 		break;

			case 'delete':
				importMW( 'Deletepage' );
				break;

			case 'edit':
			case 'submit':
				importMW( 'Editpage' );
				// and continue with the default: view, purge

			default:
				$( editZeroSection );
				$( collapsibleDivs );
				$( collapsibleTables );
				mw.loader.load( '//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript' );
				if ( document.location && document.location.protocol == 'https:' ) {
					importMW( 'Secure' );
				}
				if ( navigator.platform.indexOf( 'Win' ) !== -1 ) {
					mw.util.addCSS( '.IPA, .Unicode { font-family: "Arial Unicode MS", "Lucida Sans Unicode"; }' );
				}

				switch ( mw.config.get( 'wgNamespaceNumber' ) ) {
					case 0:
					case 100:
						$( LinkFA );
						importMW( 'Osm' );
						if ( mw.config.get( 'wgIsMainPage' ) ) {
							importMW( 'Mainpage' );
						}
						break;
					case 6:
						importMW( 'Filepage' );
						break;
				}
		}
	}

	// Раздел ссылок на другие проекты в сайдбаре
	importMW('Sidebar-related')

	if ( !mw.config.get( 'wgUserName' ) ) {
		mw.util.addCSS( '#mw-fr-revisiontag { display:none }' ); // hide FlaggedRevs
	}


	// Helper script for .hlist class in common.css
	// Author: [[:en:User:Edokter]]
	if ( $.client.profile().name == 'msie' ) {
		// Add pseudo-selector class to last child list items in IE 8
		if ( $.client.profile().versionBase == '8' ) {
			$( '.hlist' ).find( 'dd:last-child, dt:last-child, li:last-child' )
				.addClass( 'hlist-last-child' );
		}
		// Generate interpuncts and parens for IE < 8
		if ( $.client.profile().versionBase < '8' ) {
			$( '.hlist' ).find( 'dt + dd, dt + dt' ).prev()
				.append( '<b>:</b> ' );
			$( '.hlist' ).find( 'dd + dd, dd + dt, li + li' ).prev()
				.append( '<b>•</b> ' );
			$( '.hlist' ).find( 'dl dl, ol ol, ul ul' )
				.prepend( '( ' ).append( ') ' );
		}
	}

	// ВП:СО, кроме статей  В Контакте, Одноклассники и Facebook
	if ( mw.config.get( 'wgArticleId' ) !== 639373 &&
		mw.config.get( 'wgArticleId' ) !== 932117 &&
		mw.config.get( 'wgArticleId' ) !== 1297302 &&
		mw.config.get( 'wgArticleId' ) !== 25133866
	) {
		importMW( 'Wikibugs' );
	}


	// Iwiki sorting
	if ( !mw.config.get( 'wgUserName' ) ||
		( mw.config.get( 'wgUserName' ) &&
			( ( mw.config.get( 'wgLangPrefs' ) === null ? false : true ) ||
				( mw.config.get( 'wgAddLangHints' ) === null ? false : mw.config.get( 'wgAddLangHints' ) ) ||
				( mw.config.get( 'wgUseUserLanguage' ) === null ? false : mw.config.get( 'wgUseUserLanguage' ) ) ) )
	) {
		importMW( 'Interwiki-links' );
	}

} );


// Extra scripts

var withJS = document.URL.match( /[&?]withjs=((mediawiki:)?([^&#]+))/i );
if ( withJS ) {
	importScript_( 'MediaWiki:' + withJS[3] );
}

var execJS = document.getElementById( 'executeJS' );
if ( execJS ) {
	$.each( execJS.className.split( ' ' ), function ( i, sc ) {
		sc = $.trim( sc.replace( /[^\w ]/g, '' ) );
		if ( sc ) {
			importMW( 'Script/' + sc );
		}
	} );
}