MediaWiki:Vector.js: Difference between revisions

From Forklift Certified Video Games
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) {
document.addEventListener('DOMContentLoaded', function () {
     instance.play(); // Starts slideshow automatically
     var slideshows = document.querySelectorAll('.news-slideshow-container');
    instance.setDelay(4000); // 4s between slides
});


 
     slideshows.forEach(function (container) {
( function () {
         var slides = container.querySelectorAll('.news-slideshow-slide');
    var sliders = document.querySelectorAll('.news-slider');
         if (slides.length <= 1) return;
 
     sliders.forEach(function(slider){
         var slides = slider.querySelectorAll('.news-slide');
         if(slides.length <= 1) return;


         var current = 0;
         var current = 0;
         slides[current].classList.add('active');
         slides[current].classList.add('active');


         setInterval(function(){
         setInterval(function () {
             slides[current].classList.remove('active');
             slides[current].classList.remove('active');
             current = (current + 1) % slides.length;
             current = (current + 1) % slides.length;
             slides[current].classList.add('active');
             slides[current].classList.add('active');
         }, 4000); // 4 seconds per slide
         }, 3000); // Change slide every 3 seconds
     });
     });
})();
});
 





Revision as of 23:02, 24 January 2026

/* All JavaScript here will be loaded for users of the Vector skin */

document.addEventListener('DOMContentLoaded', function () {
    var slideshows = document.querySelectorAll('.news-slideshow-container');

    slideshows.forEach(function (container) {
        var slides = container.querySelectorAll('.news-slideshow-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');
        }, 3000); // Change slide every 3 seconds
    });
});



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';
});