From 14ae7312fc29f7e29a496187e3a2de6cbc894bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Wed, 17 Feb 2021 16:39:54 +0100 Subject: [PATCH] Improvements for publications --- content/references.html | 12 ++++++++++-- static/js/createPubliUI.js | 18 +++++++++++++----- static/js/pubUtils.js | 29 +++++++++++++++++++++++++---- 3 files changed, 48 insertions(+), 11 deletions(-) diff --git a/content/references.html b/content/references.html index db4aa7af..41528729 100644 --- a/content/references.html +++ b/content/references.html @@ -44,16 +44,24 @@ draft: false if (sodois.has(null)) { sodois.delete(null) } + for (const [setName,dois] of sets) { + if (dois.length>0) { + const doi=dois[0] + if (sodois.has(doi)) { + sodois.delete(doi) + } + } + } odois=Array.from(sodois) const uoopublis = await PubliData.loadManyAsync(odois) - const opublis = uoopublis.sort((puba, pubb) => pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb)) + const opublis = uoopublis.sort((puba, pubb) => pubUtils.parseDate(pubUtils.bestDate(puba).dateInfo) - pubUtils.parseDate(pubUtils.bestDate(pubb).dateInfo)) for (const publi of opublis) { const art = await createPubliUI(publi, true, !myDB.others.includes(publi.DOI)) $(art).appendTo("#publis_other") } const rdois = myDB.reviews const uorpublis = await PubliData.loadManyAsync(rdois) - const rpublis = uorpublis.sort((puba, pubb) => pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb)) + const rpublis = uorpublis.sort((puba, pubb) => pubUtils.parseDate(pubUtils.bestDate(puba).dateInfo) - pubUtils.parseDate(pubUtils.bestDate(pubb).dateInfo)) for (const publi of rpublis) { art = await createPubliUI(publi, true, true) $(art).appendTo("#publis_review") diff --git a/static/js/createPubliUI.js b/static/js/createPubliUI.js index 5a0215a0..e423b02d 100644 --- a/static/js/createPubliUI.js +++ b/static/js/createPubliUI.js @@ -1,4 +1,8 @@ async function createPubliUI(publi,toolTips=false,abstract=false) { + var DayAndMothsFormat ={ + minimumIntegerDigits: 2, + useGrouping: false + } const art = $("
").addClass("publi") art.className = "publi" $("", { @@ -13,8 +17,10 @@ async function createPubliUI(publi,toolTips=false,abstract=false) { var notifycontent = $("
").addClass("author-info") $("

").text(String.raw`${author.given} ${author.family}`).appendTo(notifycontent) ulaff = $("
    ").addClass("affiliation-list").appendTo(notifycontent) - for (const a of author.affiliation) { - $("
  • ").text(a.name).appendTo(ulaff) + if (author.affiliation) { + for (const a of author.affiliation) { + $("
  • ").text(a.name).appendTo(ulaff) + } } if (author["authenticated-orcid"]) { const html = String.raw`` @@ -44,7 +50,8 @@ async function createPubliUI(publi,toolTips=false,abstract=false) { else { $("").text(publi["container-title"][0]).appendTo(journaldiv) } - var date = pubUtils.getIssuedDate(publi) + var publiDate = pubUtils.bestDate(publi) + var date = pubUtils.parseDate(publiDate.dateInfo) journaldiv.append(" ") $("").text(date.getFullYear().toString()).appendTo(journaldiv) journaldiv.append(" ") @@ -58,8 +65,9 @@ async function createPubliUI(publi,toolTips=false,abstract=false) { href: publi.URL, target: "_blank" }).text(String.raw`DOI: ${publi.DOI}`).appendTo(art) - $("

    ").append("Published on ").append($("

    ").append(`${publiDate.type== "created" ? "First p" : "P"}ublished on `).append($("