|
|
| Line 32: |
Line 32: |
| display: block; | | display: block; |
| } | | } |
|
| |
|
| |
|
| |
|
| |
| /* 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);
| |
| });
| |
| });
| |