MediaWiki:Common.js: Difference between revisions

From BetaHaven Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 4: Line 4:


$(document).ready(function() {
$(document).ready(function() {
     $('a[href*="/User:"], a[href*="index.php?title=User:"]').not('#ca-nstab-user a, #p-personal a').each(function() {
     $('#mw-content-text a[href*="/Player:"], #mw-content-text a[href*="index.php?title=Player:"]').each(function() {
         if ($(this).find('img').length > 0) return;
         if ($(this).find('img').length > 0) return;
         var username = $(this).attr('href').match(/User:([^&|#/]+)/);
         var username = $(this).attr('href').match(/Player:([^&|#/]+)/);
         if (!username) return;
         if (!username) return;
         var wikiName = decodeURIComponent(username[1]);
         var wikiName = decodeURIComponent(username[1]);

Latest revision as of 05:56, 15 October 2026

var skinOverrides = {
    'Jivezap': 'Jivezap_',
};

$(document).ready(function() {
    $('#mw-content-text a[href*="/Player:"], #mw-content-text a[href*="index.php?title=Player:"]').each(function() {
        if ($(this).find('img').length > 0) return;
        var username = $(this).attr('href').match(/Player:([^&|#/]+)/);
        if (!username) return;
        var wikiName = decodeURIComponent(username[1]);
        var mcName = skinOverrides[wikiName] || wikiName;
        var img = $('<img>')
            .attr('src', 'https://minotar.net/helm/' + encodeURIComponent(mcName) + '/16')
            .css({ width: '16px', height: '16px', verticalAlign: 'middle', marginRight: '4px', imageRendering: 'pixelated' });
        $(this).prepend(img);
    });
});