MediaWiki:Common.js
From Cake Popz
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.
// Load canvas-confetti library
mw.loader.load('https://cdn.jsdelivr.net/npm/canvas-confetti@1.6.0/dist/confetti.browser.min.js');
// Function to trigger confetti
function celebrateWithConfetti() {
var duration = 3 * 1000;
var end = Date.now() + duration;
(function frame() {
confetti({
particleCount: 3,
angle: 60,
spread: 55,
origin: { x: 0 }
});
confetti({
particleCount: 3,
angle: 120,
spread: 55,
origin: { x: 1 }
});
if (Date.now() < end) {
requestAnimationFrame(frame);
}
}());
}