Mudanças entre as edições de "MediaWiki:Common.js"
Ir para navegação
Ir para pesquisar
(teste de script 01) |
(este de script 02) |
||
| Linha 34: | Linha 34: | ||
}); | }); | ||
| − | / | + | /* Script teste - slideshow trocar de imagem /* |
mw.loader.using(['jquery'], function () { | mw.loader.using(['jquery'], function () { | ||
function autoPlayGallery() { | function autoPlayGallery() { | ||
| + | |||
$('.mw-gallery-slideshow').each(function () { | $('.mw-gallery-slideshow').each(function () { | ||
const $gallery = $(this); | const $gallery = $(this); | ||
| − | |||
if ($gallery.data('autoplay')) return; | if ($gallery.data('autoplay')) return; | ||
$gallery.data('autoplay', true); | $gallery.data('autoplay', true); | ||
setInterval(function () { | setInterval(function () { | ||
| − | $gallery.find('. | + | // clica no botão NEXT real (ícone oo-ui-icon-next) |
| + | $gallery | ||
| + | .find('.oo-ui-icon-next') | ||
| + | .closest('a') | ||
| + | .trigger('click'); | ||
}, 4000); // 4 segundos | }, 4000); // 4 segundos | ||
}); | }); | ||
} | } | ||
| − | // | + | // garante execução após o carregamento do conteúdo |
| − | + | mw.hook('wikipage.content').add(function () { | |
| + | autoPlayGallery(); | ||
| + | }); | ||
}); | }); | ||
Edição das 04h44min de 8 de janeiro de 2026
/* Códigos JavaScript aqui colocados serão carregados por todos aqueles que acessarem alguma página deste wiki */
$(function() {
// Cria o botão scroll-to-top button
var $botaoTopo = $('<div id="botaoTopo">⬆️ Topo</div>').css({
display: "none",
position: "fixed",
bottom: "85px", // <-- distância do roda pé (~85px)
right: "20px",
padding: "10px 15px",
background: "#9bbeab",
color: "#000",
"border-radius": "8px",
cursor: "pointer",
"box-shadow": "0 2px 6px rgba(0,0,0,0.3)",
"font-weight": "bold",
"z-index": "9999"
}).appendTo("body");
// Mostrar/esconder com base no scroll
$(window).scroll(function() {
if ($(this).scrollTop() > $(document).height() / 2) {
$botaoTopo.fadeIn();
} else {
$botaoTopo.fadeOut();
}
});
// Ação ao clicar
$botaoTopo.click(function() {
$("html, body").animate({scrollTop: 0}, 500);
return false;
});
});
/* Script teste - slideshow trocar de imagem /*
mw.loader.using(['jquery'], function () {
function autoPlayGallery() {
$('.mw-gallery-slideshow').each(function () {
const $gallery = $(this);
if ($gallery.data('autoplay')) return;
$gallery.data('autoplay', true);
setInterval(function () {
// clica no botão NEXT real (ícone oo-ui-icon-next)
$gallery
.find('.oo-ui-icon-next')
.closest('a')
.trigger('click');
}, 4000); // 4 segundos
});
}
// garante execução após o carregamento do conteúdo
mw.hook('wikipage.content').add(function () {
autoPlayGallery();
});
});