Initial commit

This commit is contained in:
firebingo 2018-03-28 07:14:26 -07:00
commit 1e710af520
17 changed files with 12275 additions and 0 deletions

53
Js/Common.js Normal file
View file

@ -0,0 +1,53 @@
'use strict';
var rootUrl = `${window.location.protocol}//${window.location.host}/`
class commonFunctions {
static getFileText(file) {
return new Promise((resolve, reject) => {
fetch(file)
.then((success) => {
success.text()
.then((text) => {
resolve(text);
});
}, (failure) => {
reject(failure);
});
});
}
static getFileJson(file) {
return new Promise((resolve, reject) => {
fetch(file)
.then((success) => {
success.json()
.then((json) => {
resolve(json);
});
}, (failure) => {
reject(failure);
});
});
}
static readLine(line, headers) {
if(line.startsWith('//')) {
return {comment: line};
} else if(!line) {
return undefined;
} else {
var split = line.split('\t');
var newEntry = {};
for(let i = 0; i < split.length; ++i) {
var x = split[i];
newEntry[headers[i]] = x;
}
return newEntry;
}
}
static lerp(start, end, t) {
return (1 - t) * start + t * end;
}
}