Add gitignore and use response.text()

This commit is contained in:
Norbi Peti 2021-01-04 00:20:56 +01:00
parent a96c9df1f5
commit e92c0b1a4f
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
2 changed files with 6 additions and 15 deletions

3
.gitignore vendored Executable file
View file

@ -0,0 +1,3 @@
/_site
.idea
.jekyll-cache

18
spec.js
View file

@ -28,21 +28,9 @@ parseExcel = function (file) {
}; };
lk.onchange = ev => parseExcel(lk.files[0]); lk.onchange = ev => parseExcel(lk.files[0]);
szak.onchange = async ev => { szak.onchange = async ev => {
/*let response = await fetch(document.URL.substr(0,document.URL.lastIndexOf('/'))+'/pti_bsc.xlsx');
let data = await response.blob();
parseExcel(data);*/
/*let isCacheSupported = 'caches' in window;
if (isCacheSupported) {
let cache = await caches.open("targyak");
//await cache.add("https://oktweb.neptun.u-szeged.hu/tanterv/tanterv.aspx?kod=BSZKPTI-N1");
}*/
if (szak.value === "nope") return; if (szak.value === "nope") return;
let reader = new FileReader();
let response = await fetch(document.URL.substr(0, document.URL.lastIndexOf('/')) + '/data/' + szak.value + "_bsc.csv"); let response = await fetch(document.URL.substr(0, document.URL.lastIndexOf('/')) + '/data/' + szak.value + "_bsc.csv");
let data = await response.blob(); let data = await response.text();
reader.onload = ev => { let obj = Papa.parse(data);
let obj = Papa.parse(reader.result); console.log(obj);
console.log(obj);
}
reader.readAsText(data);
}; };