<commit_before>// This will change based on what a user picks...
var wipeOnNewLoad = false;

var loadFile = function() {
  var input, file, fr;

  if (typeof window.FileReader !== 'function') {
    alert("The file API isn't supported on this browser yet.");
    return;
  }

  input = document.getElementById('fileinput');
  if (!input) {
    alert("Um, couldn't find the fileinput element.");
  }
  else if (!input.files) {
    alert("This browser doesn't seem to support the `files` property of file inputs.");
  }
  else if (!input.files[0]) {
    alert("Please select a file before clicking 'Load'");
  }
  else {
    file = input.files[0];

    if (!file || file.type !== "application/json") {
      alert("Pick a file, and ensure that it is type json");
    }

    fr = new FileReader();
    fr.onload = receivedText;
    fr.readAsText(file);
  }

  function receivedText(e) {
    lines = e.target.result;
    var graphData = JSON.parse(lines); 
    render(graphData, {wipeOnNewLoad: wipeOnNewLoad});
    if (!wipeOnNewLoad) wipeOnNewLoad = true;
  }
}<commit_msg>Added check on filepicker<commit_after>// This will change based on what a user picks...
var wipeOnNewLoad = false;

var loadFile = function() {
  var input, file, fr;

  if (typeof window.FileReader !== 'function') {
    alert("The file API isn't supported on this browser yet.");
    return;
  }

  input = document.getElementById('fileinput');
  if (!input) {
    alert("Um, couldn't find the fileinput element.");
  }
  else if (!input.files) {
    alert("This browser doesn't seem to support the `files` property of file inputs.");
  }
  else if (!input.files[0]) {
    alert("Please select a file before clicking 'Load'");
  }
  else {
    file = input.files[0];

    if (!file || file.type !== "application/json") {
      alert("Pick a file, and ensure that it is type json");
      return;
    }

    fr = new FileReader();
    fr.onload = receivedText;
    fr.readAsText(file);
  }

  function receivedText(e) {
    lines = e.target.result;
    var graphData = JSON.parse(lines); 
    render(graphData, {wipeOnNewLoad: wipeOnNewLoad});
    if (!wipeOnNewLoad) wipeOnNewLoad = true;
  }
}
{'fraction_non_alphanumeric': 0.13804247460757155, 'fraction_numerical': 0.0018467220683287165, 'mean_word_length': 3.1753371868978806, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3674859', 'n_tokens_mistral': 699, 'n_tokens_neox': 669, 'n_words': 216}