MediaWiki:Wikia.js

// Interwiki links //Taken from http://shadowofmordor.wikia.com/wiki/MediaWiki:Wikia.js by MarkvA function appendLanguageDropdown { var borderColor = $('.WikiaPageHeader .comments').css('border-top-color'); var server = wgServer.replace("http://",""); var html = '   '; flags = {}; flags['nl'] = ''; flags['ja'] = ''; flags['it'] = ''; flags['fr'] = ''; flags['pl'] = ''; flags['de'] = ''; flags['ru'] = ''; flags['zh'] = ''; flags['es'] = ''; flags['en'] = ''; $('.WikiaPageHeader .comments').after(html); languages = {}; $('.WikiaArticleInterlang ul li a').each(function {		var languageFull = $(this).text;		var href = $(this).attr('href');		var pageNameArray = href.split('/')		var pageName = pageNameArray[pageNameArray.length - 1];		switch (languageFull) {			case "English":				languages['en'] = href;				break;			case "Español":				languages['es'] = href;				break;			case "中文":				languages['zh'] = href;				break;			case "Русский":				languages['ru'] = href;				break;			case "Deutsch":				languages['de'] = href;				break;			case "Polski":				languages['pl'] = href;				break;			case "Français":				languages['fr'] = href;				break;			case "Italiano":				languages['it'] = href;				break;			case "日本語":				languages['ja'] = href;				break;			case "Nederlands":				languages['nl'] = href;				break;		}	}); var language = wgContentLanguage; $.each(flags, function (key, value) {		if (key === language) {			$('.WikiaPageHeader .chooselanguage').prepend(flags[key]);		} 		else {			if (languages[key]) {				$('.WikiaPageHeader .chooselanguage ul').prepend('' + flags[key] + '</li></a>');			}		}	}); $('.WikiaPageHeader .chooselanguage').on('click', function {		if ($(this).hasClass('active') === false) {			$(this).addClass('active');		} 		else {			$(this).removeClass('active');		}	}); $('.WikiaPageHeader .chooselanguage').on('mouseleave', function {		var that = this;		var timeOut = setTimeout(function  { $(that).removeClass('active'); }, 500);		$('.chooselanguage').on('mouseenter', function  { clearTimeout(timeOut); });	}); } if( $('.WikiaArticleInterlang').length > 0 ) { addOnloadHook(appendLanguageDropdown); } $(document).ready(function {	if(!mediaWiki.config.get('wgUserName')) { // If username is not set (the user is logged out), hide the "Flags" dropdown options		$('.wikia-menu-button .flags-access-class').parent.remove;	} });