mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-08-25 05:31:51 +02:00
Use Class.name for trueTypeOf
comparison and only constructor name
This commit is contained in:
parent
9cd212ab33
commit
923a9acb7f
@ -131,7 +131,7 @@ draft: false
|
||||
var td = $("<td/>", {
|
||||
style: "white-space: nowrap;"
|
||||
})
|
||||
if (trueTypeOf(el) == "DOI") {
|
||||
if (trueTypeOf(el) == DOI.name) {
|
||||
var publi = doiCache.get(el.string)
|
||||
$("<a/>", {
|
||||
href: el.url,
|
||||
@ -230,7 +230,7 @@ draft: false
|
||||
})
|
||||
for (const el of tableels) {
|
||||
td=$(tdtemp).clone()
|
||||
if (trueTypeOf(el) == "DOI") {
|
||||
if (trueTypeOf(el) == DOI.name) {
|
||||
var publi = doiCache.get(el.string)
|
||||
$("<a/>", {
|
||||
href: el.url,
|
||||
|
@ -96,10 +96,10 @@ draft: false
|
||||
$(sec).empty()
|
||||
for (const element of md) {
|
||||
switch (trueTypeOf(element)) {
|
||||
case "string":
|
||||
case String.name:
|
||||
$("<h2/>").text(element).appendTo(sec)
|
||||
break;
|
||||
case "DOI":
|
||||
case DOI.name:
|
||||
var publi = await Cite.async(element.string)
|
||||
var output = publi.format('bibliography', {
|
||||
format: 'html',
|
||||
@ -111,14 +111,14 @@ draft: false
|
||||
target: "_blank"
|
||||
}).html(output).appendTo(sec)
|
||||
break
|
||||
case "websiteFile":
|
||||
case websiteFile.name:
|
||||
$("<a/>", {
|
||||
href: element.url,
|
||||
target: "_blank",
|
||||
href: await element.getViewerURL()
|
||||
}).text("Go to file").appendTo(sec)
|
||||
break
|
||||
case "Array":
|
||||
case Array.name:
|
||||
k = element[0]
|
||||
v = element[1]
|
||||
k = k.charAt(0).toUpperCase() + k.slice(1)
|
||||
|
@ -112,11 +112,11 @@ class dataFileBase {
|
||||
}
|
||||
static async loadAsync(file) {
|
||||
switch (trueTypeOf(file)) {
|
||||
case "string":
|
||||
case String.name:
|
||||
file=getFullDataPath(file)
|
||||
var str=await getTextFromFileUrlAsync(file)
|
||||
break;
|
||||
case "File":
|
||||
case File.name:
|
||||
var str=await getTextFromUploadedFileAsync(file)
|
||||
break
|
||||
}
|
||||
|
@ -1,7 +1,3 @@
|
||||
function trueTypeOf(object){
|
||||
result=typeof object
|
||||
if(result==typeof({})) {
|
||||
result= object.constructor.name
|
||||
}
|
||||
return result
|
||||
return object.constructor.name
|
||||
}
|
||||
|
@ -7,10 +7,10 @@ class websiteFile{
|
||||
var params=new URLSearchParams()
|
||||
var urlbase="/view"
|
||||
switch (trueTypeOf(this.file)) {
|
||||
case "string":
|
||||
case String.name:
|
||||
params.append("file",this.file)
|
||||
break
|
||||
case "File":
|
||||
case File.name:
|
||||
var base64=btoa(await getTextFromUploadedFileAsync(this.file))
|
||||
params.append("fileBase64",base64);
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user