MediaWiki:Common.js: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
/* | /* Qualquer JavaScript aqui será carregado para todos os utilizadores. */ | ||
$(function() { | $(function() { | ||
// 1. DEFINIÇÃO DO HTML DO FOOTER (Fiel à imagem que enviaste) | |||
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 28: | Line 22: | ||
// COLUNAS DE LINKS (DIREITA) | // COLUNAS DE LINKS (DIREITA) | ||
'<div style="flex: 3; display: flex; flex-wrap: wrap; justify-content: space-between;">' + | '<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>Menu</h4><a href="/">Home</a><a href="/about-us/">About us</a><a href="/hardware/">Hardware</a><a href="/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>Solutions</h4><a href="/solutions/aquaguard/">Aquaguard</a><a href="/solutions/firefly/">Firefly</a><a href="/solutions/melisafe/">Melisafe</a><a href="/solutions/prevent/">Prevent</a></div>' + | |||
'<div class="atronia-col"><h4>Shop</h4><a href="/product/monarch-gateway/">Monarch</a><a href="/product/atlas-sbc/">Atlas</a><a href="/product-category/probes/">Probes</a><a href="/product-category/accessories/">Accessories</a></div>' + | |||
'<div class="atronia-col"><h4>Support</h4><a href="https://wiki.atronia.eu/">Wiki</a></div>' + | '<div class="atronia-col"><h4>Support</h4><a href="https://wiki.atronia.eu/">Wiki</a></div>' + | ||
'</div>' + | '</div>' + | ||
'</div>' + | '</div>' + | ||
'<hr style="border: 0; border-top: 1px solid rgba(255,255,255,0.1); margin: 40px 0;">' + | '<hr style="border: 0; border-top: 1px solid rgba(255,255,255,0.1); margin: 40px 0;">' + | ||
| Line 50: | Line 39: | ||
'</div>' + | '</div>' + | ||
'<div style="max-width: 1400px; margin: 40px auto 0; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.05);">' + | '<div style="max-width: 1400px; margin: 40px auto 0; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.05);">' + | ||
'<a href="/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/livro-de-reclamacoes/" style="color: #ffffff; font-weight: bold; text-decoration: underline; font-size: 13px;">Livro de Reclamações</a> | ' + | ||
'<a href="/privacy-policy/" style="color: #ffffff; font-weight: bold; text-decoration: underline; font-size: 13px;">Privacy Policy</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>' + | '<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>' + | ||
'</div>'; | '</div>'; | ||
// 2. INJEÇÃO DO FOOTER | |||
var target = $('#footer, #mw-footer, .mw-footer, #catlinks'); | var target = $('#footer, #mw-footer, .mw-footer, #catlinks'); | ||
if (target.length) { target.before(footerHTML); } else { $('body').append(footerHTML); } | |||
if (target.length) { | |||
// 3. BOTÃO DE COPIAR MODERNO | |||
/ | |||
$('.mw-highlight').each(function() { | $('.mw-highlight').each(function() { | ||
var $block = $(this); | var $block = $(this); | ||
if ($block.find('.copy-btn').length > 0) return; | 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({ | |||
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;"> | '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 $button = $('<button>') | |||
$button.on('click', function( | |||
var text = $block.find('pre').text(); | var text = $block.find('pre').text(); | ||
navigator.clipboard.writeText(text).then(function() { | navigator.clipboard.writeText(text).then(function() { | ||
$button.find('span').text('Copied!'); | $button.find('span').text('Copied!'); | ||
setTimeout(function() { $button.find('span').text('Copy'); }, 2000); | |||
setTimeout(function() { | |||
}); | }); | ||
}); | }); | ||
$block.css('position', 'relative').prepend($button); | $block.css('position', 'relative').prepend($button); | ||
}); | }); | ||
}); | }); | ||
/ | // 4. GOOGLE ANALYTICS (Fora do $(function) para carregar logo) | ||
$(function | 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'); | |||
Revision as of 16:31, 28 April 2026
/* Qualquer JavaScript aqui será carregado para todos os utilizadores. */
$(function() {
// 1. DEFINIÇÃO DO HTML DO FOOTER (Fiel à imagem que enviaste)
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
var target = $('#footer, #mw-footer, .mw-footer, #catlinks');
if (target.length) { target.before(footerHTML); } else { $('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');