Jump to content

MediaWiki:Common.js

From ATRONIA Wiki
Revision as of 09:20, 13 March 2026 by WikiManagement (talk | contribs)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* 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);
    });
});