10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-24 13:23:40 +01:00

Add datasets

This commit is contained in:
Mickaël Véril 2019-11-27 18:29:29 +01:00
parent 9c18598f82
commit bb2e955da9
6 changed files with 51 additions and 5 deletions

View File

@ -14,6 +14,7 @@ draft: false
<script src="/js/processingIndicator.js"></script>
<script src="/js/noNan.js"></script>
<script src="/js/websiteFile.js"></script>
<script src="/js/getSets.js"></script>
<script src="https://cdn.rawgit.com/larsgw/citation.js/archive/citation.js/citation-0.4.0-9.js"
type="text/javascript"></script>
<script src="/js/DOICache.js"></script>
@ -77,12 +78,20 @@ draft: false
$('#form_dat > fieldset > div > select,#sel_ref').each(function () {
$(this).find('option[value!=""]').remove()
})
$('#form_dat > fieldset > div > select').each(function () {
$('#form_dat > fieldset > div > select').each(async function () {
const vals = uniq(window.dats.map((d) => { return d[$(this).attr("name")] }))
var sets=await getSets()
for (const val of vals) {
$("<option/>", {
var op=$("<option/>", {
value: JSON.stringify(val)
}).text(val.toString()).appendTo($(this))
})
if ($(this).attr("name")=="DOI" && sets.has(val.toString())){
$(op).text(sets.get(val.toString()))
}
else{
$(op).text(val.toString())
}
op.appendTo(this)
}
})
$('#form_dat > input[type="submit"').prop('disabled', false);
@ -133,6 +142,10 @@ draft: false
})
if (trueTypeOf(el) == DOI.name) {
var publi = doiCache.get(el.string)
const sets=await getSets()
if(sets.has(el.toString())){
$(td).append(sets.get(el.toString()))
}
$("<a/>", {
href: el.url,
target: "_blank"
@ -232,6 +245,10 @@ draft: false
td=$(tdtemp).clone()
if (trueTypeOf(el) == DOI.name) {
var publi = doiCache.get(el.string)
const sets=await getSets()
if(sets.has(el.toString())){
$(td).append(sets.get(el.toString()))
}
$("<a/>", {
href: el.url,
target: "_blank",

View File

@ -10,6 +10,7 @@ draft: false
<script src="/js/getTextFromFile.js" type="text/javascript"></script>
<script src="/js/trueTypeOf.js" type="text/javascript"></script>
<script src="/js/uniq.js"></script>
<script src="/js/getSets.js"></script>
<script src="/js/websiteFile.js"></script>
{{< getDataFilesName >}}
<script>
@ -18,14 +19,18 @@ draft: false
const Cite = require("citation-js")
const dois = uniq(Object.values(await loadAllData()).flat().map(d => d.DOI.string))
const publiscite = await Cite.async(dois)
const sets= await getSets()
console.log(sets)
const publis = publiscite.format('data', { format: 'object' })
for (const publi of publis) {
const art = $("<article/>").addClass("publi")
art.className = "publi"
console.log(sets.get(publi.DOI))
$("<h1/>").text(sets.get(publi.DOI)).appendTo(art)
$("<a/>", {
href: publi.URL,
target: "_blank"
}).html($("<h1/>").text(publi.title)).appendTo(art)
}).html($("<h2/>").text(publi.title)).appendTo(art)
const authors = publi.author
const ulauthors = $("<ul/>").addClass("authors-list").appendTo(art)
for (const author of authors) {

View File

@ -12,6 +12,7 @@ draft: false
<script src="/js/getTextFromFile.js" type="text/javascript"></script>
<script src="/js/trueTypeOf.js" type="text/javascript"></script>
<script src="/js/noNan.js"></script>
<script src="/js/getSets.js"></script>
<script src="/js/websiteFile.js"></script>
{{< getDataFilesName >}}
<script>
@ -101,6 +102,11 @@ draft: false
break;
case DOI.name:
var publi = await Cite.async(element.string)
var publiel=$("<div/>")
const sets=await getSets()
if(sets.has(element.string)){
$(publiel).append(sets.get(element.string))
}
var output = publi.format('bibliography', {
format: 'html',
template: 'apa',
@ -109,7 +115,8 @@ draft: false
$("<a/>", {
href: element.url,
target: "_blank"
}).html(output).appendTo(sec)
}).html(output).appendTo(publiel)
$(sec).append(publiel)
break
case websiteFile.name:
$("<a/>", {

View File

@ -1,4 +1,7 @@
.publi h1 {
font-size: 22pt
}
.publi h2 {
font-size: 20pt
}

4
static/data/datasets.lst Normal file
View File

@ -0,0 +1,4 @@
10.1021/acs.jctc.8b00406 : set 1
10.1021/acs.jctc.8b01205 : set 2
10.1021/acs.jpclett.8b02058 : set 3
10.1021/acs.jctc.8b01103 : set 4

10
static/js/getSets.js Normal file
View File

@ -0,0 +1,10 @@
async function getSets(){
var m=new Map()
const text=await getTextFromFileUrlAsync("/data/datasets.lst")
const lines=text.split("\n")
for(const line of lines){
const kv=line.split(":",2)
m.set(kv[0].trim(),kv[1].trim())
}
return m
}