MediaWiki:Vector.js: Difference between revisions
Jump to navigation
Jump to search
| Line 1: | Line 1: | ||
/* All JavaScript here will be loaded for users of the Vector skin */ | /* All JavaScript here will be loaded for users of the Vector skin */ | ||
mw.hook('gallery.slideshowInstanceCreated').add(function (instance) { | |||
instance.play(); // Starts slideshow automatically | |||
instance.setDelay(4000); // 4s between slides | |||
}); | |||
( function () { | ( function () { | ||
| Line 18: | Line 24: | ||
}); | }); | ||
})(); | })(); | ||
Revision as of 22:56, 24 January 2026
/* All JavaScript here will be loaded for users of the Vector skin */
mw.hook('gallery.slideshowInstanceCreated').add(function (instance) {
instance.play(); // Starts slideshow automatically
instance.setDelay(4000); // 4s between slides
});
( function () {
var sliders = document.querySelectorAll('.news-slider');
sliders.forEach(function(slider){
var slides = slider.querySelectorAll('.news-slide');
if(slides.length <= 1) return;
var current = 0;
slides[current].classList.add('active');
setInterval(function(){
slides[current].classList.remove('active');
current = (current + 1) % slides.length;
slides[current].classList.add('active');
}, 4000); // 4 seconds per slide
});
})();
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';
});