<commit_before>(function () {
  FilePond.registerPlugin(FilePondPluginImagePreview);
  FilePond.registerPlugin(FilePondPluginImageExifOrientation);
  const fileInput = document.querySelector('input[type="file"]');
  if (fileInput !== null) {
    const form = fileInput.closest('form');


    form.addEventListener('submit', function (e) {
      e.preventDefault();
      form.querySelector('button').setAttribute('disabled', true);
      pond.processFiles().then(function (uploaded_files) {
        const input_name = fileInput.name
        var hiddenS3Input = document.createElement('input');
        hiddenS3Input.type = 'hidden';
        hiddenS3Input.name = 's3file';
        form.appendChild(hiddenS3Input);

        var input_value = Array.from(document.querySelectorAll('input[name="' + input_name + '"]'));
        var all_values = [];
        uploaded_files.forEach(function (uploaded_file) {
          all_values.push(uploaded_file.serverId);
        })
        hiddenS3Input.value = JSON.stringify(input_value.map(function (input) {
          return input.name
        }));
        input_value.map(function (input) {
          input.value = JSON.stringify(all_values)
        })
        form.submit();
      });

    })
  }

  function parseKeyFromXML (xml_text) {
    var xml = new window.DOMParser().parseFromString(xml_text, 'text/xml')
    var tag = xml.getElementsByTagName('Key')[0]
    return decodeURI(tag.childNodes[0].nodeValue)
  }

  var fp_options = {
    imagePreviewTransparencyIndicator: 'grid',
    dropOnPage: true,
    labelIdle: "Take a photo of a leaflet",
    maxFiles: 10,<commit_msg>Disable form buttons on submit<commit_after>(function () {
  // Disable all buttons on submit
  document.querySelectorAll('form').forEach(function(form) {
    form.addEventListener('submit', function (e) {
      form.querySelectorAll('button').forEach(
        function(button){
          button.setAttribute('disabled', 'true')
        })
    })
  })
  FilePond.registerPlugin(FilePondPluginImagePreview);
  FilePond.registerPlugin(FilePondPluginImageExifOrientation);
  const fileInput = document.querySelector('input[type="file"]');
  if (fileInput !== null) {
    const form = fileInput.closest('form');


    form.addEventListener('submit', function (e) {
      e.preventDefault();
      pond.processFiles().then(function (uploaded_files) {
        const input_name = fileInput.name
        var hiddenS3Input = document.createElement('input');
        hiddenS3Input.type = 'hidden';
        hiddenS3Input.name = 's3file';
        form.appendChild(hiddenS3Input);

        var input_value = Array.from(document.querySelectorAll('input[name="' + input_name + '"]'));
        var all_values = [];
        uploaded_files.forEach(function (uploaded_file) {
          all_values.push(uploaded_file.serverId);
        })
        hiddenS3Input.value = JSON.stringify(input_value.map(function (input) {
          return input.name
        }));
        input_value.map(function (input) {
          input.value = JSON.stringify(all_values)
        })
        form.submit();
      });
    })
  }

  function parseKeyFromXML (xml_text) {
    var xml = new window.DOMParser().parseFromString(xml_text, 'text/xml')
    var tag = xml.getElementsByTagName('Key')[0]
    return decodeURI(tag.childNodes[0].nodeValue)
  }

  var fp_options = {
    imagePreviewTransparencyIndicator: 'grid',
    dropOnPage: true,
    labelIdle: "Take a photo of a leaflet",
    maxFiles: 10,
{'fraction_non_alphanumeric': 0.12938470385278897, 'fraction_numerical': 0.005750431282346176, 'mean_word_length': 3.2687116564417176, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, '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': '1557898', 'n_tokens_mistral': 1031, 'n_tokens_neox': 1020, 'n_words': 170}