Jump to content

MediaWiki:Common.js

From CRSS Wiki
Revision as of 21:51, 24 June 2026 by TheClashFruit (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)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */

// skin viewer thinggy

mw.loader.getScript('https://unpkg.com/skinview3d@latest/bundles/skinview3d.bundle.js').then(function() {
	const initMinecraftSkinViewers = () => {
		const elements = document.querySelectorAll('.mc-skin-viewer');
		
		elements.forEach((el) => {
			const uuid = el.dataset.uuid;
			
			const viewer = new skinview3d.SkinViewer({
                canvas: el.appendChild(document.createElement('canvas')),
                width: parseInt(el.dataset.width) || 200,
                height: parseInt(el.dataset.height) || 300,
                skin: `https://mineskin.eu/skin/${uuid}`
            });
		});
	};
	
	$(document).ready(initMinecraftSkinViewers);
    //mw.hook('wikipage.content').add(initMinecraftSkinViewers);
});