Mudanças entre as edições de "MediaWiki:Common.js"
Ir para navegação
Ir para pesquisar
(este de script 02) |
(teste de script 03) |
||
| Linha 39: | Linha 39: | ||
function autoPlayGallery() { | function autoPlayGallery() { | ||
| − | $('. | + | $('.gallerycarousel').each(function () { |
const $gallery = $(this); | const $gallery = $(this); | ||
| Linha 46: | Linha 46: | ||
setInterval(function () { | setInterval(function () { | ||
| − | // | + | // Simula tecla → (ArrowRight) |
| − | + | const e = new KeyboardEvent('keydown', { | |
| − | + | key: 'ArrowRight', | |
| − | + | code: 'ArrowRight', | |
| − | + | keyCode: 39, | |
| − | }, 4000); | + | which: 39, |
| + | bubbles: true | ||
| + | }); | ||
| + | |||
| + | $gallery[0].dispatchEvent(e); | ||
| + | }, 4000); | ||
}); | }); | ||
} | } | ||
| − | |||
mw.hook('wikipage.content').add(function () { | mw.hook('wikipage.content').add(function () { | ||
autoPlayGallery(); | autoPlayGallery(); | ||
Edição das 04h53min 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() {
$('.gallerycarousel').each(function () {
const $gallery = $(this);
if ($gallery.data('autoplay')) return;
$gallery.data('autoplay', true);
setInterval(function () {
// Simula tecla → (ArrowRight)
const e = new KeyboardEvent('keydown', {
key: 'ArrowRight',
code: 'ArrowRight',
keyCode: 39,
which: 39,
bubbles: true
});
$gallery[0].dispatchEvent(e);
}, 4000);
});
}
mw.hook('wikipage.content').add(function () {
autoPlayGallery();
});
});