Jump to content

MediaWiki:Common.js: Difference between revisions

No edit summary
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
// 2. LÓGICA DA SETA (ALL MODELS)
    // Deteta o clique no contentor nativo do MediaWiki que criaste
    $('.variations-toggle').css('cursor', 'pointer').click(function() {
        // Encontra a seta com a classe .arrow-icon dentro do bloco clicado
        var $arrow = $(this).find('.arrow-icon');
       
        // Alterna a classe de rotação configurada no CSS
        $arrow.toggleClass('rotated');
    });
$(function() {
    // Procura apenas por blocos de código técnicos e ignora a área de produtos
    $('.mw-highlight pre, .syntaxhighlight pre, pre.mw-code-example').each(function() {
        var $this = $(this);
       
        // Verifica se o elemento já tem um botão para não duplicar
        if ($this.parent().find('.copy-code-button').length > 0) return;
        var $button = $('<button>')
            .text('Copy')
            .addClass('copy-code-button')
            .click(function() {
                var text = $this.text();
                navigator.clipboard.writeText(text).then(function() {
                    $button.text('Copied!');
                    setTimeout(function() { $button.text('Copy'); }, 2000);
                });
            });
        // Insere o botão antes do bloco de código
        $this.before($button);
    });
});




Line 56: Line 94:
                     '<a '+linkStyle+' href="https://atronia.eu/hardware/" target="_blank">Hardware</a>' +
                     '<a '+linkStyle+' href="https://atronia.eu/hardware/" target="_blank">Hardware</a>' +
                     '<a '+linkStyle+' href="https://atronia.eu/solutions/" target="_blank">Solutions</a>' +
                     '<a '+linkStyle+' href="https://atronia.eu/solutions/" target="_blank">Solutions</a>' +
                '</div>' +
                '<div><h4 '+titleStyle+'>Hardware</h4>' +
                    '<a '+linkStyle+' href="https://atronia.eu/hardware/monarch/" target="_blank">Monarch</a>' +                   
                    '<a '+linkStyle+' href="https://atronia.eu/hardware/atlas/" target="_blank">Atlas</a>' +
                    '<a '+linkStyle+'  target="_blank">Probes</a>' +
                    '<a '+linkStyle+'  target="_blank">Accessories</a>' +
                 '</div>' +
                 '</div>' +
                 '<div><h4 '+titleStyle+'>Solutions</h4>' +
                 '<div><h4 '+titleStyle+'>Solutions</h4>' +
Line 63: Line 107:
                     '<a '+linkStyle+' href="https://atronia.eu/solutions/prevent/" target="_blank">Prevent</a>' +
                     '<a '+linkStyle+' href="https://atronia.eu/solutions/prevent/" target="_blank">Prevent</a>' +
                 '</div>' +
                 '</div>' +
                 '<div><h4 '+titleStyle+'>Shop</h4>' +
                 '<div><h4 '+titleStyle+'>Knowledge</h4>' +
                    '<a '+linkStyle+' href="https://atronia.eu/product/monarch/" target="_blank">Monarch</a>' +
                    '<a '+linkStyle+' href="https://atronia.eu/product-category/probes/" target="_blank">Probes</a>' +
                '</div>' +
                '<div><h4 '+titleStyle+'>Support</h4>' +
                     '<a '+linkStyle+' href="https://wiki.atronia.eu">Wiki</a>' +
                     '<a '+linkStyle+' href="https://wiki.atronia.eu">Wiki</a>' +
                 '</div>' +
                 '</div>' +