<commit_before>/*global CryptoJS */

if (window.File && window.FileReader) {
  // Great success! All the File APIs are supported.
} else {
  alert('Sorry, your brower does not support features needed for this service.');
}

var fileInput = document.getElementById('file-input');
var drophere = document.getElementById('js-drophere');
var dropbox = document.getElementById("js-dropbox");
var dropmask = document.getElementById("drop-mask");

var hashFile = function(fileAsText) {
  // we are using cryptoJS https://code.google.com/p/crypto-js/
  var hash = CryptoJS.SHA256(fileAsText);
  return hash.toString(CryptoJS.enc.Hex);
};

function handleFiles(/* FileList */ files) {
  if(files.length === 0) {
    // no file selected
    return;
  }

  var f = files[0];
  
  var reader = new FileReader();
  
  reader.onload = function(e) {
    
    var hash = hashFile(e.target.result);
    
    // hide file input and display file name instead
    document.getElementById('filename').innerText = f.name;
    fileInput.style.display = 'none';
    
    var cleanedName = f.name;
    cleanedName.replace(/[^A-Z0-9.\-]/gi, '');
    
    var finalText = 'SHA256 hash value ' + hash + ' ' + cleanedName;
    
    console.log(finalText);
    
    document.getElementById('output').value = finalText;
    document.getElementById('output').classList.add('non-disabled')
    
    document.getElementById('todo-next').innerText = 'Copy this entire text in a bank transfert statement.'
    
    // document.getElementById('sliced-output-0').value = hash.substr(0*16, 16);
    // document.getElementById('sliced-output-1').value = hash.substr(1*16, 16);
    // document.getElementById('sliced-output-2').value = hash.substr(2*16, 16);
    // document.getElementById('sliced-output-3').value = hash.substr(3*16, 16);
    
  };
  <commit_msg>replaced innerText by textContent<commit_after>/*global CryptoJS */

if (window.File && window.FileReader) {
  // Great success! All the File APIs are supported.
} else {
  alert('Sorry, your brower does not support features needed for this service.');
}

var fileInput = document.getElementById('file-input');
var drophere = document.getElementById('js-drophere');
var dropbox = document.getElementById("js-dropbox");
var dropmask = document.getElementById("drop-mask");

var hashFile = function(fileAsText) {
  // we are using cryptoJS https://code.google.com/p/crypto-js/
  var hash = CryptoJS.SHA256(fileAsText);
  return hash.toString(CryptoJS.enc.Hex);
};

function handleFiles(/* FileList */ files) {
  if(files.length === 0) {
    // no file selected
    return;
  }

  var f = files[0];
  
  var reader = new FileReader();
  
  reader.onload = function(e) {
    
    var hash = hashFile(e.target.result);
    
    // hide file input and display file name instead
    document.getElementById('filename').textContent = f.name;
    fileInput.style.display = 'none';
    
    var cleanedName = f.name;
    cleanedName.replace(/[^A-Z0-9.\-]/gi, '');
    
    var finalText = 'SHA256 hash value ' + hash + ' ' + cleanedName;
    
    console.log(finalText);
    
    document.getElementById('output').value = finalText;
    document.getElementById('output').classList.add('non-disabled')
    
    document.getElementById('todo-next').textContent = 'Copy this entire text in a bank transfert statement.'
    
    // document.getElementById('sliced-output-0').value = hash.substr(0*16, 16);
    // document.getElementById('sliced-output-1').value = hash.substr(1*16, 16);
    // document.getElementById('sliced-output-2').value = hash.substr(2*16, 16);
    // document.getElementById('sliced-output-3').value = hash.substr(3*16, 16);
    
  };
  
{'fraction_non_alphanumeric': 0.15040871934604905, 'fraction_numerical': 0.018528610354223433, 'mean_word_length': 3.433574879227053, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '567536', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1128, 'n_words': 245}