mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-12-25 13:53:48 +01:00
replace forEach with for of when it's relevant
This commit is contained in:
parent
73abfb7371
commit
f27fcf013e
@ -19,12 +19,12 @@ draft: false
|
||||
window.dats=await loadAllData()
|
||||
window.data=new CombinedData()
|
||||
molecules=new Set(Object.values(window.dats).flat().map((d)=>d.molecule))
|
||||
molecules.forEach(el=>{
|
||||
for (const el of molecules) {
|
||||
op=document.createElement("option")
|
||||
op.value=el
|
||||
op.innerText=el
|
||||
document.getElementById("select_mol").appendChild(op)
|
||||
})
|
||||
}
|
||||
}
|
||||
function select_mol_onchange(event){
|
||||
update_mol(event.target.value)
|
||||
@ -39,20 +39,20 @@ draft: false
|
||||
update_ZPE(window.dats["ZPE"][event.target.value])
|
||||
}
|
||||
async function update_mol(molecule){
|
||||
Object.keys(window.dats).forEach((key)=>{
|
||||
for (const [key,dat] of Object.entries(window.dats)) {
|
||||
var s=document.getElementById(String.raw`select_${key}`)
|
||||
while (s.options[s.options.length-1].value!= "") {
|
||||
s.options.remove(s.options[s.options.length-1])
|
||||
}
|
||||
window.dats[key].forEach(val=>{
|
||||
dat.forEach((val,index)=>{
|
||||
if(val.molecule==molecule){
|
||||
var op=document.createElement("option")
|
||||
op.value=window.dats[key].indexOf(val)
|
||||
op.value=index
|
||||
op.innerText=val.method.toString()
|
||||
s.appendChild(op)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
async function update_abs(abs){
|
||||
window.data.Abs=abs
|
||||
@ -91,7 +91,7 @@ draft: false
|
||||
}
|
||||
div=document.getElementById("meta_div")
|
||||
div.innerHTML=""
|
||||
for (element of md) {
|
||||
for (const element of md) {
|
||||
var node =null;
|
||||
switch (trueTypeOf(element)) {
|
||||
case "string":
|
||||
@ -123,19 +123,19 @@ draft: false
|
||||
}
|
||||
var tb=document.getElementById("ex_table_b");
|
||||
tb.innerHTML=''
|
||||
window.data.excitations.forEach(el=> {
|
||||
for (const el of window.data.excitations) {
|
||||
var row=document.createElement("tr")
|
||||
var rowd=[]
|
||||
rowd.push(String.raw`${LatexInline[0]} ${el.initial.toLaTeX()} \rightarrow ${el.final.toLaTeX()}${LatexInline[1]}`)
|
||||
var e=[el.Eabs,el.Efluo,el.EZPE,el.Eadia,el.Ezz]
|
||||
e.forEach((val)=>rowd.push(noNanPrecision(val,3)))
|
||||
rowd.forEach((d)=>{
|
||||
for(d of rowd) {
|
||||
td=document.createElement("td")
|
||||
td.innerText=d
|
||||
row.appendChild(td)
|
||||
})
|
||||
}
|
||||
tb.appendChild(row)
|
||||
});
|
||||
}
|
||||
await MathJax.typesetPromise();
|
||||
document.getElementById("ex_div").hidden=false
|
||||
var plotdat = [{
|
||||
|
@ -162,7 +162,7 @@ class dataFileBase {
|
||||
dat.excitations.push(ex);
|
||||
};
|
||||
|
||||
text.split("\n").forEach(function(line) {
|
||||
for (var line of text.split("\n")) {
|
||||
//if it's not empty line
|
||||
line = line.trim();
|
||||
if (line) {
|
||||
@ -177,7 +177,7 @@ class dataFileBase {
|
||||
readrow(line);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return dat
|
||||
}
|
||||
}
|
||||
@ -187,10 +187,8 @@ class oneStateDataFile extends dataFileBase {
|
||||
super()
|
||||
this.geometry = null
|
||||
}
|
||||
static readmetaPair(key,value,dat)
|
||||
{
|
||||
if(key=="geom")
|
||||
{
|
||||
static readmetaPair(key, value, dat) {
|
||||
if (key == "geom") {
|
||||
dat.geometry = method.fromString(value)
|
||||
}
|
||||
else {
|
||||
@ -236,40 +234,39 @@ class CombinedData{
|
||||
var exs = []
|
||||
var dic = new Map()
|
||||
if (this.Abs != null) {
|
||||
this.Abs.excitations.forEach((el)=>{
|
||||
for (const el of this.Abs.excitations) {
|
||||
var key = JSON.stringify([el.initial, el.final])
|
||||
if (!dic.has(key)) {
|
||||
dic.set(key, {})
|
||||
}
|
||||
dic.get(key)["abs"] = el.value
|
||||
})
|
||||
}
|
||||
if (this.Fluo != null) {
|
||||
this.Fluo.excitations.forEach((el)=>{
|
||||
for (const el of this.Fluo.excitations) {
|
||||
var key = JSON.stringify([el.initial, el.final])
|
||||
if (!dic.has(key)) {
|
||||
dic.set(key, {})
|
||||
}
|
||||
dic.get(key)["fluo"] = el.value
|
||||
})
|
||||
}
|
||||
}
|
||||
if (this.ZPE != null) {
|
||||
this.ZPE.excitations.forEach((el)=>{
|
||||
for (const el of this.ZPE.excitations) {
|
||||
var key = JSON.stringify([el.initial, el.final])
|
||||
if (!dic.has(key)) {
|
||||
dic.set(key, {})
|
||||
}
|
||||
dic.get(key)["ZPE"] = el.value
|
||||
})
|
||||
}
|
||||
}
|
||||
dic.forEach((value, key) => {
|
||||
var eabs = NaN
|
||||
var efluo = NaN
|
||||
var eZPE = NaN
|
||||
var mykey = JSON.parse(key)
|
||||
mykey.forEach(el=>{
|
||||
for (var el of mykey) {
|
||||
Reflect.setPrototypeOf(el, state.prototype)
|
||||
})
|
||||
}
|
||||
if ("abs" in value) {
|
||||
eabs = value["abs"]
|
||||
}
|
||||
@ -282,5 +279,6 @@ class CombinedData{
|
||||
exs.push(new excitation(mykey[0], mykey[1], eabs, efluo, eZPE))
|
||||
})
|
||||
return exs
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user