MediaWiki:Common.js
Jump to navigation
Jump to search
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.
$(function () {
const $button = $('<div id="back-to-top">Back to Top ↑</div>');
$('body').append($button);
$button.on('click', function () {
$('html, body').animate({ scrollTop: 0 }, 500);
});
$(window).on('scroll', function () {
if ($(this).scrollTop() > 300) {
$button.fadeIn();
} else {
$button.fadeOut();
}
});
});
$(document).ready(function () {
const footerIcons = $('#footer-icons');
if (!footerIcons.length) return;
// Clear default icons if needed
footerIcons.empty();
const links = [
{
href: 'https://discord.gg/realmofthrones',
icon: 'https://cdn.simpleicons.org/discord/5865F2',
label: 'Discord'
},
{
href: 'https://www.reddit.com/r/BannerlordRoT/',
icon: 'https://cdn.simpleicons.org/reddit/FF4500',
label: 'Reddit'
},
{
href: 'https://www.instagram.com/official_realm_of_thrones/?hl=en',
icon: 'https://cdn.simpleicons.org/instagram/E1306C',
label: 'Instagram'
},
{
href: 'https://www.nexusmods.com/mountandblade2bannerlord/mods/2907',
icon: 'https://cdn.simpleicons.org/nexusmods/FCA311',
label: 'NexusMods'
},
{
href: 'https://www.moddb.com/mods/realm-of-thrones',
icon: 'https://upload.wikimedia.org/wikipedia/commons/f/f9/ModDB_Logo.png',
label: 'ModDB'
}
];
links.forEach(({ href, icon, label }) => {
const li = $('<li>').css({
display: 'inline-block',
margin: '0 6px'
});
const a = $('<a>')
.attr('href', href)
.attr('title', label)
.attr('target', '_blank')
.css({
display: 'inline-block',
width: '28px',
height: '28px',
backgroundImage: `url(${icon})`,
backgroundSize: 'contain',
backgroundRepeat: 'no-repeat',
backgroundPosition: 'center',
filter: 'brightness(0.9)',
transition: 'filter 0.3s ease'
})
.hover(
function () {
$(this).css('filter', 'brightness(1.2)');
},
function () {
$(this).css('filter', 'brightness(0.9)');
}
);
li.append(a);
footerIcons.append(li);
});
});