Board Thread:Announcements/@comment-28083312-20170105041530/@comment-32638135-20170105143733

Ursuul wrote: Done! It was stolen from the Shadow of Mordor Wiki, and here it is:

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); }