diff --git a/content/multipledataset.html b/content/multipledataset.html index bc1bc51e..fcd881d3 100644 --- a/content/multipledataset.html +++ b/content/multipledataset.html @@ -85,54 +85,91 @@ draft: false window.defaultDats = window.defaultDats.concat(sub) } processingIndicator.isActive = false - await reloadSelect() + reloadCustomFiles() } async function reloadCustomFiles() { window.dats = window.defaultDats; - const kinds=new Map([["file_abs", VertExcitationKinds.Absorbtion], ["file_fluo", VertExcitationKinds.Fluorescence]]) + const kinds = new Map([["file_abs", VertExcitationKinds.Absorbtion], ["file_fluo", VertExcitationKinds.Fluorescence]]) for (const el of $('#form_dat > fieldset > div > input[type="file"')) { if (kinds.has(el.name)) { for (const f of el.files) { - const dat=await VertDataFile.loadAsync(f, kinds.get(this.name)) + const dat = await VertDataFile.loadAsync(f, kinds.get(this.name)) window.dats.push(dat) } } } + reloadSelect("DOI") } - async function clearSelect() { - $('#form_dat > fieldset > div > select,#sel_ref').each(function () { + async function clearSelect(BeforeName = null) { + var selects = ((BeforeName == null) ? getAllSelect() : getAllSelectAfter(BeforeName, true)) + selects.add($('#sel_ref')) + selects.each(function () { $(this).empty() }) } - async function reloadSelect() { - reloadCustomFiles() - clearSelect() - $('#form_dat > fieldset > div > select').each(async function () { - const vals = uniq(window.dats.map((d) => { - switch ($(this).attr("name")) { - case "method": - return d.method.name - break; - case "basis": - return d.method.basis - case "DOI": - return d.DOI.string - default: - return d[$(this).attr("name")] - break; - } - })) - var sets = await getSets() - for (const val of vals) { - if (val !== null) { - $("