{"size": 941, "ext": "js", "max_stars_repo_path": "assets/javascripts/cmis_attachment.js", "max_stars_repo_name": "fjudith/redmine_cmis", "max_stars_repo_stars_event_min_datetime": "2018-08-21T19:53:12.000Z", "max_stars_repo_stars_event_max_datetime": "2020-01-16T17:43:44.000Z", "max_issues_repo_path": "assets/javascripts/cmis_attachment.js", "max_issues_repo_name": "fjudith/redmine_cmis", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "assets/javascripts/cmis_attachment.js", "max_forks_repo_name": "fjudith/redmine_cmis", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.4324324324, "max_line_length": 107, "alphanum_fraction": 0.5993623804}

var fileFieldCount = 1;

function addFileField() {
  var fields = $('#attachments_fields');
  if (fields.children().length >= 10) return false;
  fileFieldCount++;
  var s = fields.children('span').first().clone();
  s.children('input.file').attr('name', "attachments[" + fileFieldCount + "][file]").val('');
  s.children('input.description').attr('name', "attachments[" + fileFieldCount + "][description]").val('');
  fields.append(s);
}

function removeFileField(el) {
  var fields = $('#attachments_fields');
  var s = $(el).parents('span').first();
  if (fields.children().length > 1) {
    s.remove();
  } else {
    s.children('input.file').val('');
    s.children('input.description').val('');
  }
}

function checkFileSize(el, maxSize, message) {
  var files = el.files;
  if (files) {
    for (var i=0; i<files.length; i++) {
      if (files[i].size > maxSize) {
        alert(message);
        el.value = "";
      }
    }
  }
}

