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

View File

@ -108,9 +108,12 @@ class dataFileBase {
this.method = null this.method = null
this.excitations = [] this.excitations = []
this.DOI = null this.DOI = null
this.sourceFile=null
} }
static async loadAsync(file) { 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) { static readmetaPair(key, value, dat) {
switch (key) { switch (key) {