MediaWiki:Mobile.js

/* Any JavaScript here will be loaded for users using the mobile site */

/* Adjust margin of thumbs with no caption */ function thumbFixer { $('.thumb').each(function(i, obj) {		if (!$(this).find('.thumbcaption').text) {			if (window.matchMedia('all and (max-width: 719px)').matches)				$(this).css('margin-bottom', '0.75em');			else				$(this).css('margin-bottom', '');		}	}); } $(thumbFixer); $(window).resize(function {	$(thumbFixer); });

/* KHWiki: Adjust table of contents to fit with infobox */ $(function {	var body = $('#bodyContent');	var infobox = $('.infobox');	var leftboxWidth = 315 + 16;

if (infobox) { var maxWidth = Math.round(body.width - leftboxWidth - 10); $('head').append('.toc-mobile { max-width: ' + maxWidth + 'px; } '); } }); function tocResizer {	var body = $('#bodyContent');	var infobox = $('.infobox');	var leftboxWidth = 315 + 16;	var toc = $('.toc-mobile');

if (infobox && toc) { var maxWidth = Math.round(body.width - leftboxWidth - 10); toc.css('max-width', maxWidth); } } $(window).resize(function {	$(tocResizer); });