10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 05:43:46 +01:00

New publis handling with sets which support multiple publications

This commit is contained in:
Mickaël Véril 2020-08-20 15:28:06 +02:00
parent 5904358ecf
commit 62acffa870
6 changed files with 230 additions and 146 deletions

View File

@ -23,6 +23,7 @@ draft: false
<script src="/js/numberRangeChange.js"></script> <script src="/js/numberRangeChange.js"></script>
<script src="/js/DebugMode.js"></script> <script src="/js/DebugMode.js"></script>
<script src="/js/numberUtils.js"></script> <script src="/js/numberUtils.js"></script>
<script src="/js/PubliDB.js"></script>
<script> <script>
function adjustSticky() { function adjustSticky() {
const height = $("nav").height() const height = $("nav").height()
@ -79,7 +80,7 @@ draft: false
} }
$("<li/>").text(txt).appendTo(extl) $("<li/>").text(txt).appendTo(extl)
var cbli = $("<li/>") var cbli = $("<li/>")
if(!DebugMode.Enabled && value==(1 << 31)){ if (!DebugMode.Enabled && value == (1 << 31)) {
cbli.hide() cbli.hide()
} }
$("<input/>", { type: "checkbox", id: "cb_" + name, name: name, value: Number(value) }).change(nestedCheckbox_change).appendTo(cbli); $("<input/>", { type: "checkbox", id: "cb_" + name, name: name, value: Number(value) }).change(nestedCheckbox_change).appendTo(cbli);
@ -96,7 +97,7 @@ draft: false
async function loadFiles() { async function loadFiles() {
processingIndicator.isActive = true processingIndicator.isActive = true
var chks = [] var chks = []
var data= await loadAllData() var data = await loadAllData()
window.defaultDats = [] window.defaultDats = []
for (const sub of Object.values(data)) { for (const sub of Object.values(data)) {
for (const doi of uniq(sub.map(d => (d.DOI == null ? "" : d.DOI.string)))) { for (const doi of uniq(sub.map(d => (d.DOI == null ? "" : d.DOI.string)))) {
@ -120,23 +121,23 @@ draft: false
window.defaultDats = window.defaultDats.concat(sub) window.defaultDats = window.defaultDats.concat(sub)
} }
await doiCache.addRange(Array.from(new Set(window.defaultDats.filter(d=>d.DOI!==null).map(d=>d.DOI.string)))) await doiCache.addRange(Array.from(new Set(window.defaultDats.filter(d => d.DOI !== null).map(d => d.DOI.string))))
window.defaultDats = window.defaultDats.sort((datfa,datfb)=>{ window.defaultDats = window.defaultDats.sort((datfa, datfb) => {
const DOIa=datfa.DOI const DOIa = datfa.DOI
const DOIb=datfb.DOI const DOIb = datfb.DOI
if (DOIa == null && DOIb == null) { if (DOIa == null && DOIb == null) {
return 0 return 0
} }
else if (DOIa == null){ else if (DOIa == null) {
return 1 return 1
} }
else if (DOIb == null){ else if (DOIb == null) {
return -1 return -1
} }
else { else {
const puba = doiCache.get(DOIa.string).format('data', { format: 'object' })[0] const puba = doiCache.get(DOIa.string).format('data', { format: 'object' })[0]
const pubb = doiCache.get(DOIb.string).format('data', { format: 'object' })[0] const pubb = doiCache.get(DOIb.string).format('data', { format: 'object' })[0]
return pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb) return pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb)
} }
}) })
processingIndicator.isActive = false processingIndicator.isActive = false
@ -194,35 +195,56 @@ draft: false
selectSelectAll(afters.first()) selectSelectAll(afters.first())
} }
} }
function getAllVals(select) {
var baseval = $(select).val()
switch (select.name) {
case "DOI":
vals=baseval.reduce((accumulator,currentValue)=>accumulator.concat(JSON.parse(currentValue)),[])
return vals
break;
default:
return baseval
}
}
async function reloadSelect(name) { async function reloadSelect(name) {
clearSelect(name) clearSelect(name)
var selects = getAllSelectBefore(name, true) var selects = getAllSelectBefore(name, true)
var currentselect = selects.last() var currentselect = selects.last()
selects = selects.slice(0, selects.length - 1) selects = selects.slice(0, selects.length - 1)
const vals = uniq(window.dats.filter(d => { var vals = uniq(window.dats.filter(d => {
return Array.from(selects).every((el) => { return Array.from(selects).every((el) => {
return $(el).val().includes(getSelectValue(d, el.name)) return getAllVals(el).includes(getSelectValue(d, el.name))
}) })
}).map((d) => getSelectValue(d, name))) }).map((d) => getSelectValue(d, name)))
const sets = await (async () => { const publis = await (async () => {
if (name === "DOI") { if (name === "DOI") {
const publis = await getPublis() const publis = await publiDB.loadAsync()
var sets = publis.sets return publis
sets.set("","Unknow set")
return sets
} }
else { else {
return undefined return undefined
} }
})() })()
textSelctor=function(value){ if (name === "DOI") {
let newvals = []
for (const val of vals) {
for (const set of publis.sets.values()) {
if (set.includes(val)) {
newvals.push(set)
}
}
}
vals = newvals
}
textSelctor = function (value) {
switch (name) { switch (name) {
case "DOI": case "DOI":
return sets.has(value) ? sets.get(value) : value.toString() setname = publis.findNameFromSet(value, true)
return setname === null ? value.toString() : setname
break; break;
case "molecule": case "molecule":
const mhchemCE=/^\\ce\{(.*)\}$/ const mhchemCE = /^\\ce\{(.*)\}$/
const m=value.match(mhchemCE) const m = value.match(mhchemCE)
if (m) { if (m) {
return m[1] return m[1]
} else { } else {
@ -233,15 +255,23 @@ draft: false
return value.toString() return value.toString()
} }
} }
valueSelector = function (value) {
if (typeof value === 'object') {
return JSON.stringify(value)
}
else {
return value
}
}
for (const val of vals) { for (const val of vals) {
if (val !== null) { if (val !== null) {
$("<option/>", { $("<option/>", {
value: val value: valueSelector(val)
}).text(textSelctor(val)).appendTo(currentselect) }).text(textSelctor(val)).appendTo(currentselect)
} }
} if (name === "molecule") {
if (name==="molecule") { await MathJax.typesetPromise()
await MathJax.typesetPromise() }
} }
} }
function getSelectValue(data, name) { function getSelectValue(data, name) {
@ -371,7 +401,7 @@ draft: false
window.filtData = window.dats window.filtData = window.dats
getAllSelect().each(function () { getAllSelect().each(function () {
const prop = $(this).attr("name") const prop = $(this).attr("name")
const values = $(this).val() const values = getAllVals(this)
window.filtData = window.filtData.filter((d) => { window.filtData = window.filtData.filter((d) => {
if (typeof values == "undefined" || values == null) { if (typeof values == "undefined" || values == null) {
return false return false
@ -381,7 +411,7 @@ draft: false
}) })
}) })
window.T1ref = new Map() window.T1ref = new Map()
var dois = new Set(window.filtData.map((d) =>d.DOI===null ? "" : d.DOI.string)) var dois = new Set(window.filtData.map((d) => d.DOI === null ? "" : d.DOI.string))
var mols = new Set(window.filtData.map((d) => d.molecule)) var mols = new Set(window.filtData.map((d) => d.molecule))
await window.doiCache.addRange(dois) await window.doiCache.addRange(dois)
for (const doi of dois) { for (const doi of dois) {
@ -427,8 +457,9 @@ draft: false
var data = $("#data") var data = $("#data")
$(data).empty(); $(data).empty();
if (window.filtData.length > 0) { if (window.filtData.length > 0) {
var sets = (await getPublis()).sets var publis = await publiDB.loadAsync()
sets.set("","Unknow set") var PreviousSetName = undefined
var CurrentsetName = undefined
for (const doi of doiCache.keys()) { for (const doi of doiCache.keys()) {
paperdata = window.filtData.filter((d) => { paperdata = window.filtData.filter((d) => {
return (d.DOI === null ? "" : d.DOI.string) == doi return (d.DOI === null ? "" : d.DOI.string) == doi
@ -454,7 +485,11 @@ draft: false
} }
}) })
var div = $('<div/>').appendTo(data) var div = $('<div/>').appendTo(data)
$("<h1/>").text(sets.get(doi)).appendTo(div) CurrentsetName = publis.findSetNameFromDOI(doi, true)
if (PreviousSetName !== CurrentsetName) {
$("<h1/>").text(CurrentsetName).appendTo(div)
}
$("<h2/>").text(doiCache.get(doi).format('data', { format: 'object' })[0].title).appendTo(div)
var table = $("<table/>").addClass("datatable").appendTo(div) var table = $("<table/>").addClass("datatable").appendTo(div)
var head = $("<tr/>") var head = $("<tr/>")
$("<thead/>").addClass("sticky").append(head).appendTo(table) $("<thead/>").addClass("sticky").append(head).appendTo(table)
@ -495,7 +530,7 @@ draft: false
} }
for (const [molecule, moldat] of datadic.entries()) { for (const [molecule, moldat] of datadic.entries()) {
var printmol = true; var printmol = true;
const mhchemCE=/^\\ce\{.*\}$/ const mhchemCE = /^\\ce\{.*\}$/
for (const [jsonex, exdat] of moldat.entries()) { for (const [jsonex, exdat] of moldat.entries()) {
const ex = JSON.parse(jsonex) const ex = JSON.parse(jsonex)
Reflect.setPrototypeOf(ex[0], state.prototype) Reflect.setPrototypeOf(ex[0], state.prototype)
@ -511,7 +546,7 @@ draft: false
if (ex[3].Value == VertExcitationKinds.Fluorescence.Value) { if (ex[3].Value == VertExcitationKinds.Fluorescence.Value) {
Vertkindtext = String.raw`[\mathrm{F}]` Vertkindtext = String.raw`[\mathrm{F}]`
} }
desctex="" desctex = ""
if (ex[2].description.string) { if (ex[2].description.string) {
desctex = "(" + ex[2].description.string + ")" desctex = "(" + ex[2].description.string + ")"
} }
@ -539,6 +574,7 @@ draft: false
tbody.append(tr) tbody.append(tr)
} }
} }
PreviousSetName === CurrentsetName
} }
await MathJax.typesetPromise() await MathJax.typesetPromise()
} }
@ -562,7 +598,9 @@ draft: false
} }
async function submitdat() { async function submitdat() {
if (!DebugMode.Enabled) { if (!DebugMode.Enabled) {
window.onbeforeunload = () => { return ''; } window.onbeforeunload = () => { return ''; }
window.onbeforeunload = () => { return ''; }
window.onbeforeunload = () => { return ''; }
} }
await reloadContent(); await reloadContent();
} }
@ -577,113 +615,115 @@ draft: false
</p> </p>
</noscript> </noscript>
<p> <p>
On this page you can compare multiple dataset and have some statistics to evaluate method accuracy (All fields marked with a red asterisk (<span style="color: red;">*</span>) are mandatory). On this page you can compare multiple dataset and have some statistics to evaluate method accuracy (All fields marked
with a red asterisk (<span style="color: red;">*</span>) are mandatory).
</p> </p>
<form id="form_dat" action="javascript:submitdat()" method="post"> <form id="form_dat" action="javascript:submitdat()" method="post">
<fieldset class="main"> <fieldset class="main">
<fieldset> <fieldset>
<legend>Import custom files</legend> <legend>Import custom files</legend>
<p> <p>
Import custom files to compare it's data to the reference datasets. Import custom files to compare it's data to the reference datasets.
</p> </p>
<div> <div>
<label for="absFiles_input">Import custom absorption data files</label> <label for="absFiles_input">Import custom absorption data files</label>
<input type="file" multiple onchange="reloadCustomFiles()" id="absFiles_input" name="file_abs"></input> <input type="file" multiple onchange="reloadCustomFiles()" id="absFiles_input" name="file_abs"></input>
</div> </div>
<div> <div>
<label for="fluoFiles_input">import custom fluorescence data files</label> <label for="fluoFiles_input">import custom fluorescence data files</label>
<input type="file" multiple onchange="reloadCustomFiles()" id="fluoFiles_input" name="file_fluo"></input> <input type="file" multiple onchange="reloadCustomFiles()" id="fluoFiles_input" name="file_fluo"></input>
</div> </div>
</fieldset> </fieldset>
<fieldset class="table"> <fieldset class="table">
<legend>Data selection</legend> <legend>Data selection</legend>
<p>Choose each parameter (of course you can select multiple values for each) you can use the <button <p>Choose each parameter (of course you can select multiple values for each) you can use the <button
disabled>Select all</button> button to select all items <span hidden disabled>Select all</button> button to select all items <span hidden
data-needbrowser='{"Engine":["WebKit","Blink"],"Platform":["desktop"]}'>or use the <kbd data-needbrowser='{"Engine":["WebKit","Blink"],"Platform":["desktop"]}'>or use the <kbd
data-needbrowser='{"OS":["MacOS"]}'>⌘</kbd><kbd data-needbrowser='{"OS":["MacOS"]}'>⌘</kbd><kbd
data-neednotbrowser='{"OS":["MacOS"]}'>Ctrl</kbd>+<kbd>A</kbd> shortcut key</span> data-neednotbrowser='{"OS":["MacOS"]}'>Ctrl</kbd>+<kbd>A</kbd> shortcut key</span>
</p> </p>
<div style="display: inline-block;"> <div style="display: inline-block;">
<label for="DOI_select" class="required">Sets</label> <label for="DOI_select" class="required">Sets</label>
<button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button> <button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button>
<select multiple id="DOI_select" required name="DOI" onchange="reloadNextSelect(event)"></select> <select multiple id="DOI_select" required name="DOI" onchange="reloadNextSelect(event)"></select>
</div> </div>
<div style="display:inline-block"> <div style="display:inline-block">
<label for="mol_select" class="required">Molecules</label> <label for="mol_select" class="required">Molecules</label>
<button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button> <button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button>
<select multiple id="mol_select" required name="molecule" onchange="reloadNextSelect(event)"></select> <select multiple id="mol_select" required name="molecule" onchange="reloadNextSelect(event)"></select>
</div> </div>
<br /> <br />
<div style="display: inline-block;"> <div style="display: inline-block;">
<label for="method_select" class="required">Methods</label> <label for="method_select" class="required">Methods</label>
<button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button> <button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button>
<select multiple id="method_select" required name="method" onchange="reloadNextSelect(event)"></select> <select multiple id="method_select" required name="method" onchange="reloadNextSelect(event)"></select>
</div> </div>
<div style="display: inline-block;"> <div style="display: inline-block;">
<label for="basis_select" class="required">Basis sets</label> <label for="basis_select" class="required">Basis sets</label>
<button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button> <button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button>
<select multiple id="basis_select" required name="basis" onchange="reloadNextSelect(event)"></select> <select multiple id="basis_select" required name="basis" onchange="reloadNextSelect(event)"></select>
</div> </div>
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend class="required" <legend class="required">Vertical excitation kind</legend>
>Vertical excitation kind</legend> <p>Choose what kind of vertical excitations you want</p>
<p>Choose what kind of vertical excitations you want</p> <ul class="nestedCbList" style="padding-left: 0em;">
<ul class="nestedCbList" style="padding-left: 0em;">
<li>
<input type="checkbox" data-onerequired="true" checked onchange="nestedCheckbox_change(event)" id="cb_fileType_All"></input>
<label for="cb_fileType_All"> All</label>
</li>
<ul class="nestedCbList" id="cb_exVertKindList">
<li> <li>
<input type="checkbox" onchange="nestedCheckbox_change(event)" id="cb_abs" value="1" name="datatype"> <input type="checkbox" data-onerequired="true" checked onchange="nestedCheckbox_change(event)"
<label for="cb_abs">Absorption</label> id="cb_fileType_All"></input>
<label for="cb_fileType_All"> All</label>
</li> </li>
<ul class="nestedCbList" id="cb_exVertKindList">
<li>
<input type="checkbox" onchange="nestedCheckbox_change(event)" id="cb_abs" value="1" name="datatype">
<label for="cb_abs">Absorption</label>
</li>
<li>
<input type="checkbox" onchange="nestedCheckbox_change(event)" id="cb_fluo" value="2" name="datatype">
<label for="fluo">Fluorescence</label>
</li>
</ul>
</ul>
</fieldset>
<fieldset id="excitationFilter">
<legend class="required">Filters</legend>
<p>Choose other excitation parameters you want</p>
<ul class="nestedCbList" style="padding-left: 0em;">
<li> <li>
<input type="checkbox" onchange="nestedCheckbox_change(event)" id="cb_fluo" value="2" name="datatype"> <input type="checkbox" data-onerequired="true" onchange="nestedCheckbox_change(event)"
<label for="fluo">Fluorescence</label> id="cb_exType_All"></input>
<label for="cb_exType_All"> All</label>
</li> </li>
</ul> <ul id="cb_exTypeList" class="nestedCbList">
</ul> </ul>
<p>Choose if you want to include unsafe values in statistics</p>
<li id="li_cb_unsafe">
<input type="checkbox" id="cb_unsafe" name="unsafe">
<label for="cb_unsafe">Unsafe</label>
</li>
</fieldset>
<fieldset>
<legend>\(\mathrm{\%T_1}\)</legend>
<p>Chose the range of \(\mathrm{\%T_1}\) range using the two number box</p>
<input class="range min" airia-label="Minimum value" type="number" id="T1min" onchange="numberRangeChange(event)"
min="0" value="0">
<span>\(\leq \mathrm{\%T_1} \leq\)</span>
<input class="range max" airia-label="Maximum value" type="number" id="T1max" onchange="numberRangeChange(event)"
max="100" value="100">
</fieldset>
</fieldset> </fieldset>
<fieldset id="excitationFilter">
<legend class="required">Filters</legend>
<p>Choose other excitation parameters you want</p>
<ul class="nestedCbList" style="padding-left: 0em;">
<li>
<input type="checkbox" data-onerequired="true" onchange="nestedCheckbox_change(event)" id="cb_exType_All"></input>
<label for="cb_exType_All"> All</label>
</li>
<ul id="cb_exTypeList" class="nestedCbList">
</ul>
<p>Choose if you want to include unsafe values in statistics</p>
<li id="li_cb_unsafe">
<input type="checkbox" id="cb_unsafe" name="unsafe">
<label for="cb_unsafe">Unsafe</label>
</li>
</fieldset>
<fieldset>
<legend>\(\mathrm{\%T_1}\)</legend>
<p>Chose the range of \(\mathrm{\%T_1}\) range using the two number box</p>
<input class="range min" airia-label="Minimum value" type="number" id="T1min"
onchange="numberRangeChange(event)" min="0" value="0">
<span>\(\leq \mathrm{\%T_1} \leq\)</span>
<input class="range max" airia-label="Maximum value" type="number" id="T1max"
onchange="numberRangeChange(event)" max="100" value="100">
</fieldset>
</fieldset>
<input type="submit" value="Load"></input> <input type="submit" value="Load"></input>
</form> </form>
<form id="form_ref"> <form id="form_ref">
<fieldset class="main"> <fieldset class="main">
<fieldset> <fieldset>
<legend>statistics</legend> <legend>statistics</legend>
<p>Select a reference from <strong>already selected data</strong> (by default first is selected -it's the <abbr <p>Select a reference from <strong>already selected data</strong> (by default first is selected -it's the <abbr
title="Theoretical best estimate">TBE</abbr> if present- is already selected)</p> title="Theoretical best estimate">TBE</abbr> if present- is already selected)</p>
<label for="sel_ref">Reference</label> <label for="sel_ref">Reference</label>
<select id="sel_ref" onchange="reloadStat()"></select> <select id="sel_ref" onchange="reloadStat()"></select>
</fieldset> </fieldset>
</fieldset> </fieldset>
</form> </form>
<p>Now you can see the list of selected data and some statistics about these data</p> <p>Now you can see the list of selected data and some statistics about these data</p>
<section id="data"> <section id="data">

View File

@ -15,6 +15,7 @@ draft: false
<script src="/js/numberUtils.js"></script> <script src="/js/numberUtils.js"></script>
<script src="/js/DebugMode.js"></script> <script src="/js/DebugMode.js"></script>
<script src="/js/createPubliUI.js"></script> <script src="/js/createPubliUI.js"></script>
<script src="/js/PubliDB.js"></script>
{{< getDataFilesName >}} {{< getDataFilesName >}}
<script> <script>
window.onload = async function () { window.onload = async function () {
@ -22,30 +23,37 @@ draft: false
const Cite = require("citation-js") const Cite = require("citation-js")
const sdois = uniq(Object.values(await loadAllData()).flat().filter(d => d.DOI !== null).map(d => d.DOI.string)) const sdois = uniq(Object.values(await loadAllData()).flat().filter(d => d.DOI !== null).map(d => d.DOI.string))
const spubliscite = await Cite.async(sdois) const spubliscite = await Cite.async(sdois)
const pubs = await getPublis()
const uospublis = spubliscite.format('data', { format: 'object' }) const uospublis = spubliscite.format('data', { format: 'object' })
const spublis = uospublis.sort((puba,pubb)=>pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb)) const spublis = uospublis.sort((puba, pubb) => pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb))
var myDB = await publiDB.loadAsync()
for (const publi of spublis) { for (const publi of spublis) {
art= await createPubliUI(publi,pubs.sets,true,true) var art = await createPubliUI(publi, true, true)
$(art).appendTo("#publis_sets") var setName = myDB.findSetNameFromDOI(publi.DOI, true)
setsSec = $('#publis_sets')
var mySetSec = setsSec.find(`section.publiSet[data-setName="${setName}"]`)
if (mySetSec.length === 0) {
mySetSec = $('<section>').addClass('publiSet').attr("data-setName", setName).appendTo(setsSec)
$("<h1>").text(setName).appendTo(mySetSec)
}
$(art).appendTo(mySetSec)
} }
const odois=Array.from(pubs.others.keys()) const odois = myDB.others
const opubliscite = await Cite.async(odois) const opubliscite = await Cite.async(odois)
const uoopublis = opubliscite.format('data', { format: 'object' }) const uoopublis = opubliscite.format('data', { format: 'object' })
const opublis = uoopublis.sort((puba,pubb)=>pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb)) const opublis = uoopublis.sort((puba, pubb) => pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb))
for (const publi of opublis) { for (const publi of opublis) {
art= await createPubliUI(publi,pubs.others,true,true) art = await createPubliUI(publi, true, true)
$(art).appendTo("#publis_others") $(art).appendTo("#publis_others")
} }
} }
</script> </script>
<section class="publis-list" id="publis_sets"> <section class="publis-list" id="publis_sets">
<header> <header>
<h2>Sets</h2> <h1>Sets</h2>
</header> </header>
</section> </section>
<section class="publis" id="publis_others"> <section class="publis" id="publis_others">
<header> <header>
<h2>Others</h2> <h1>Others</h2>
</header> </header>
</section> </section>

View File

@ -1,7 +1,8 @@
.publi h1 { .publiSet h1 {
font-size: 22pt font-size: 22PT;
} }
.publi h2 {
.publi h1 {
font-size: 20pt font-size: 20pt
} }

View File

@ -1,7 +1,11 @@
sets: sets:
10.1021/acs.jctc.8b00406 : QUEST#1 QUEST#1:
10.1021/acs.jctc.8b01205 : QUEST#2 - 10.1021/acs.jctc.8b00406
10.1021/acs.jctc.9b01216 : QUEST#3 QUEST#2:
10.1021/acs.jctc.0c00227 : QUEST#4 - 10.1021/acs.jctc.8b01205
QUEST#3:
- 10.1021/acs.jctc.9b01216
QUEST#4:
- 10.1021/acs.jctc.0c00227
others: others:
10.1021/acs.jpclett.0c00014 : - 10.1021/acs.jpclett.0c00014

34
static/js/PubliDB.js Normal file
View File

@ -0,0 +1,34 @@
class publiDB {
static async loadAsync() {
var db = new publiDB
const text = await getTextFromFileUrlAsync("/data/publis/index.yaml")
const myYaml = jsyaml.load(text);
db.sets = ((myYaml.sets === null) ? new Map() : new Map(Object.entries(myYaml.sets)));
db.others = ((myYaml.others === null) ? new Map() : new Map(Object.entries(myYaml.others)));
return db
}
static get UnknowSetName() {
return "Unknow set"
}
findNameFromSet(set, supportUnknow = false) {
if (supportUnknow && JSON.stringify(set) === JSON.stringify([""])) {
return publiDB.UnknowSetName
}
for (let [setname, dois] of this.sets.entries()) {
if (JSON.stringify(set.sort()) === JSON.stringify(dois.sort())) {
return setname
}
}
return null
}
findSetNameFromDOI(doi, supportUnknow = false) {
for (let [setname, dois] of this.sets.entries()) {
if (dois.includes(doi))
return setname
}
if (supportUnknow && doi === "") {
return UnknowSetName
}
return null
}
}

View File

@ -2,16 +2,13 @@ function getPubliSubDir(DOI) {
return DOI.split(".").join("/") return DOI.split(".").join("/")
} }
async function createPubliUI(publi,sets=new Map(),toolTips=false,abstract=false) { async function createPubliUI(publi,toolTips=false,abstract=false) {
const art = $("<article/>").addClass("publi") const art = $("<article/>").addClass("publi")
art.className = "publi" art.className = "publi"
if (sets.has(publi.DOI) && sets.get(publi.DOI)!==null) {
$("<header/>").append($("<h1/>").text(sets.get(publi.DOI))).appendTo(art)
}
$("<a/>", { $("<a/>", {
href: publi.URL, href: publi.URL,
target: "_blank" target: "_blank"
}).html($("<h2/>").text(publi.title)).appendTo(art) }).html($("<h1/>").text(publi.title)).appendTo(art)
const authors = publi.author const authors = publi.author
const ulauthors = $("<ul/>").addClass("authors-list").appendTo(art) const ulauthors = $("<ul/>").addClass("authors-list").appendTo(art)
for (const author of authors) { for (const author of authors) {