10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-11-04 13:13:55 +01:00

Use websiteFile

This commit is contained in:
Mickaël Véril 2019-09-30 10:53:13 +02:00
parent 7ac3912c44
commit 039143d275
2 changed files with 14 additions and 6 deletions

View File

@ -9,6 +9,7 @@ draft: false
<script src="/scripts/getTextFromFile.js" type="text/javascript"></script>
<script src="/scripts/trueTypeOf.js" type="text/javascript"></script>
<script src="/scripts/noNan.js"></script>
<script src="/scripts/websiteFile.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="https://cdn.plot.ly/plotly-latest.min.js"></script>
{{< getDataFilesName >}}
@ -67,8 +68,6 @@ draft: false
reload()
}
async function update_file(file) {
var lnk_file=document.getElementById('lnk_file');
lnk_file.setAttribute('href',String.raw`view?dataFile=${file}`);
dat= await data.loadAsync(file);
await applyData(dat);
}
@ -78,7 +77,7 @@ draft: false
par.innerHTML='';
var md=[];
var els=[];
var customRenderingProp=["excitations"]
var customRenderingProp=["excitations","sourceFile"]
for (const key of Object.keys(window.data)) {
if (window.data[key]!=null){
md.push(key)
@ -87,6 +86,7 @@ draft: false
md.push([prop,window.data[key][prop]])
}
md.push(window.data[key].DOI)
md.push(window.data[key].sourceFile)
}
}
div=document.getElementById("meta_div")
@ -111,6 +111,12 @@ draft: false
node.target='_blank'
node.href=element.url
break
case "websiteFile":
node=document.createElement("a")
node.innerText="Go to file"
node.target='_blank'
node.href=element.viewerUrl
break
case "Array":
k=element[0]
v=element[1]
@ -211,4 +217,3 @@ draft: false
</div>
</div>
</p>
<a target="_blank" id='lnk_file'>Go to file</a>

View File

@ -108,9 +108,12 @@ class dataFileBase {
this.method = null
this.excitations = []
this.DOI = null
this.sourceFile=null
}
static async loadAsync(file) {
return this.loadString(await getTextFromFileAsync(getFullDataPath(file)));
var dat = this.loadString(await getTextFromFileAsync(getFullDataPath(file)));
dat.sourceFile=new websiteFile(file)
return dat
}
static readmetaPair(key, value, dat) {
switch (key) {