MediaWiki:Common.js: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 14: | Line 14: | ||
alert("ATRONIA JS OK"); | alert("ATRONIA JS OK"); | ||
/* Botão de Copiar para SyntaxHighlight */ | |||
$(function() { | |||
$('.mw-highlight').each(function() { | |||
var $block = $(this); | |||
if ($block.find('.copy-btn').length > 0) return; // Evita duplicados | |||
var $button = $('<button>') | |||
.text('Copy') | |||
.addClass('copy-btn') | |||
.css({ | |||
'position': 'absolute', | |||
'top': '5px', | |||
'right': '5px', | |||
'z-index': '100', | |||
'padding': '3px 8px', | |||
'background': '#3366cc', | |||
'color': '#fff', | |||
'border': 'none', | |||
'border-radius': '3px', | |||
'cursor': 'pointer', | |||
'font-size': '12px' | |||
}); | |||
$button.on('click', function() { | |||
var text = $block.find('pre').text(); | |||
navigator.clipboard.writeText(text).then(function() { | |||
$button.text('Copied!').css('background', '#00af89'); | |||
setTimeout(function() { | |||
$button.text('Copy').css('background', '#3366cc'); | |||
}, 2000); | |||
}); | |||
}); | |||
$block.css('position', 'relative').prepend($button); | |||
}); | |||
}); | |||
Revision as of 09:20, 13 March 2026
/* Any JavaScript here will be loaded for all users on every page load. */
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-MX174P23PW"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-MX174P23PW');
</script>
alert("ATRONIA JS OK");
/* Botão de Copiar para SyntaxHighlight */
$(function() {
$('.mw-highlight').each(function() {
var $block = $(this);
if ($block.find('.copy-btn').length > 0) return; // Evita duplicados
var $button = $('<button>')
.text('Copy')
.addClass('copy-btn')
.css({
'position': 'absolute',
'top': '5px',
'right': '5px',
'z-index': '100',
'padding': '3px 8px',
'background': '#3366cc',
'color': '#fff',
'border': 'none',
'border-radius': '3px',
'cursor': 'pointer',
'font-size': '12px'
});
$button.on('click', function() {
var text = $block.find('pre').text();
navigator.clipboard.writeText(text).then(function() {
$button.text('Copied!').css('background', '#00af89');
setTimeout(function() {
$button.text('Copy').css('background', '#3366cc');
}, 2000);
});
});
$block.css('position', 'relative').prepend($button);
});
});