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'); | |||