<commit_before>document.addEventListener 'turbolinks:load', ->
  $('select').select2
    theme: 'bootstrap'
    containerCssClass: ':all:'
  hljs.initHighlightingOnLoad();
  $('#categories-list li:first').addClass("active")
  filterSchemas($('#categories-list li:first a').attr("data-category"))
  $(".instance-panel.schema-detail").sticky({topSpacing: 0, zIndex: 99});

$(document).on 'click', '#categories-list li a', (e) ->
  e.preventDefault()
  $parent = $(this).parent()
  filterSchemas($(this).data('category'))
  addClassToList($parent)

$(document).on 'fileselect', ':file', (event, numFiles, label) ->
  input = $(this).parents('.input-group').find(':text')
  log = if numFiles > 1 then numFiles + ' files selected' else label
  if input.length
    input.val log
    $('#input-file, #remove-file').show()
    $('#label-file').hide()
    return

$(document).on 'change', ':file', ->
  input = $(this)
  numFiles = if input.get(0).files then input.get(0).files.length else 1
  label = input.val().replace(/\\/g, '/').replace(/.*\//, '')
  input.trigger 'fileselect', [
    numFiles
    label
  ]
  return

$(document).on 'click', '#remove-file', ->
  $('#input-file, #remove-file').hide()
  $('#label-file').show()
  $("#input-file").val ""

this.filterSchemas = filterSchemas = (category) ->
  dataCategory = '[data-categories="' + category + '"]'
  $('.box-schema.filtered').hide().filter(dataCategory).css("display","inline-block")
  return

addClassToList = (element) ->
  $('#categories-list li').removeClass()
  if !element.hasClass('active')
    element.addClass('active');
    return
<commit_msg>Fix behavior of deletion on file-input<commit_after>document.addEventListener 'turbolinks:load', ->
  $('select').select2
    theme: 'bootstrap'
    containerCssClass: ':all:'
  hljs.initHighlightingOnLoad();
  $('#categories-list li:first').addClass("active")
  filterSchemas($('#categories-list li:first a').attr("data-category"))
  $(".instance-panel.schema-detail").sticky({topSpacing: 0, zIndex: 99});

$(document).on 'click', '#categories-list li a', (e) ->
  e.preventDefault()
  $parent = $(this).parent()
  filterSchemas($(this).data('category'))
  addClassToList($parent)

$(document).on 'fileselect', ':file', (event, numFiles, label) ->
  input = $(this).parents('.input-group').find(':text')
  log = if numFiles > 1 then numFiles + ' files selected' else label
  if input.length
    input.val log
    $('#input-file, #remove-file').show()
    $('#label-file').hide()
    return

$(document).on 'change', ':file', ->
  input = $(this) 
  numFiles = if input.get(0).files then input.get(0).files.length else 1
  label = input.val().replace(/\\/g, '/').replace(/.*\//, '')
  input.trigger 'fileselect', [
    numFiles
    label
  ]
  return

$(document).on 'click', '#remove-file', ->
  $('#input-file, #remove-file').hide()
  $('#label-file').show()
  $("#input-file, #schema_spec_file").val ""


this.filterSchemas = filterSchemas = (category) ->
  dataCategory = '[data-categories="' + category + '"]'
  $('.box-schema.filtered').hide().filter(dataCategory).css("display","inline-block")
  return

addClassToList = (element) ->
  $('#categories-list li').removeClass()
  if !element.hasClass('active')
    element.addClass('active');
    return

{'fraction_non_alphanumeric': 0.21865443425076453, 'fraction_numerical': 0.004892966360856269, 'mean_word_length': 4.344771241830065, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '3382618', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1054, 'n_words': 200}