10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 13:53:48 +01:00

Allow to load Absorbtion and fluorescence at the same time

This commit is contained in:
Mickaël Véril 2020-01-14 10:06:31 +01:00
parent bd6dd042bd
commit 18be81d5ba

View File

@ -63,34 +63,28 @@ draft: false
delete (cbextl) delete (cbextl)
delete (allc) delete (allc)
window.doiCache = new DOICache() window.doiCache = new DOICache()
$('#form_dat > fieldset > input[type=radio]').on('change', async function (event) { }
async function loadFiles() {
processingIndicator.isActive = true processingIndicator.isActive = true
$("#Geom_th,#GSGeom_th,#ESGeom_th").each(function () { var chks=[]
$(this).attr("hidden", true) var chks = $("#form_datFiles > ul > ul > li >input[type=checkbox]:checked")
}) var proms = Array.from(chks).flatMap((c) => {
var result = $(this).val(); switch (c.value) {
var proms = [];
switch (result) {
case "abs": case "abs":
proms = getAbsFilesName().map((f) => AbsDataFile.loadAsync(f)); return getAbsFilesName().map((f) => AbsDataFile.loadAsync(f));
$("#Geom_th").attr("hidden", false)
break; break;
case "fluo": case "fluo":
proms = getFluoFilesName().map((f) => FluoDataFile.loadAsync(f)); return getFluoFilesName().map((f) => FluoDataFile.loadAsync(f));
$("#Geom_th").attr("hidden", false)
break; break;
case "zpe": default:
proms = getZPEFilesName().map((f) => ZPEDataFile.loadAsync(f)); return []
$("#GSGeom_th,#ESGeom_th").each(function () {
$(this).attr("hidden", false)
})
break; break;
} }
})
window.dats = await Promise.all(proms) window.dats = await Promise.all(proms)
processingIndicator.isActive = false processingIndicator.isActive = false
reloadFileSelector() reloadFileSelector()
await reloadSelect() await reloadSelect()
})
} }
function reloadFileSelector() { function reloadFileSelector() {
$("#customFiles_input").attr("value", "").attr("disabled", false) $("#customFiles_input").attr("value", "").attr("disabled", false)
@ -134,19 +128,19 @@ draft: false
})) }))
var sets = await getSets() var sets = await getSets()
for (const val of vals) { for (const val of vals) {
if(val!==null) { if (val !== null) {
var op = $("<option/>", { var op = $("<option/>", {
value: JSON.stringify(val) value: JSON.stringify(val)
}) })
if ($(this).attr("name") == "DOI") { if ($(this).attr("name") == "DOI") {
if (sets.has(val.string)) { if (sets.has(val.string)) {
str=sets.get(val.string) str = sets.get(val.string)
if(val.IsSupporting){ if (val.IsSupporting) {
str+=" (SI)" str += " (SI)"
} }
} }
else{ else {
str=val.toString() str = val.toString()
} }
$(op).text(str) $(op).text(str)
} }
@ -176,7 +170,7 @@ draft: false
for (const exc of d.excitations) { for (const exc of d.excitations) {
const key2 = JSON.stringify([d.molecule, exc.initial, exc.final]) const key2 = JSON.stringify([d.molecule, exc.initial, exc.final])
const keydic = sdatdic.get(key) const keydic = sdatdic.get(key)
if ((!exc.isUnsafe || window.filterParams[0]) && ((exc.type & window.filterParams[1])!==0)) { if ((!exc.isUnsafe || window.filterParams[0]) && ((exc.type & window.filterParams[1]) !== 0)) {
if (!(keydic.has(key2))) { if (!(keydic.has(key2))) {
keydic.set(key2, []) keydic.set(key2, [])
} }
@ -201,13 +195,13 @@ draft: false
key.shift() key.shift()
Reflect.setPrototypeOf(key[0], method.prototype) Reflect.setPrototypeOf(key[0], method.prototype)
//Reflect.setPrototypeOf(key[1], DOI.prototype) //Reflect.setPrototypeOf(key[1], DOI.prototype)
for (const [i,el] of key.entries()) { for (const [i, el] of key.entries()) {
var td = $("<td/>") var td = $("<td/>")
if (i===1) { if (i === 1) {
var publi = doiCache.get(el, true) var publi = doiCache.get(el, true)
const sets = await getSets() const sets = await getSets()
if (sets.has(el)) { if (sets.has(el)) {
var str=sets.get(el) var str = sets.get(el)
$(td).append(str) $(td).append(str)
} }
$("<a/>", { $("<a/>", {
@ -280,20 +274,20 @@ draft: false
if (typeof values == "undefined" || values == null) { if (typeof values == "undefined" || values == null) {
return false return false
} }
var val=null var val = null
switch (prop) { switch (prop) {
case "method": case "method":
val=d.method.name val = d.method.name
break; break;
case "basis": case "basis":
val=d.method.basis val = d.method.basis
break; break;
default: default:
val=d[prop] val = d[prop]
break; break;
} }
return values.includes(JSON.stringify(val)) return values.includes(JSON.stringify(val))
delete(val) delete (val)
}) })
}) })
await window.doiCache.addRange(window.filtData.map((d) => d.DOI.string)) await window.doiCache.addRange(window.filtData.map((d) => d.DOI.string))
@ -354,8 +348,8 @@ draft: false
} }
const key3 = JSON.stringify(dat.method) const key3 = JSON.stringify(dat.method)
for (const ex of dat.excitations) { for (const ex of dat.excitations) {
Reflect.setPrototypeOf(ex.type,excitationType.prototype) Reflect.setPrototypeOf(ex.type, excitationType.prototype)
if ((window.filterParams[1] & ex.type)!==0) { if ((window.filterParams[1] & ex.type) !== 0) {
const key2 = JSON.stringify([ex.initial, ex.final, ex.type]) const key2 = JSON.stringify([ex.initial, ex.final, ex.type])
if (!datadic.get(key1).has(key2)) { if (!datadic.get(key1).has(key2)) {
datadic.get(key1).set(key2, new Map()) datadic.get(key1).set(key2, new Map())
@ -407,8 +401,8 @@ draft: false
} }
await reloadStat() await reloadStat()
} }
async function submitdat(){ async function submitdat() {
window.onbeforeunload = () => {return '';} window.onbeforeunload = () => { return ''; }
await reloadContent(); await reloadContent();
} }
</script> </script>
@ -434,16 +428,26 @@ draft: false
<li>Now you can see the list of selected data and some statistics about these data</li> <li>Now you can see the list of selected data and some statistics about these data</li>
</ol> </ol>
</p> </p>
<form id="form_dat" action="javascript:submitdat()" method="post"> <form id="form_datFiles" action="javascript:loadFiles()" method="post">
<fieldset>
<legend>Data type</legend> <legend>Data type</legend>
<input type="radio" id="abs" value="abs" name="datatype"> <ul class="nestedCbList" style="padding-left: 0em;">
<label for="abs">Absorption</label> <li>
<input type="radio" id="fluo" value="fluo" name="datatype"> <input type="checkbox" onchange="nestedCheckbox_change(event)" id="cb_fileType_All"></input>
<label for="cb_fileType_All"> All</label>
</li>
<ul class="nestedCbList">
<li>
<input type="checkbox" onchange="nestedCheckbox_change(event)" id="cb_abs" value="abs" name="datatype">
<label for="cb_abs">Absorption</label>
</li>
<li>
<input type="checkbox" onchange="nestedCheckbox_change(event)" id="cb_fluo" value="fluo" name="datatype">
<label for="fluo">Fluorescence</label> <label for="fluo">Fluorescence</label>
<input type="radio" id="zpe" value="zpe" name="datatype"> </ul>
<label for="zpe">\(\Delta \text{ZPE}\)</label> </li>
</fieldset> <input type="submit" value="Load files" />
</form>
<form id="form_dat" action="javascript:submitdat()" method="post">
<fieldset> <fieldset>
<div> <div>
<label for="customFiles_input">Add custom data file</label> <label for="customFiles_input">Add custom data file</label>