Jump to content

MediaWiki:Common.js: Difference between revisions

From ATRONIA Wiki
No edit summary
No edit summary
Line 2: Line 2:


$(function() {
$(function() {
     // 1. DEFINIÇÃO DO HTML DO FOOTER (Fiel à imagem que enviaste)
     // 1. DEFINIÇÃO DO HTML DO FOOTER
     var footerHTML =  
     var footerHTML =  
     '<div id="custom-atronia-footer" style="background-color: #121e1c; color: #ffffff; padding: 60px 40px; font-family: sans-serif; clear: both;">' +
     '<div id="custom-atronia-footer" style="background-color: #121e1c; color: #ffffff; padding: 60px 40px; font-family: sans-serif; clear: both;">' +
Line 46: Line 46:
     '</div>';
     '</div>';


     // 2. INJEÇÃO DO FOOTER
     // 2. INJEÇÃO DO FOOTER NO FUNDO ABSOLUTO (Evita duplicados)
     var target = $('#footer, #mw-footer, .mw-footer, #catlinks');
    // Primeiro removemos qualquer versão anterior para não acumular no cache
    if (target.length) { target.before(footerHTML); } else { $('body').append(footerHTML); }
     $('#custom-atronia-footer').remove();
   
    // Injetamos no final do body para ficar fora da estrutura da skin
    $('body').append(footerHTML);


     // 3. BOTÃO DE COPIAR MODERNO
     // 3. BOTÃO DE COPIAR MODERNO
Line 68: Line 71:
     });
     });
});
});


// 4. GOOGLE ANALYTICS (Fora do $(function) para carregar logo)
// 4. GOOGLE ANALYTICS (Fora do $(function) para carregar logo)

Revision as of 16:35, 28 April 2026

/* Qualquer JavaScript aqui será carregado para todos os utilizadores. */

$(function() {
    // 1. DEFINIÇÃO DO HTML DO FOOTER
    var footerHTML = 
    '<div id="custom-atronia-footer" style="background-color: #121e1c; color: #ffffff; padding: 60px 40px; font-family: sans-serif; clear: both;">' +
        '<div class="atronia-footer-container" style="display: flex; flex-wrap: wrap; justify-content: space-between; max-width: 1400px; margin: 0 auto;">' +
            
            // COLUNA ESQUERDA: CONTACTOS
            '<div style="flex: 2; min-width: 300px; margin-bottom: 40px;">' +
                '<h4 style="font-size: 14px; font-weight: bold; margin-bottom: 20px;">Visit but keep in mind we\'re busy</h4>' +
                '<p style="font-size: 14px; color: #ccc; line-height: 1.6;">Rua do Norte 9,<br>Ílhavo, 3830-167<br>Portugal</p>' +
                '<h4 style="font-size: 14px; font-weight: bold; margin-top: 35px; margin-bottom: 20px;">Contact Us</h4>' +
                '<p style="font-size: 14px; color: #ccc; line-height: 1.6;">+351 934 886 253 (Custo de chamada para rede móvel nacional)<br>info@atronia.eu</p>' +
                '<div style="margin-top: 25px; display: flex; gap: 15px;">' +
                    '<a href="https://facebook.com/atroniatech" target="_blank"><img src="https://atronia.eu/wp-content/uploads/2023/04/facebook-white.png" width="30"></a>' +
                    '<a href="https://linkedin.com/company/atronia" target="_blank"><img src="https://atronia.eu/wp-content/uploads/2023/04/linkedin-white.png" width="30"></a>' +
                    '<a href="https://instagram.com/atroniatech" target="_blank"><img src="https://atronia.eu/wp-content/uploads/2023/04/instagram-white.png" width="30"></a>' +
                '</div>' +
            '</div>' +

            // COLUNAS DE LINKS (DIREITA)
            '<div style="flex: 3; display: flex; flex-wrap: wrap; justify-content: space-between;">' +
                '<div class="atronia-col"><h4>Menu</h4><a href="https://atronia.eu/">Home</a><a href="https://atronia.eu/about-us/">About us</a><a href="https://atronia.eu/hardware/">Hardware</a><a href="https://atronia.eu/solutions/">Solutions</a></div>' +
                '<div class="atronia-col"><h4>Solutions</h4><a href="https://atronia.eu/solutions/aquaguard/">Aquaguard</a><a href="https://atronia.eu/solutions/firefly/">Firefly</a><a href="https://atronia.eu/solutions/melisafe/">Melisafe</a><a href="https://atronia.eu/solutions/prevent/">Prevent</a></div>' +
                '<div class="atronia-col"><h4>Shop</h4><a href="https://atronia.eu/product/monarch-gateway/">Monarch</a><a href="https://atronia.eu/product/atlas-sbc/">Atlas</a><a href="https://atronia.eu/product-category/probes/">Probes</a><a href="https://atronia.eu/product-category/accessories/">Accessories</a></div>' +
                '<div class="atronia-col"><h4>Support</h4><a href="https://wiki.atronia.eu/">Wiki</a></div>' +
            '</div>' +
        '</div>' +

        '<hr style="border: 0; border-top: 1px solid rgba(255,255,255,0.1); margin: 40px 0;">' +

        // LOGOS POWERED & SPONSORED
        '<div style="display: flex; flex-wrap: wrap; align-items: flex-start; max-width: 1400px; margin: 0 auto; gap: 40px;">' +
            '<div><p style="font-size: 11px; color: #888; text-transform: uppercase; margin-bottom: 15px;">Powered by:</p><img src="https://atronia.eu/wp-content/uploads/2023/04/logo-igus.png" width="140"></div>' +
            '<div style="flex: 1;"><p style="font-size: 11px; color: #888; text-transform: uppercase; margin-bottom: 15px;">Co-sponsored by:</p>' +
                '<img src="https://atronia.eu/wp-content/uploads/2024/11/Co-Sponsored-by-Atronia-1024x224.png" style="max-width: 100%; height: auto; opacity: 0.9;">' +
            '</div>' +
        '</div>' +

        '<div style="max-width: 1400px; margin: 40px auto 0; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.05);">' +
            '<a href="https://atronia.eu/livro-de-reclamacoes/" style="color: #ffffff; font-weight: bold; text-decoration: underline; font-size: 13px;">Livro de Reclamações</a> | ' +
            '<a href="https://atronia.eu/privacy-policy/" style="color: #ffffff; font-weight: bold; text-decoration: underline; font-size: 13px;">Privacy Policy</a>' +
            '<p style="font-size: 11px; color: #555; margin-top: 20px;">This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.</p>' +
        '</div>' +
    '</div>';

    // 2. INJEÇÃO DO FOOTER NO FUNDO ABSOLUTO (Evita duplicados)
    // Primeiro removemos qualquer versão anterior para não acumular no cache
    $('#custom-atronia-footer').remove();
    
    // Injetamos no final do body para ficar fora da estrutura da skin
    $('body').append(footerHTML);

    // 3. BOTÃO DE COPIAR MODERNO
    $('.mw-highlight').each(function() {
        var $block = $(this);
        if ($block.find('.copy-btn').length > 0) return;
        var copyIcon = '<svg fill="none" stroke-width="2.5" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" height="1.2em" width="1.2em" xmlns="http://www.w3.org/2000/svg" style="margin-right: 8px; vertical-align: middle; stroke: white !important;"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>';
        var $button = $('<button>').html(copyIcon + '<span>Copy</span>').addClass('copy-btn').css({
            'position': 'absolute', 'top': '10px', 'right': '10px', 'z-index': '100', 'display': 'flex', 'align-items': 'center', 'padding': '6px 12px', 'background': '#343a40', 'color': '#f8f9fa', 'border': '1px solid #495057', 'border-radius': '6px', 'cursor': 'pointer', 'font-size': '12px'
        });
        $button.on('click', function() {
            var text = $block.find('pre').text();
            navigator.clipboard.writeText(text).then(function() {
                $button.find('span').text('Copied!');
                setTimeout(function() { $button.find('span').text('Copy'); }, 2000);
            });
        });
        $block.css('position', 'relative').prepend($button);
    });
});





// 4. GOOGLE ANALYTICS (Fora do $(function) para carregar logo)
var gaScript = document.createElement('script');
gaScript.src = "https://www.googletagmanager.com/gtag/js?id=G-MX174P23PW";
gaScript.async = true;
document.head.appendChild(gaScript);
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-MX174P23PW');