MediaWiki:Common.js: Difference between revisions

From BetaHaven Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 21: Line 21:
             .attr('src', 'https://minerender.org/embed/skin/?skin=' + encodeURIComponent(name) + '&type=body&camera=0&shadows=true')
             .attr('src', 'https://minerender.org/embed/skin/?skin=' + encodeURIComponent(name) + '&type=body&camera=0&shadows=true')
             .attr('width', '200')
             .attr('width', '200')
            .attr('height', '400')
            .css('border', 'none');
        $(this).replaceWith(iframe);
    });
    $('.dynmap-embed').each(function() {
        var parts = $(this).attr('title').split(',');
        var x = parts[0], z = parts[1], zoom = parts[2];
        var iframe = $('<iframe>')
            .attr('src', 'http://216.201.72.47:8123/?worldname=world&mapname=flat&x=' + x + '&y=64&z=' + z + '&zoom=' + zoom)
            .attr('width', '100%')
             .attr('height', '400')
             .attr('height', '400')
             .css('border', 'none');
             .css('border', 'none');

Revision as of 23:42, 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);
    });

    $('.skinmodel').each(function() {
        var name = $(this).attr('title');
        var iframe = $('<iframe>')
            .attr('src', 'https://minerender.org/embed/skin/?skin=' + encodeURIComponent(name) + '&type=body&camera=0&shadows=true')
            .attr('width', '200')
            .attr('height', '400')
            .css('border', 'none');
        $(this).replaceWith(iframe);
    });

    $('.dynmap-embed').each(function() {
        var parts = $(this).attr('title').split(',');
        var x = parts[0], z = parts[1], zoom = parts[2];
        var iframe = $('<iframe>')
            .attr('src', 'http://216.201.72.47:8123/?worldname=world&mapname=flat&x=' + x + '&y=64&z=' + z + '&zoom=' + zoom)
            .attr('width', '100%')
            .attr('height', '400')
            .css('border', 'none');
        $(this).replaceWith(iframe);
    });
});