MediaWiki:Common.js

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

/* Main Page maintain link on shorter side */ if (mw.config.get('wgTitle') === 'Main Page') { function mainPageMaintain { var leftHeight = $('#featured').height + 10 + $('#poll').height + 10 + $('#shroom').height; var rightHeight = $('#news').height + 10 + $('#dyk').height; if ( rightHeight > leftHeight ) { $("#maintain-right").hide; $("#maintain-left").show; }	}	$(mainPageMaintain); }

/* Automatically add Aboutfile template to file upload description. Source: nl.wikipedia.org/wiki/MediaWiki:Common.js */ if (mw.config.get('wgCanonicalSpecialPageName') === 'Upload' && !document.getElementById('wpForReUpload') && !document.getElementsByClassName('mw-destfile-warning')[0] && !document.getElementsByClassName('error')[0]) { function loadAutoAboutfileTemplate { uploadDescription = document.getElementById('wpUploadDescription'); var doubleBracket = '{' + '{'; uploadDescription.value = doubleBracket + 'aboutfile\n|1=Subject of the image\n|2=Where you found the image\n|3=Artist\n|4=Describe edits, if any\n|5=Other versions (use file link)\n}}\n' + doubleBracket + 'uncategorized}}'; }	$(loadAutoAboutfileTemplate); }

/* Add a drop-down menu for CheckUser reasons */ if (mw.config.get('wgCanonicalSpecialPageName') === 'CheckUser') { function checkUserReasonMenu { var field = document.getElementById('checkreason'); var menu = 'Please select a reason... Routine new user check Suspected sockpuppet account Matching a vandal account Other '; field.outerHTML = menu; }	$(checkUserReasonMenu);

function checkUserOther(name) { if (name == 'Other') { var menu = document.getElementById('checkreason'); var field = ''; menu.outerHTML = field; }	} }

/* Fix Recent Changes top-right links when new user message */ if (mw.config.get('wgCanonicalSpecialPageName') === 'Recentchanges' && document.getElementsByClassName('usermessage')[0]) { function fixRcLinks { var rcTopLinks = $('#rc-floatlinks'); rcTopLinks.css('top', '-44'); }	$(fixRcLinks); }