mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-12-25 22:03:49 +01:00
Use JSYAML and apply changes
This commit is contained in:
parent
e7506344c4
commit
5fb1b4252c
@ -16,7 +16,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="/js/getPublis.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>
|
||||
@ -24,6 +24,7 @@ draft: false
|
||||
<script src="/js/selectSelectAll.js"></script>
|
||||
<script src="https://unpkg.com/simple-statistics@7.0.2/dist/simple-statistics.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bowser@2.5.3/es5.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.13.1/js-yaml.min.js"></script>
|
||||
<script src="/js/numberUtils.js"></script>
|
||||
<script>
|
||||
function adjustSticky(){
|
||||
@ -199,7 +200,16 @@ draft: false
|
||||
return $(el).val().includes(getSelectValue(d, el.name))
|
||||
})
|
||||
}).map((d) => getSelectValue(d, name)))
|
||||
const sets = (name === "DOI") ? await getSets() : undefined
|
||||
const sets = await (async ()=>{
|
||||
if(name === "DOI"){
|
||||
const publis=await getPublis()
|
||||
const sets=publis.sets
|
||||
return sets
|
||||
}
|
||||
else{
|
||||
return undefined
|
||||
}
|
||||
})()
|
||||
for (const val of vals) {
|
||||
if (val !== null) {
|
||||
$("<option/>", {
|
||||
@ -266,7 +276,8 @@ draft: false
|
||||
var td = $("<td/>")
|
||||
if (i === 1) {
|
||||
var publi = doiCache.get(el, true)
|
||||
const sets = await getSets()
|
||||
const publis = await getPublis()
|
||||
const sets=publis.srts
|
||||
if (sets.has(el)) {
|
||||
var str = sets.get(el)
|
||||
$(td).append(str)
|
||||
@ -362,7 +373,7 @@ draft: false
|
||||
var data = $("#data")
|
||||
$(data).empty();
|
||||
if (window.filtData.length > 0) {
|
||||
var sets = await getSets()
|
||||
const sets = (await getPublis()).sets
|
||||
for (const doi of doiCache.keys()) {
|
||||
paperdata = window.filtData.filter((d) => {
|
||||
return d.DOI.string == doi
|
||||
|
@ -5,12 +5,13 @@ draft: false
|
||||
---
|
||||
<link rel="stylesheet" type="text/css" href="/css/publi.css" />
|
||||
<script src="/js/data.js" type="text/javascript"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.13.1/js-yaml.min.js"></script>
|
||||
<script src="/js/loadAllData.js" type="text/javascript"></script>
|
||||
<script src="/js/getFullDataPath.js" type="text/javascript"></script>
|
||||
<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/getPublis.js"></script>
|
||||
<script src="/js/websiteFile.js"></script>
|
||||
<script src="/js/numberUtils.js"></script>
|
||||
<script src="/js/createPubliUI.js"></script>
|
||||
@ -21,10 +22,14 @@ 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()
|
||||
const pubs = await getPublis()
|
||||
const publis = publiscite.format('data', { format: 'object' })
|
||||
for (const publi of publis) {
|
||||
art=createPubliUI(publi,sets,true)
|
||||
art=createPubliUI(publi,pubs.sets,true)
|
||||
$(art).appendTo("<li/>").appendTo("#publis_ul")
|
||||
}
|
||||
for (const publi of pubs.others.keys()) {
|
||||
art=createPubliUI(publi,pubs.others,true)
|
||||
$(art).appendTo("<li/>").appendTo("#publis_ul")
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,8 @@ 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/getPUblis.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.13.1/js-yaml.min.js"></script>
|
||||
<script src="/js/websiteFile.js"></script>
|
||||
{{< getDataFilesName >}}
|
||||
<script>
|
||||
@ -103,7 +104,7 @@ draft: false
|
||||
case DOI.name:
|
||||
var publi = await Cite.async(element.string)
|
||||
var publiel=$("<div/>")
|
||||
const sets=await getSets()
|
||||
const sets=(await getPublis()).sets()
|
||||
if(sets.has(element.string)){
|
||||
$(publiel).append(sets.get(element.string))
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
function createPubliUI(publi,sets=new Map(),toolTips=false) {
|
||||
const art = $("<article/>").addClass("publi")
|
||||
art.className = "publi"
|
||||
if (sets.has(publi.DOI)) {
|
||||
if (sets.has(publi.DOI) && sets.get(publi.DOI)!==null) {
|
||||
$("<h1/>").text(sets.get(publi.DOI)).appendTo(art)
|
||||
}
|
||||
$("<a/>", {
|
||||
|
7
static/js/getPublis.js
Normal file
7
static/js/getPublis.js
Normal file
@ -0,0 +1,7 @@
|
||||
async function getPublis() {
|
||||
const text = await getTextFromFileUrlAsync("/data/publis.yaml")
|
||||
const myYaml=jsyaml.load(text);
|
||||
myYaml.sets= ((myYaml.sets===null) ? new Map() : new Map(Object.entries(myYaml.sets)));
|
||||
myYaml.others=((myYaml.others===null) ? new Map() : new Map(Object.entries(myYaml.others)));
|
||||
return myYaml
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
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
|
||||
}
|
Loading…
Reference in New Issue
Block a user