10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-11-04 13:13:55 +01:00

Fix bug when CopyExcitationsTypeFrom(TBE)

This commit is contained in:
Mickaël Véril 2020-02-16 11:48:55 +01:00
parent daa62495fa
commit 488a4a3fb6

View File

@ -26,12 +26,12 @@ draft: false
<script src="https://cdn.jsdelivr.net/npm/bowser@2.5.3/es5.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bowser@2.5.3/es5.min.js"></script>
<script src="/js/numberUtils.js"></script> <script src="/js/numberUtils.js"></script>
<script> <script>
function adjustSticky(){ function adjustSticky() {
const height=$("nav").height() const height = $("nav").height()
$("thead.sticky > tr > th ").css("top",height) $("thead.sticky > tr > th ").css("top", height)
} }
window.onload = async () => { window.onload = async () => {
window.browser=bowser.getParser(window.navigator.userAgent); window.browser = bowser.getParser(window.navigator.userAgent);
$("input[type='checkbox']:checked").trigger("change") $("input[type='checkbox']:checked").trigger("change")
adjustSticky(); adjustSticky();
@ -41,28 +41,28 @@ draft: false
getAllSelect().each(function () { getAllSelect().each(function () {
$("<li/>").text($('label[for="' + $(this).attr('id') + '"]').text()).appendTo(slist) $("<li/>").text($('label[for="' + $(this).attr('id') + '"]').text()).appendTo(slist)
}) })
$('[data-needbrowser],[data-neednotbrowser]').each(function() { $('[data-needbrowser],[data-neednotbrowser]').each(function () {
function test(key,value){ function test(key, value) {
switch (key) { switch (key) {
case "Engine": case "Engine":
return value.some((v)=>browser.isEngine(v)) return value.some((v) => browser.isEngine(v))
break; break;
case "Browser": case "Browser":
return value.some((v)=>browser.isBrowser(v)) return value.some((v) => browser.isBrowser(v))
case "Platform": case "Platform":
return value.some((v)=>browser.isPlatform(v)) return value.some((v) => browser.isPlatform(v))
case "OS": case "OS":
return value.some((v)=>browser.isOS(v)) return value.some((v) => browser.isOS(v))
default: default:
return true return true
break; break;
} }
} }
const needdata=$(this).data("needbrowser") const needdata = $(this).data("needbrowser")
const neednotdata=$(this).data("neednotbrowser") const neednotdata = $(this).data("neednotbrowser")
const need = ((needdata==null) ? true : Object.entries(needdata).every(kv=>test(kv[0],kv[1]))) const need = ((needdata == null) ? true : Object.entries(needdata).every(kv => test(kv[0], kv[1])))
const neednot=((neednotdata==null) ? true : Object.entries(neednotdata).some(kv=>!test(kv[0],kv[1]))) const neednot = ((neednotdata == null) ? true : Object.entries(neednotdata).some(kv => !test(kv[0], kv[1])))
if(need && neednot){ if (need && neednot) {
$(this).show() $(this).show()
} else { } else {
$(this).hide() $(this).hide()
@ -70,7 +70,7 @@ draft: false
}) })
var cbextl = $("#cb_exTypeList") var cbextl = $("#cb_exTypeList")
var extl = $("#exTypeList") var extl = $("#exTypeList")
var vertkindtl=$("#exVertKindList") var vertkindtl = $("#exVertKindList")
for (const [name, value] of VertExcitationKinds.All) { for (const [name, value] of VertExcitationKinds.All) {
$("<li/>").text(name).appendTo(vertkindtl) $("<li/>").text(name).appendTo(vertkindtl)
} }
@ -121,14 +121,20 @@ draft: false
proms.push(getFluoFilesName().map((f) => VertDataFile.loadAsync(f, VertExcitationKinds.Fluorescence))) proms.push(getFluoFilesName().map((f) => VertDataFile.loadAsync(f, VertExcitationKinds.Fluorescence)))
window.defaultDats = [] window.defaultDats = []
for (const subproms of proms) { for (const subproms of proms) {
var sub = await Promise.all(subproms) const sub = await Promise.all(subproms)
for (mol of uniq(sub.map(d => d.molecule))) { for (const doi of uniq(sub.map(d => d.DOI.string))) {
submol = sub.filter(d => d.molecule == mol) const subdoi = sub.filter(d => d.DOI.string === doi)
TBE = sub.find((d) => d.method.isTBE) for (mol of uniq(subdoi.map(d => d.molecule))) {
const submol = subdoi.filter(d => d.molecule === mol)
const TBE = submol.find((d) => d.method.isTBE)
if (TBE !== undefined) {
for (dat of submol.filter((d) => d !== TBE)) { for (dat of submol.filter((d) => d !== TBE)) {
dat.CopyExcitationsTypeFrom(TBE) dat.CopyExcitationsTypeFrom(TBE)
} }
} }
}
}
window.defaultDats = window.defaultDats.concat(sub) window.defaultDats = window.defaultDats.concat(sub)
} }
processingIndicator.isActive = false processingIndicator.isActive = false
@ -181,7 +187,7 @@ draft: false
if (!isLast) { if (!isLast) {
await reloadSelect(afters.prop("name")) await reloadSelect(afters.prop("name"))
} }
const fillArray=["molecule"] const fillArray = ["molecule"]
if (fillArray.includes(afters.prop("name"))) { if (fillArray.includes(afters.prop("name"))) {
selectSelectAll(afters.first()) selectSelectAll(afters.first())
} }
@ -443,7 +449,7 @@ draft: false
if (kv !== undefined) { if (kv !== undefined) {
const [val, unsafe] = kv[1] const [val, unsafe] = kv[1]
if (unsafe) { if (unsafe) {
td.append($("<span/>", { title: "unsafe value", role:"img", "aria-label":"Warning", style: "font-family: color-emoji;" }).text('⚠')) td.append($("<span/>", { title: "unsafe value", role: "img", "aria-label": "Warning", style: "font-family: color-emoji;" }).text('⚠'))
} }
if (unsafe && !$("#cb_unsafe").is(':checked')) { if (unsafe && !$("#cb_unsafe").is(':checked')) {
td.append($("<s/>").append(val.toString())) td.append($("<s/>").append(val.toString()))
@ -486,7 +492,10 @@ draft: false
<li>Fluorescence</li> <li>Fluorescence</li>
</ul> </ul>
<li>Choose each parameter (of course you can select multiples values for each) you can use the the <buttongit <li>Choose each parameter (of course you can select multiples values for each) you can use the the <buttongit
disabled>Select all</button> button to select all items <span hidden data-needbrowser='{"Engine":["WebKit","Blink"],"Platform":["desktop"]}'>or use the <kbd data-needbrowser='{"OS":["MacOS"]}'>CMD</kbd><kbd data-neednotbrowser='{"OS":["MacOS"]}'>Ctrl</kbd>+<kbd>A</kbd> shortcut key</span></li> disabled>Select all</button> button to select all items <span hidden
data-needbrowser='{"Engine":["WebKit","Blink"],"Platform":["desktop"]}'>or use the <kbd
data-needbrowser='{"OS":["MacOS"]}'>CMD</kbd><kbd
data-neednotbrowser='{"OS":["MacOS"]}'>Ctrl</kbd>+<kbd>A</kbd> shortcut key</span></li>
<ul id="SelectList"></ul> <ul id="SelectList"></ul>
<li>Choose filters:</li> <li>Choose filters:</li>
<ul> <ul>