<commit_before>// FIXME jsdoc
function DynamicForm(parent, formOptions) {
  // require input data from formOptions
  if (formOptions === undefined || formOptions.inputs === undefined) {
    console.warn("Cannot create a DynamicForm without formOptions");
    return false;
  }
  if (parent === undefined) {
    console.warn("Cannot create a DynamicForm without a structure to bind to");
    return false;
  }

  // FIXME: add a way to use nested divs
  var tbody = parent.childElements('tbody')[0];
  var inputOpts = formOptions.inputs;

  // FIXME base64 encoded image, please
  var add_icon = 'resource/add.png';
  var remove_icon = 'resource/remove.png';

  var self = {
      add: function() {
        var newRow = tbody.insertRow(-1);
        addInputs(newRow);
        organizeForm();
      },
      remove: function(node) {
        if (tbody.children.length == 1) {
          return false;
        }
        tbody.removeChild(node);
        organizeForm();
        return true;
      }
    };

  // run that for each field actually..
  var addInputs = function(tableRow) {
    // iterate over configurated inputs
    for (var config in inputOpts) {
      var cell = tableRow.insertCell(-1);
      // FIXME: correct the behaviour..
      var input = document.createElement("INPUT");
      input.type = config.type;
      input.className = config.classname;
      input.name = config.nametemplate;

      cell.appendChild(input);
    }<commit_msg>Base64 encoded images from resource for simplicity<commit_after>// FIXME jsdoc
function DynamicForm(parent, formOptions) {
  // require input data from formOptions
  if (formOptions === undefined || formOptions.inputs === undefined) {
    console.warn("Cannot create a DynamicForm without formOptions");
    return false;
  }
  if (parent === undefined) {
    console.warn("Cannot create a DynamicForm without a structure to bind to");
    return false;
  }
  // FIXME if confic contains these, use that instead
  var add_icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAACyUlEQVR<KEY>';
  var remove_icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABqElEQVR42u1TO0sDQRD+NsFGBEubxNI/YC/YWPiKqNHK3ka0s/EXWWjjT9BCfDQiEhUshCghL9AYvdvdcfZmL3cGBUFSCHewzM3OzPfNaxUG/KmMICP4BwQ0NUMojgHG/iIH6rPRVz+bus/lgGqNCcrrhN0NoF5jn1zib32wDdmfg8nInfaSSKS1AvjhJB+ywptneXDGBPMlwtYSULkSVpdJFOz8AwF3ID1Ah6e5YkdmE1Jnd10w/K85qTxjXTxDBXOLNLS9DNxe82WeA5QAdN+ATkcqC5mo1eJgtjXrDAAhDY3IuJLQV2cQVfJ+14bqzC7Q8E6ZCW6AWpUB+TQaTNAV59D1yUjm2rcmAtI+GTYEMbAjIamO9dYDE7RLKzS6Ogkc7XMftfQvAiEB1pS0w3wDbDxw7BdaT8AzfnqBeiwUqbA5DZyeywyCUIar47LJA8dD9vpPwLHO6n3zFaoyMkITe2vA8YkbfdLPwA8yBo4AbAIcenCdaov2i+B0rXHZ1VCHvEjjvJ7GrWFqs9MbbvtkbKfevfK68oei19OOLIN+yRlBRvDn7xOEbDnnrmtLswAAAABJRU5ErkJggg==';

  // FIXME: add a way to use nested divs
  var tbody = parent.childElements('tbody')[0];
  var inputOpts = formOptions.inputs;


  var self = {
      add: function() {
        var newRow = tbody.insertRow(-1);
        addInputs(newRow);
        organizeForm();
      },
      remove: function(node) {
        if (tbody.children.length == 1) {
          return false;
        }
        tbody.removeChild(node);
        organizeForm();
        return true;
      }
    };

  // run that for each field actually..
  var addInputs = function(tableRow) {
    // iterate over configurated inputs
    for (var config in inputOpts) {
      var cell = tableRow.insertCell(-1);
      // FIXME: correct the behaviour..
      var input = document.createElement("INPUT");
      input.type = config.type;
      input.className = config.classname;
      input.name = config.nametemplate;

      cell.appendChild(input);
    }
{'fraction_non_alphanumeric': 0.09760087241003272, 'fraction_numerical': 0.02753544165757906, 'mean_word_length': 3.4580801944106927, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '3782516', 'n_tokens_mistral': 1386, 'n_tokens_neox': 1335, 'n_words': 247}