2020-08-20 15:28:06 +02:00
|
|
|
async function createPubliUI(publi,toolTips=false,abstract=false) {
|
2020-02-08 14:48:40 +01:00
|
|
|
const art = $("<article/>").addClass("publi")
|
|
|
|
art.className = "publi"
|
|
|
|
$("<a/>", {
|
|
|
|
href: publi.URL,
|
|
|
|
target: "_blank"
|
2020-11-01 16:18:00 +01:00
|
|
|
}).html($("<h1/>").text(publi.title[0])).appendTo(art)
|
2020-02-08 14:48:40 +01:00
|
|
|
const authors = publi.author
|
|
|
|
const ulauthors = $("<ul/>").addClass("authors-list").appendTo(art)
|
|
|
|
for (const author of authors) {
|
|
|
|
const liauth = $("<li/>").addClass("author-item")
|
|
|
|
const spanAuth = $("<span/>").text(String.raw`${author.given} ${author.family}`).appendTo(liauth)
|
|
|
|
var notifycontent = $("<div/>").addClass("author-info")
|
|
|
|
$("<h1/>").text(String.raw`${author.given} ${author.family}`).appendTo(notifycontent)
|
|
|
|
ulaff = $("<ul/>").addClass("affiliation-list").appendTo(notifycontent)
|
2021-02-17 16:39:54 +01:00
|
|
|
if (author.affiliation) {
|
|
|
|
for (const a of author.affiliation) {
|
|
|
|
$("<li/>").text(a.name).appendTo(ulaff)
|
|
|
|
}
|
2020-02-08 14:48:40 +01:00
|
|
|
}
|
|
|
|
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>`
|
|
|
|
notifycontent.append(html)
|
|
|
|
}
|
|
|
|
if (toolTips) {
|
|
|
|
tippy(spanAuth[0], {
|
|
|
|
content: notifycontent[0],
|
|
|
|
theme: 'light',
|
|
|
|
interactive: true,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
ulauthors.append(liauth)
|
|
|
|
}
|
|
|
|
journaldiv = $("<div/>").appendTo(art)
|
2020-11-01 16:18:00 +01:00
|
|
|
if ("container-title-short" in publi && publi["container-title-short"].length>0) {
|
|
|
|
var title_short = $("<span/>").text(publi["container-title-short"][0])
|
2020-02-08 14:48:40 +01:00
|
|
|
journaldiv.append(title_short)
|
|
|
|
if (toolTips) {
|
|
|
|
tippy(title_short[0], {
|
2020-11-01 16:18:00 +01:00
|
|
|
content: publi["container-title"][0],
|
2020-02-08 14:48:40 +01:00
|
|
|
theme: 'light',
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2020-11-01 16:18:00 +01:00
|
|
|
$("<span/>").text(publi["container-title"][0]).appendTo(journaldiv)
|
2020-02-08 14:48:40 +01:00
|
|
|
}
|
2021-02-17 16:39:54 +01:00
|
|
|
var publiDate = pubUtils.bestDate(publi)
|
|
|
|
var date = pubUtils.parseDate(publiDate.dateInfo)
|
2020-05-01 15:39:43 +02:00
|
|
|
journaldiv.append(" ")
|
2020-02-08 14:48:40 +01:00
|
|
|
$("<span/>").text(date.getFullYear().toString()).appendTo(journaldiv)
|
|
|
|
journaldiv.append(" ")
|
|
|
|
$("<span/>").text(publi.volume).appendTo(journaldiv)
|
|
|
|
if (publi.issue) {
|
|
|
|
$("<span/>").addClass("issue").text(publi.issue).appendTo(journaldiv)
|
|
|
|
journaldiv.append(", ")
|
|
|
|
$("<span/>").text(publi.page).appendTo(journaldiv)
|
|
|
|
}
|
|
|
|
$("<a/>", {
|
|
|
|
href: publi.URL,
|
|
|
|
target: "_blank"
|
|
|
|
}).text(String.raw`DOI: ${publi.DOI}`).appendTo(art)
|
2021-02-17 16:39:54 +01:00
|
|
|
|
|
|
|
$("<p/>").append(`${publiDate.type== "created" ? "First p" : "P"}ublished on `).append($("<time/>", {
|
|
|
|
datetime: date.toISOString().substring(0, 10)
|
2020-02-08 14:48:40 +01:00
|
|
|
}).text(date.toLocaleDateString("en-us", {
|
|
|
|
day: "numeric",
|
|
|
|
month: "short",
|
|
|
|
year: "numeric"
|
|
|
|
}))).appendTo(art)
|
2020-06-15 16:13:03 +02:00
|
|
|
if (abstract) {
|
|
|
|
var ab = $("<section>",{id: "abstract",}).addClass("well").addClass("abstract")
|
|
|
|
var abfig =$("<figure>").addClass("picture")
|
|
|
|
abfig.appendTo(ab)
|
2020-11-01 16:18:00 +01:00
|
|
|
$("<img>",{src:publi.PictureURL}).appendTo(abfig)
|
|
|
|
var htmltxt = await publi.getAbstractTextAsync()
|
2020-06-15 16:13:03 +02:00
|
|
|
abtxt=$("<p>").html(htmltxt)
|
|
|
|
abtxt.appendTo(ab)
|
|
|
|
art.append(ab)
|
|
|
|
}
|
2020-02-08 14:48:40 +01:00
|
|
|
return art
|
|
|
|
}
|