MediaWiki:Common.js: Difference between revisions

OMNIVERSE
Tag: Replaced
No edit summary
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
// Simpler: Make image links open the full resolution image
$('.mw-parser-output a.image').each(function() {
    var $img = $(this).find('img');
    if ($img.length) {
        var src = $img.attr('src');
        // Remove thumbnail path to get full image
        var fullSrc = src.replace(/\/thumb\//, '/').replace(/\/\d+px-[^/]+$/, '');
        $(this).attr('href', fullSrc);
    }
});

Revision as of 02:58, 25 January 2026

/* Any JavaScript here will be loaded for all users on every page load. */
// Simpler: Make image links open the full resolution image
$('.mw-parser-output a.image').each(function() {
    var $img = $(this).find('img');
    if ($img.length) {
        var src = $img.attr('src');
        // Remove thumbnail path to get full image
        var fullSrc = src.replace(/\/thumb\//, '/').replace(/\/\d+px-[^/]+$/, '');
        $(this).attr('href', fullSrc);
    }
});