MediaWiki:Common.js: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
/ | // 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() { | $(function() { | ||
$('pre, .mw-code | // 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); | 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>') | var $button = $('<button>') | ||
.text('Copy') | .text('Copy') | ||
.addClass('copy-code-button') | .addClass('copy-code-button') | ||
.click(function() { | .click(function() { | ||
var text = $this.text( | var text = $this.text(); | ||
navigator.clipboard.writeText(text).then(function() { | navigator.clipboard.writeText(text).then(function() { | ||
$button.text('Copied!'); | $button.text('Copied!'); | ||
| Line 22: | Line 33: | ||
}); | }); | ||
}); | }); | ||
$this. | |||
// Insere o botão antes do bloco de código | |||
$this.before($button); | |||
}); | }); | ||
}); | }); | ||
| Line 81: | 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 88: | 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+'> | '<div><h4 '+titleStyle+'>Knowledge</h4>' + | ||
'<a '+linkStyle+' href="https://wiki.atronia.eu">Wiki</a>' + | '<a '+linkStyle+' href="https://wiki.atronia.eu">Wiki</a>' + | ||
'</div>' + | '</div>' + | ||