Skip to content

Commit

Permalink
Adding visualize folder commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Edouard360 committed Oct 4, 2017
1 parent a3ca11f commit 2c1789f
Show file tree
Hide file tree
Showing 6 changed files with 1,257 additions and 0 deletions.
34 changes: 34 additions & 0 deletions visualize/static/localVisualizer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
$(function () {
var $dropZone = $("html");
var $filePicker = $("#filePicker");
function handleFiles(files) {
// only use the first file.
file = files[0];
console.log(file)
var reader = new FileReader();

reader.onload = (function(filename) { // finished reading file data.
return function(e2) {
$("#displayArea").empty();
var fsHeight = $("#fileSelect").outerHeight();
showGame(textToGame(e2.target.result, filename), $("#displayArea"), null, -fsHeight, true, false, true);
};
})(file.name);
reader.readAsText(file); // start reading the file data.
}

$dropZone.on('dragover', function(e) {
e.stopPropagation();
e.preventDefault();
});
$dropZone.on('drop', function(e) {
e.stopPropagation();
e.preventDefault();
var files = e.originalEvent.dataTransfer.files; // Array of all files
handleFiles(files)
});
$filePicker.on('change', function(e) {
var files = e.target.files
handleFiles(files)
});
})
Loading

0 comments on commit 2c1789f

Please sign in to comment.