MediaWiki:Vector.js
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.
/* All JavaScript here will be loaded for users of the Vector skin */
document.addEventListener('click', function (e) {
const header = e.target.closest('.pf-collapsible');
if (!header) return;
const targetId = header.dataset.target;
const section = document.getElementById(targetId);
if (!section) return;
const isOpen = section.style.display === 'block';
section.style.display = isOpen ? 'none' : 'block';
});
mw.hook('wikipage.content').add(function($content) {
const sliders = $content.find(".news-slider");
sliders.each(function() {
const slides = $(this).find(".news-slide");
let current = 0;
// Hide all slides except first
slides.css('opacity', 0);
slides.eq(0).css('opacity', 1);
setInterval(() => {
slides.eq(current).css('opacity', 0);
current = (current + 1) % slides.length;
slides.eq(current).css('opacity', 1);
}, 4000); // 4 seconds per slide
});
});