mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-08-26 06:01:49 +02:00
Add citation-js
This commit is contained in:
parent
4a5a22a8fc
commit
f9512999e0
@ -16,6 +16,7 @@ draft: false
|
|||||||
<script src="https://unpkg.com/simple-statistics@7.0.2/dist/simple-statistics.min.js"></script>
|
<script src="https://unpkg.com/simple-statistics@7.0.2/dist/simple-statistics.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
window.onload= async ()=>{
|
window.onload= async ()=>{
|
||||||
|
window.Cite = require('citation-js');
|
||||||
$('#form input[type=radio]').on('change', async function(event) {
|
$('#form input[type=radio]').on('change', async function(event) {
|
||||||
var result = $(this).val();
|
var result = $(this).val();
|
||||||
var proms=[];
|
var proms=[];
|
||||||
@ -72,7 +73,21 @@ draft: false
|
|||||||
var els=[d.molecule,d.comment,d.code,d.method,d.DOI]
|
var els=[d.molecule,d.comment,d.code,d.method,d.DOI]
|
||||||
for(const el of els){
|
for(const el of els){
|
||||||
td=document.createElement("td")
|
td=document.createElement("td")
|
||||||
|
if(trueTypeOf(el)=="doi"){
|
||||||
|
var publipromise=window.Cite.async(el.string)
|
||||||
|
var lnkdoi=document.createElement("a")
|
||||||
|
lnkdoi.href=el.url
|
||||||
|
lnkdoi.target="_blank"
|
||||||
|
publi=await publipromise
|
||||||
|
lnkdoi.innerHTML=publi.format('citation', {
|
||||||
|
format: 'html',
|
||||||
|
lang: 'en-US'
|
||||||
|
})
|
||||||
|
td.appendChild(lnkdoi)
|
||||||
|
}
|
||||||
|
else{
|
||||||
td.innerText=el
|
td.innerText=el
|
||||||
|
}
|
||||||
row.appendChild(td)
|
row.appendChild(td)
|
||||||
}
|
}
|
||||||
dtb.appendChild(row)
|
dtb.appendChild(row)
|
||||||
@ -146,7 +161,7 @@ draft: false
|
|||||||
<th>Comment</th>
|
<th>Comment</th>
|
||||||
<th>Code</th>
|
<th>Code</th>
|
||||||
<th>Method</th>
|
<th>Method</th>
|
||||||
<th>DOI</th>
|
<th>Reference</th>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="dat_table_b">
|
<tbody id="dat_table_b">
|
||||||
</tbody>
|
</tbody>
|
||||||
|
Loading…
Reference in New Issue
Block a user