MediaWiki:Common.js

De Micropedia
Revisão de 03h54min de 12 de abril de 2026 por Imperador Crow (discussão | contribs) (teste 02)
Ir para navegação Ir para pesquisar

Nota: Após salvar, você pode ter que limpar o "cache" do seu navegador para ver as alterações.

  • Firefox / Safari: Pressione Shift enquanto clica Recarregar, ou pressione Ctrl-F5 ou Ctrl-R (⌘-R no Mac)
  • Google Chrome: Pressione Ctrl-Shift-R (⌘-Shift-R no Mac)
  • Internet Explorer: PressioneCtrl enquanto clica Recarregar, ou Pressione Ctrl-F5
  • Opera: Vá para Menu → Configurações (Opera → Preferencias no Mac) e depois para Privacidade e Segurança → Limpar dados de navegação → Imagens e arquivos em cache.
/* 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;
    });
});
jQuery(document).ready(function ($) {

    /* Sai imediatamente se não for a Main Page */
    if (!$('body').hasClass('page-Main_Page')) return;

    /* ── 1. TICKER ── */
    $('marquee').each(function () {
        $(this).closest('div, p')
            .css({ 'border-radius': '6px', 'overflow': 'hidden' });
    });

    /* ── 2. CARDS — border-radius via JS como fallback para <table> ── */
    $('table.MainPageBG.mph-card, table.mph-card').each(function () {
        $(this).css({
            'border-radius':   '10px',
            'overflow':        'hidden',
            'border-collapse': 'separate'
        });
    });

    /* ── 3. BOTÃO VOLTAR AO TOPO ── */
    var $btn = $('<button id="mph-top" title="Voltar ao topo">▲</button>').css({
        position:     'fixed',
        bottom:       '20px',
        right:        '20px',
        background:   '#9bbeab',
        color:        '#1a3a28',
        border:       '1px solid #82a895',
        borderRadius: '50%',
        width:        '36px',
        height:       '36px',
        fontSize:     '14px',
        fontWeight:   'bold',
        cursor:       'pointer',
        display:      'none',
        zIndex:       999,
        lineHeight:   '34px',
        textAlign:    'center',
        boxShadow:    '0 2px 6px rgba(0,0,0,0.18)'
    });
    $('body').append($btn);

    $(window).on('scroll.mph', function () {
        $btn.toggle($(this).scrollTop() > 300);
    });
    $btn.on('click', function () {
        $('html, body').animate({ scrollTop: 0 }, 350);
    });

    /* ── 4. LINKS EXTERNOS — nova aba ── */
    $('.mph-card a[href^="http"]')
        .not('a[href*="' + window.location.hostname + '"]')
        .attr({ target: '_blank', rel: 'noopener noreferrer' });

});