MediaWiki:Common.js
Appearance
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. */
mw.hook('wikipage.content').add(function () {
const logo = document.querySelector('a.mw-logo');
if (logo) {
logo.setAttribute('href', 'https://fedoverse.com');
}
});
mw.hook('wikipage.content').add(function () {
const button = document.querySelector('.your-button-class');
if (!button) return;
const premiumEase = 'cubic-bezier(0.23, 1, 0.32, 1)';
button.addEventListener('mouseenter', () => {
button.style.transition = `transform 0.15s ${premiumEase}`;
});
button.addEventListener('mousemove', (e) => {
const rect = button.getBoundingClientRect();
const x = (e.clientX - rect.left - rect.width / 2) / (rect.width / 2);
const y = (e.clientY - rect.top - rect.height / 2) / (rect.height / 2);
button.style.transform = `perspective(400px) scale(1.05) rotateX(${y * -15}deg) rotateY(${x * 15}deg)`;
});
button.addEventListener('mouseleave', () => {
button.style.transition = `transform 0.65s ${premiumEase}`;
// Force the browser to commit the 0.65s transition before updating the transform
void button.offsetHeight;
button.style.transform = 'perspective(400px) scale(1) rotateX(0deg) rotateY(0deg)';
});
});