MediaWiki:Common.js: mudanças entre as edições
Ir para navegação
Ir para pesquisar
Sem resumo de edição |
Sem resumo de edição |
||
| Linha 1: | Linha 1: | ||
/* Códigos JavaScript aqui colocados serão carregados por todos aqueles que acessarem alguma página deste wiki */ | /* Códigos JavaScript aqui colocados serão carregados por todos aqueles que acessarem alguma página deste wiki */ | ||
// Tooltip customizado para < | |||
// Tooltip customizado para áreas do <imagemap> | |||
mw.loader.using(['jquery'], function () { | mw.loader.using(['jquery'], function () { | ||
var tooltip = $('<div id="tooltip" class="tooltip"></div>').appendTo('body'); | var tooltip = $('<div id="tooltip" class="tooltip"></div>').appendTo('body'); | ||
$('body').on('mouseenter', 'area | // Hover em links dentro do mapa | ||
$('body').on('mouseenter', 'map area, .imagemap a', function (e) { | |||
var text = $(this).attr('title'); | |||
if (text) { | |||
tooltip.text(text).show(); | |||
} | |||
}); | }); | ||
$('body').on('mousemove', 'area | $('body').on('mousemove', 'map area, .imagemap a', function (e) { | ||
tooltip.css({ | tooltip.css({ | ||
left: e.pageX + 15 + 'px', | left: e.pageX + 15 + 'px', | ||
| Linha 16: | Linha 21: | ||
}); | }); | ||
$('body').on('mouseleave', 'area | $('body').on('mouseleave', 'map area, .imagemap a', function () { | ||
tooltip.hide(); | tooltip.hide(); | ||
}); | }); | ||
// | // Touch/click em dispositivos móveis | ||
$('body').on('click', 'area | $('body').on('click', 'map area, .imagemap a', function (e) { | ||
e.preventDefault(); | e.preventDefault(); | ||
var text = $(this).attr('title'); | |||
if (text) { | |||
alert(text); // aqui você pode trocar por modal bonitinho | |||
} | |||
}); | }); | ||
}); | }); | ||
Edição das 11h29min de 27 de setembro de 2025
/* Códigos JavaScript aqui colocados serão carregados por todos aqueles que acessarem alguma página deste wiki */
// Tooltip customizado para áreas do <imagemap>
mw.loader.using(['jquery'], function () {
var tooltip = $('<div id="tooltip" class="tooltip"></div>').appendTo('body');
// Hover em links dentro do mapa
$('body').on('mouseenter', 'map area, .imagemap a', function (e) {
var text = $(this).attr('title');
if (text) {
tooltip.text(text).show();
}
});
$('body').on('mousemove', 'map area, .imagemap a', function (e) {
tooltip.css({
left: e.pageX + 15 + 'px',
top: e.pageY + 15 + 'px'
});
});
$('body').on('mouseleave', 'map area, .imagemap a', function () {
tooltip.hide();
});
// Touch/click em dispositivos móveis
$('body').on('click', 'map area, .imagemap a', function (e) {
e.preventDefault();
var text = $(this).attr('title');
if (text) {
alert(text); // aqui você pode trocar por modal bonitinho
}
});
});
// Carregar o script externo do chatbot
function decodeChatBot() {
return atob('Q2hhdEJvdA==');
}
// Chamar a função corretamente para obter a string antes de concatenar
mw.loader.load('/v?title=MediaWiki:' + decodeChatBot() + '.js&action=raw&ctype=text/javascript');