mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-12-25 13:53:48 +01:00
Improvements for publications
This commit is contained in:
parent
d1af83bbf9
commit
14ae7312fc
@ -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")
|
||||
|
@ -1,4 +1,8 @@
|
||||
async function createPubliUI(publi,toolTips=false,abstract=false) {
|
||||
var DayAndMothsFormat ={
|
||||
minimumIntegerDigits: 2,
|
||||
useGrouping: false
|
||||
}
|
||||
const art = $("<article/>").addClass("publi")
|
||||
art.className = "publi"
|
||||
$("<a/>", {
|
||||
@ -13,8 +17,10 @@ async function createPubliUI(publi,toolTips=false,abstract=false) {
|
||||
var notifycontent = $("<div/>").addClass("author-info")
|
||||
$("<h1/>").text(String.raw`${author.given} ${author.family}`).appendTo(notifycontent)
|
||||
ulaff = $("<ul/>").addClass("affiliation-list").appendTo(notifycontent)
|
||||
for (const a of author.affiliation) {
|
||||
$("<li/>").text(a.name).appendTo(ulaff)
|
||||
if (author.affiliation) {
|
||||
for (const a of author.affiliation) {
|
||||
$("<li/>").text(a.name).appendTo(ulaff)
|
||||
}
|
||||
}
|
||||
if (author["authenticated-orcid"]) {
|
||||
const html = String.raw`<div class="orcid-id"><a href="https://orcid.org" target="_blank"><img alt="ORCID logo" src="https://orcid.org/sites/default/files/images/orcid_16x16.png" width="16" height="16"/></a> <a href="${author.ORCID}" target="_blank">${author.ORCID} </a></div>`
|
||||
@ -44,7 +50,8 @@ async function createPubliUI(publi,toolTips=false,abstract=false) {
|
||||
else {
|
||||
$("<span/>").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(" ")
|
||||
$("<span/>").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)
|
||||
$("<p/>").append("Published on ").append($("<time/>", {
|
||||
datetime: JSON.stringify(date)
|
||||
|
||||
$("<p/>").append(`${publiDate.type== "created" ? "First p" : "P"}ublished on `).append($("<time/>", {
|
||||
datetime: date.toISOString().substring(0, 10)
|
||||
}).text(date.toLocaleDateString("en-us", {
|
||||
day: "numeric",
|
||||
month: "short",
|
||||
|
@ -1,6 +1,27 @@
|
||||
class pubUtils{
|
||||
static getIssuedDate(publi) {
|
||||
const parts=publi.issued["date-parts"][0]
|
||||
return new Date(Date.UTC(parts[0], parts[1] - 1, parts[2]))
|
||||
class pubUtils {
|
||||
static parseDate(date) {
|
||||
if (date["date-time"]) {
|
||||
return Date.parse(date["date-time"])
|
||||
}
|
||||
if (date.timestamp) {
|
||||
return Date(date.timestamp)
|
||||
}
|
||||
const parts=date["date-parts"][0]
|
||||
const [year, month, day] = date['date-parts'][0]
|
||||
if (day) {
|
||||
return new Date(Date.UTC(year, month - 1, day))
|
||||
} else if (month) {
|
||||
return new Date(Date.UTC(year, month - 1))
|
||||
} else {
|
||||
return new Date(Date.UTC(year))
|
||||
}
|
||||
}
|
||||
static bestDate(publi) {
|
||||
if (publi.issued != null) {
|
||||
return {type:"issued", dateInfo:publi.issued}
|
||||
}
|
||||
else {
|
||||
return {type:"created", dateInfo:publi.created}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user