1jQuery(document).ready(function($) { 2 $(document).on('click', '.export-co2-image', function(e) { 3 e.preventDefault(); 4 5 let button = $(this); 6 let targetId = button.data('target'); 7 let targetElement = document.getElementById(targetId); 8 9 button.text('Generando...').prop('disabled', true); 10 11 // Configurazione per html2canvas 12 html2canvas(targetElement, { 13 backgroundColor: '#ffffff', 14 scale: 3, // Alta risoluzione 15 logging: false, 16 useCORS: true, // Permette di caricare immagini cross-origin 17 allowTaint: true, 18 onclone: function(clonedDoc) { 19 // Rimuovi il pulsante di export dalla clone 20 let cloneButton = clonedDoc.querySelector('.export-co2-image'); 21 if (cloneButton) { 22 cloneButton.style.display = 'none'; 23 } 24 } 25 }).then(function(canvas) { 26 // Crea un link per il download 27 let link = document.createElement('a'); 28 let date = new Date().toISOString().split('T')[0]; 29 link.download = 'co2-levels-' + date + '.png'; 30 link.href = canvas.toDataURL('image/png', 1.0); 31 document.body.appendChild(link); 32 link.click(); 33 document.body.removeChild(link); 34 35 // Ripristina il bottone 36 button.text('ð¸ Esporta come Immagine').prop('disabled', false); 37 }).catch(function(error) { 38 console.error('Errore export:', error); 39 button.text('â Errore').prop('disabled', false); 40 alert('Errore durante la generazione dell\'immagine. Riprova.'); 41 }); 42 }); 43});
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.