';
}).join('');
}
}
document.getElementById('evToutesSubstances').textContent = toutes.length ? toutes.join(' · ') : 'Aucune substance détectée.';
}
function evVider() {
document.getElementById('evInput').value = '';
evAnalyser();
}
function evCopier() {
var contenu = [
'PRINCIPES ACTIFS DÉDOUBLONNÉS',
evDernierResultat.actifs.join('\n'),
'',
'EXCIPIENTS DÉDOUBLONNÉS',
evDernierResultat.excipients.join('\n')
].join('\n');
if (navigator.clipboard) {
navigator.clipboard.writeText(contenu).then(function() {
alert('Résultat copié dans le presse-papiers.');
});
} else {
alert(contenu);
}
}
function evExporterCSV() {
var lignes = [['Type', 'Substance']];
evDernierResultat.actifs.forEach(function(substance) {
lignes.push(['Principe actif', substance]);
});
evDernierResultat.excipients.forEach(function(substance) {
lignes.push(['Excipient', substance]);
});
var csv = lignes.map(function(ligne) {
return ligne.map(function(cellule) {
return '"' + String(cellule).replace(/"/g, '""') + '"';
}).join(';');
}).join('\n');
var fichier = new Blob(['\ufeff' + csv], { type: 'text/csv;charset=utf-8;' });
var lien = document.createElement('a');
lien.href = URL.createObjectURL(fichier);
lien.download = 'substances_dedoublonnees.csv';
lien.click();
URL.revokeObjectURL(lien.href);
}
evAnalyser();