MediaWiki:Mobile.js
Jump to navigation
Jump to search
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* Any JavaScript here will be loaded for users using the mobile site */ /* 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'); }); /* 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); }); /* MarioWiki: Position top-right icons on wide screens */ function wideGameIcons() { if (window.matchMedia('screen and (min-width: 1000px)').matches) { var goRight = Math.round(($(window).width() - 1000)/2); $('.top-right').css('right', goRight); } else { $('.top-right').css('right', ''); } } $(wideGameIcons); $(window).resize(function() { $(wideGameIcons); });