PageSourceSearch

https://enciclopediaiberoamericana.com/wp-content/themes/e_iberoamericana/js/copiar-cita.js

js enciclopediaiberoamericana.com collected 2026-10-02 10:39:57 UTC 1,584 bytes, 39 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function() {
2    const copiarBtns = document.querySelectorAll('.copiar-cita');
3    copiarBtns.forEach(function(copiarBtn) {
4        copiarBtn.addEventListener('click', function() {
5            const contenidoCitar = this.parentNode.querySelector('.contenido-citar-data');
6            const citaCopiado = this.parentNode.querySelector('.cita-copiado');
7            const copiado = this.parentNode.querySelector('.copiado');
8            
9            // Selecciona el contenido a copiar
10            const contenido = contenidoCitar.innerText;
11
12            // Crea un elemento de textarea temporal para copiar el texto
13            const textarea = document.createElement('textarea');
14            textarea.value = contenido;
15
16            // Añade el textarea al DOM
17            document.body.appendChild(textarea);
18
19            // Selecciona y copia el contenido del textarea
20            textarea.select();
21            document.execCommand('copy');
22
23            // Elimina el textarea temporal
24            document.body.removeChild(textarea);
25
26            // Muestra el mensaje de "Cita copiada"
27            citaCopiado.style.display = 'block';
28            copiarBtn.style.display = 'none';
29            copiado.style.display = 'inline-block';
30
31            // Oculta el mensaje después de 1.8 segundos
32            setTimeout(function() {
33                citaCopiado.style.display = 'none';
34                copiarBtn.style.display = 'inline-block';
35                copiado.style.display = 'none';
36            }, 2200);
37        });
38    });
39});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.