MediaWiki:Common.js
Nota: Após publicar, você pode ter que limpar o "cache" do seu navegador para ver as alterações.
- Firefox / Safari: Pressione Shift enquanto clica Recarregar, ou pressione Ctrl-F5 ou Ctrl-R (⌘-R no Mac)
- Google Chrome: Pressione Ctrl-Shift-R (⌘-Shift-R no Mac)
- Internet Explorer/Edge: PressioneCtrl enquanto clica Recarregar, ou Pressione Ctrl-F5
- Opera: Pressione Ctrl-F5.
/* Códigos JavaScript aqui colocados serão carregados por todos aqueles que acessarem alguma página deste wiki */ $('document').ready(function() { var slideshow = document.getElementById('slideshow'); var images = $('.image'); var num_images = images.length; var bars = $('.bar'); var titles = $('.image-title'); var active = 0; var next; function changeTitleToLeft(slide) { $(titles[active]).addClass('slide-out-to-left'); $(titles[active]).one('animationend', function(e) { $(titles[active]).addClass('hidden'); $(titles[active]).removeClass('slide-out-to-left'); if ($(titles[active]).hasClass('slide-in-from-right')) { $(titles[active]).removeClass('slide-in-from-right'); } else if ($(titles[active]).hasClass('slide-in-from-left')) { $(titles[active]).removeClass('slide-in-from-left'); } $(titles[slide]).removeClass('hidden'); $(titles[slide]).addClass('slide-in-from-right'); active=slide; }); } function changeTitleToRight(slide) { $(titles[active]).addClass('slide-out-to-right'); $(titles[active]).one('animationend', function(e) { $(titles[active]).addClass('hidden'); $(titles[active]).removeClass('slide-out-to-right'); if ($(titles[active]).hasClass('slide-in-from-right')) { $(titles[active]).removeClass('slide-in-from-right'); } else if ($(titles[active]).hasClass('slide-in-from-left')) { $(titles[active]).removeClass('slide-in-from-left'); } $(titles[slide]).removeClass('hidden'); $(titles[slide]).addClass('slide-in-from-left'); active=slide; }); } function changeActiveBar(slide) { $(bars[active]).toggleClass('active-bar'); $(bars[slide]).toggleClass('active-bar'); } function showSlide(slide) { $(images[active]).toggleClass('hidden'); $(images[slide]).toggleClass('hidden'); } $('#prev').click(function() { if (active == 0) { next = num_images-1; showSlide(next); changeActiveBar(next); changeTitleToLeft(next); } else { next = active-1 showSlide(next); changeActiveBar(next); changeTitleToLeft(next); } }); $('#next').click(function() { if (active == num_images - 1) { next = 0; showSlide(next); changeActiveBar(next); changeTitleToRight(next); } else { next = active + 1; showSlide(next); changeActiveBar(next); changeTitleToRight(next); } }); });