10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 13:53:48 +01:00
This commit is contained in:
scemama 2020-11-25 00:55:18 +00:00
parent 1bea6f1ee3
commit a11ed8cc4b
6 changed files with 3111 additions and 3106 deletions

File diff suppressed because one or more lines are too long

View File

@ -28,7 +28,8 @@ class PubliData{
}
static GetPathForDOI(DOI){
return `/data/publis/${DOI.replaceAll(".","/")}`
var site_url = window.location.origin;
return site_url + `/data/publis/${DOI.replaceAll(".","/")}`
}
static GetAbstractURLForDOI(DOI){
return `${PubliData.GetPathForDOI(DOI)}/abstract.html`
@ -41,4 +42,4 @@ class PubliData{
static async getAbstractTexForDOIAsync(DOI){
return await getTextFromFileUrlAsync(PubliData.GetAbstractURLForDOI(DOI))
}
}
}

View File

@ -232,8 +232,9 @@ class dataFileBase {
return /^#\s*([A-Za-z_]+)\s*:\s*(.*)$/;
}
async getGeometryAsync(state = null) {
var site_url = "/"+window.location.pathname.split('/')[1];
// var text = await getTextFromFileUrlAsync(`/data/structures/${this.set.name.replace("#", "")}/${this.molecule.toLowerCase()}.xyz`)
var text = getTextFromFileUrl(`/data/structures/${this.set.name.replace("#", "")}/${this.molecule.toLowerCase()}.xyz`)
var text = getTextFromFileUrl(site_url+`/data/structures/${this.set.name.replace("#", "")}/${this.molecule.toLowerCase()}.xyz`)
var lines = text.split("\n")
var indexes = lines.findAllIndexes((line) => {
return line.match(/^\d+$/)

View File

@ -1,3 +1,4 @@
function getFullDataPath(path) {
return '/data/' + path;
var site_url = "/"+window.location.pathname.split('/')[1];
return site_url+'/data/' + path;
}

View File

@ -1,5 +1,6 @@
var fileCache = function () {
var json_url = "/data/database.json";
var site_url = "/"+window.location.pathname.split('/')[1];
var json_url = site_url+"/data/database.json";
var req = new XMLHttpRequest();
req.open("GET",json_url, false);
req.send();

View File

@ -5,11 +5,12 @@ class indexDB {
}
var db = new indexDB
const maxAge= (DebugMode.Enabled,0,600)
const text = await getTextFromFileUrlAsync("/data/index.yaml",{"Cache-Control":`max-age=${maxAge}`})
var site_url = "/"+window.location.pathname.split('/')[1];
const text = await getTextFromFileUrlAsync(site_url+"/data/index.yaml",{"Cache-Control":`max-age=${maxAge}`})
const myYaml = jsyaml.load(text);
db.sets = ((myYaml.sets === null) ? new Map() : new Map(Object.entries(myYaml.sets)));
db.others = ((myYaml.others === null) ? [] : Array.from(myYaml.others));
window.indexDB=db
return db
}
}
}