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 31: | Linha 31: | ||
$("body").on("mouseleave", "map area, .imagemap a", function () { | $("body").on("mouseleave", "map area, .imagemap a", function () { | ||
tooltip.hide(); | tooltip.hide(); | ||
}); | |||
// Para mobile/touch | |||
$('body').on('click', 'map area, .imagemap a', function (e) { | |||
e.preventDefault(); | |||
var text = $(this).data('tooltip'); | |||
if (text) { | |||
alert(text); // ou exibir num modal | |||
} | |||
}); | }); | ||
Edição das 11h51min 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");
$("body").on("mouseenter", "map area, .imagemap a", function (e) {
var $el = $(this);
// pega do title OU do data-tooltip
var text = $el.attr("title") || $el.data("tooltip");
if (text) {
// guarda em data-tooltip (se ainda não tiver) e remove title
if (!$el.data("tooltip")) {
$el.data("tooltip", text);
$el.removeAttr("title");
}
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();
});
// Para mobile/touch
$('body').on('click', 'map area, .imagemap a', function (e) {
e.preventDefault();
var text = $(this).data('tooltip');
if (text) {
alert(text); // ou exibir num modal
}
});
});
// 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"
);