MediaWiki:Common.js

OMNIVERSE
Revision as of 02:59, 25 January 2026 by Jbacot (talk | contribs)

Note: After publishing, 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 / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
// Make image links open the full resolution image directly
$(document).ready(function() {
    $('.mw-parser-output a.image').each(function() {
        var $link = $(this);
        var $img = $link.find('img');
        
        if ($img.length) {
            var src = $img.attr('src');
            
            // Convert thumbnail URL to full image URL
            // From: /images/thumb/f/fd/Sunny_Meadows.png/300px-Sunny_Meadows.png
            // To: /images/f/fd/Sunny_Meadows.png
            var fullSrc = src.replace(/\/thumb(\/[^\/]+\/[^\/]+\/)(\d+px-)?(.+)$/, '$1$3');
            
            // Update the link href
            $link.attr('href', fullSrc);
        }
    });
});