mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-12-25 13:53:48 +01:00
Create a root folder for the molecules.zip file (#10)
* Fix broken link * Fix bug in indexDB * Fix sourceFile for each geometry * Create a root folder for the Zip file Co-authored-by: Mickaël Véril <mveril@irsamc.ups-tlse.fr>
This commit is contained in:
parent
7838048223
commit
24241a1207
@ -725,10 +725,11 @@ draft: false
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function exportGeoms() {
|
async function exportGeoms() {
|
||||||
|
const folderName = "molecules"
|
||||||
var mols = new Set($("#mol_select").val())
|
var mols = new Set($("#mol_select").val())
|
||||||
|
|
||||||
if (mols.size!==0) {
|
if (mols.size!==0) {
|
||||||
const zip = JSZip();
|
const zip = JSZip();
|
||||||
|
const root=zip.folder(folderName)
|
||||||
const geomDic=new Map()
|
const geomDic=new Map()
|
||||||
for (const geom of window.geoms) {
|
for (const geom of window.geoms) {
|
||||||
const molecule =geom.parseMetadata().molecule
|
const molecule =geom.parseMetadata().molecule
|
||||||
@ -742,10 +743,10 @@ draft: false
|
|||||||
for (const [molecule,geometries] of geomDic) {
|
for (const [molecule,geometries] of geomDic) {
|
||||||
const xyz=Array.from(geometries).join("\n\n")
|
const xyz=Array.from(geometries).join("\n\n")
|
||||||
var blob=new Blob([xyz],{type: 'chemical/x-xyz'})
|
var blob=new Blob([xyz],{type: 'chemical/x-xyz'})
|
||||||
zip.file(`${mhchemCE.extract(molecule).toLowerCase().replace(" ","_")}.xyz`,blob)
|
root.file(`${mhchemCE.extract(molecule).toLowerCase().replace(" ","_")}.xyz`,blob)
|
||||||
}
|
}
|
||||||
const zipFile = await zip.generateAsync({type: 'blob'})
|
const zipFile = await zip.generateAsync({type: 'blob'})
|
||||||
saveAs(zipFile, "molecules.zip")
|
saveAs(zipFile, `${folderName}.zip`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user