MediaWiki:Common.js

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

/* Alternating wiki logo */ $(function {	var logos = ['/images/b/bc/Wiki.png', '/images/9/97/Wiki_3.png', '/images/d/d7/Wiki_2.png'];	$('#p-logo a').css('background-image', 'url(' + logos[Math.floor(Math.random * logos.length)] + ')'); });

/* Fix game icons when new user message */ $(function {	if (document.getElementsByClassName('usermessage')[0] && document.getElementById('title-linktabs'))		$('#title-linktabs').css('top', '-48px'); });

/* Hide page previews when portals are used */ $(function {	if (document.getElementsByClassName('nav')[0] && document.getElementsByClassName('dropdown')[0])		$('head').append('.mwe-popups { display: none !important; } '); });

/* Fix media negative margin bug for wide galleries */ $('.gallerybox .mediaContainer').each(function(i, obj) {	if ($(this).parent.css('margin-top') < '15px')		$(this).parent.css('margin', '15px auto'); });

/* Username inserts for the USERNAME template */ $(function {	if (typeof(disableUsernameReplace) != 'undefined' && disableUsernameReplace || mw.config.get('wgUserName') == null) return;	$('span.insertusername').each(function { $(this).text(mw.config.get('wgUserName')); }); });

/* Automatically add aboutfile template to file upload description */ $(function {	if (mw.config.get('wgCanonicalSpecialPageName') === 'Upload' && !document.getElementById('wpForReUpload') && !document.getElementsByClassName('mw-destfile-warning')[0] && !document.getElementsByClassName('error')[0]) {		uploadDescription = document.getElementById('wpUploadDescription');		var doubleBracket = '{' + '{';		uploadDescription.value = doubleBracket + 'aboutfile\n|description=\n|purpose=\n|game=\n|source=\n}}';	} });

/* Shrinking talk bubble sprites */ $(function {	if (document.readyState != "complete") {		setTimeout(arguments.callee, 100);		return;	}	$("table.talkbubble").each(function { $(this).find("td").first.width(90).css("text-align", "center").find("img").each(function {			if ($(this).width > 90) $(this).css("height", "auto").width(90);		}); }); });

/* Code for Template:Suite3 - Author: Soxra */ $(function {	$(".morphMaster").each(function { var $master = $(this); var $tabs = $master.find(".morphTabBox"); var $container = $master.find(".morphTabContainer");

$tabs.find(".morphLink").click(function {			var id = $(this).attr("id");			id = id.substr(0, id.length - 4);			$container.find(".morphContent").hide;			$container.find("#" + id + "Content").show;		}); }); });