diff --git a/assets/js/footer-functions.js b/assets/js/footer-functions.js index e69de29..8b13789 100644 --- a/assets/js/footer-functions.js +++ b/assets/js/footer-functions.js @@ -0,0 +1 @@ + diff --git a/assets/js/read-files.js b/assets/js/read-files.js index 5ba0fe8..f2d6bdf 100644 --- a/assets/js/read-files.js +++ b/assets/js/read-files.js @@ -1,8 +1,14 @@ +let fileInput = document.getElementById('fileinput'); +fileInput.addEventListener('change', getSingleFileAsText, false); + + + function printSingleFileAsText(evt) { let fileContent = getSingleFileAsText(evt); console.log(fileContent); } + function getSingleFileAsText(evt) { //Retrieve the first (and only!) File from the FileList object let result = ""; @@ -12,9 +18,12 @@ function getSingleFileAsText(evt) { fileReader.onload = function(event) { let contents = event.target.result; let words = getWords(contents); + console.log (" The content in the file " + "\n"+ words) } + return fileReader.readAsText(file) } + } function getWords(s) { @@ -28,5 +37,5 @@ function getWords(s) { } -let fileInput = document.getElementById('fileinput'); -fileInput.addEventListener('change', getSingleFileAsText, false); \ No newline at end of file + + diff --git a/assets/file-to-upload.txt b/assets/sss.txt similarity index 80% rename from assets/file-to-upload.txt rename to assets/sss.txt index e380975..d76a622 100644 --- a/assets/file-to-upload.txt +++ b/assets/sss.txt @@ -1,4 +1,4 @@ -the quick brown fox jumps over the lazy dog -aerial reconaissance vehicle -zeta reticuli constellation -stellated tetrahedron \ No newline at end of file +the quick brown fox jumps over the lazy dog +aerial reconaissance vehicle +zeta reticuli constellation +stellated tetrahedron diff --git a/index.html b/index.html index 285a1b8..0a0b4ee 100644 --- a/index.html +++ b/index.html @@ -15,40 +15,13 @@ - - - - - - - - - - - - - - - - - -
- - - - - - - -