10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-26 06:14:38 +01:00

Add support for Supporting info (SI)

This commit is contained in:
Mickaël Véril 2020-01-08 11:02:15 +01:00
parent 68eac5baf5
commit f60e0ffa91
2 changed files with 28 additions and 7 deletions

View File

@ -119,8 +119,12 @@ draft: false
var op = $("<option/>", { var op = $("<option/>", {
value: JSON.stringify(val) value: JSON.stringify(val)
}) })
if ($(this).attr("name") == "DOI" && sets.has(val.toString())) { if ($(this).attr("name") == "DOI" && sets.has(val.string)) {
$(op).text(sets.get(val.toString())) str=sets.get(val.string)
if(val.IsSupporting){
str+=" (SI)"
}
$(op).text(str)
} }
else { else {
$(op).text(val.toString()) $(op).text(val.toString())
@ -177,8 +181,12 @@ draft: false
if (trueTypeOf(el) == DOI.name) { if (trueTypeOf(el) == DOI.name) {
var publi = doiCache.get(el.string, true) var publi = doiCache.get(el.string, true)
const sets = await getSets() const sets = await getSets()
if (sets.has(el.toString())) { if (sets.has(el.string)) {
$(td).append(sets.get(el.toString())) var str=sets.get(el.string)
if(el.IsSupporting){
str+=" (SI)"
}
$(td).append(str)
} }
$("<a/>", { $("<a/>", {
href: el.url, href: el.url,

View File

@ -100,11 +100,24 @@ class state {
}; };
} }
class DOI { class DOI {
constructor(doistring) { constructor(doistring,IsSupporting=false) {
this.string = doistring this.string = doistring
this.IsSupporting = IsSupporting
}; };
static fromString(str){
const vals=str.split(",")
if (vals.length>1) {
return new DOI(vals[0].toString())
}
else{
return new DOI(str[0].toString(),(true ? str[1]=== true.toString() : false))
}
}
toString() { toString() {
return this.string; var str=this.string;
if (this.IsSupporting) {
str+=" "+"(SI)"
}
}; };
get url() { get url() {
return new URL(this.string, 'https://doi.org').toString() return new URL(this.string, 'https://doi.org').toString()
@ -222,7 +235,7 @@ class dataFileBase {
dat.method = method.fromString(value) dat.method = method.fromString(value)
break; break;
case "doi": case "doi":
dat.DOI = new DOI(value); dat.DOI = DOI.fromString(value);
break; break;
default: default:
} }