欢迎来到 Mario Forever 百科!编辑前请创建一个账号,或使用现有的账号登录;并认真阅读用户须知

自2020年7月14日起,未验证邮箱的用户将无法编辑页面。请前往参数设置验证邮箱,谢谢您的配合。

MediaWiki:Mobile.js

来自Mario Forever 百科
跳转到导航 跳转到搜索

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
  • Opera:Ctrl-F5
/* 这里的任何JavaScript将为使用移动版网站的用户加载 */

/* 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');
});

/* Add subpages link on user pages */
$(function() {
	var namespace = mw.config.get('wgCanonicalNamespace');
	var title = mw.config.get('wgTitle');
	if (namespace === 'User' && title.indexOf('/') < 0)
		$('.user-links').append('<li> <a href="/Special:PrefixIndex/User:' + title + '/">Subpages</a></li>');
});

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

/* Adjust table of contents to fit with infobox */
$(function() {
	var body = $('#bodyContent');
	var infobox = $('.infobox');

	if (infobox) {
	    var maxWidth = Math.round(body.width() - infobox.outerWidth(true) - 10);
	    $('head').append('<style type="text/css">.toc-mobile { max-width: ' + maxWidth + 'px; }</style>');
	}
});
function tocResizer() {
	var body = $('#bodyContent');
	var infobox = $('.infobox');
	var toc = $('.toc-mobile');

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