MediaWiki:Common.js: mudanças entre as edições

De wiki.verde.rj.def.br
Ir para navegação Ir para pesquisar
Sem resumo de edição
Etiqueta: Reversão manual
Sem resumo de edição
 
(7 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
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 áreas do <imagemap>
mw.loader.using(["jquery"], function () {
  var tooltip = $('<div id="tooltip" class="tooltip"></div>').appendTo("body");
  // Hover desktop
  $("body").on("mouseenter", "map area, .imagemap a", function () {
    var $el = $(this);
    var text = $el.attr("title") || $el.data("tooltip");
    if (text) {
      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();
  });
  // Touch / clique
  $("body").on("click", "map area, .imagemap a", function (e) {
    var $el = $(this);
    var text = $el.data("tooltip");
    var href = $el.attr("href");
    if (text) {
      // Mostra tooltip no mobile
      tooltip.text(text).show();
      // Se NÃO tem link (href vazio ou "#"), evita highlight azul
      if (!href || href === "#") {
        e.preventDefault();
        e.stopPropagation();
        return false;
      }
      // Se tiver link -> segue fluxo normal (redireciona)
      // Não fazemos preventDefault
    }
  });
});


// Carregar o script externo do chatbot
// Carregar o script externo do chatbot


function decodeChatBot() {
function decodeChatBot() {
    return atob('Q2hhdEJvdA==');  
  return atob("Q2hhdEJvdA==");
}
}


// Chamar a função corretamente para obter a string antes de concatenar
// 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');
mw.loader.load(
  "/v?title=MediaWiki:" +
    decodeChatBot() +
    ".js&action=raw&ctype=text/javascript"
);

Edição atual tal como às 11h55min 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 desktop
  $("body").on("mouseenter", "map area, .imagemap a", function () {
    var $el = $(this);
    var text = $el.attr("title") || $el.data("tooltip");

    if (text) {
      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();
  });

  // Touch / clique
  $("body").on("click", "map area, .imagemap a", function (e) {
    var $el = $(this);
    var text = $el.data("tooltip");
    var href = $el.attr("href");

    if (text) {
      // Mostra tooltip no mobile
      tooltip.text(text).show();

      // Se NÃO tem link (href vazio ou "#"), evita highlight azul
      if (!href || href === "#") {
        e.preventDefault();
        e.stopPropagation();
        return false;
      }
      // Se tiver link -> segue fluxo normal (redireciona)
      // Não fazemos preventDefault
    }
  });
});


// 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"
);