<commit_before>#  Custom unobtrusiveness helpers

$.unobtrusive = (callback) ->
  $(document).bind('activate-unobtrusive-javascript', (event, root) ->
    $(root).each(callback)
  )

$.fn.activateUnobtrusiveJavascript = () ->
  return this.each(() ->
    $(document).trigger('activate-unobtrusive-javascript', this)
  )

$(document).ready () ->
  $(document).activateUnobtrusiveJavascript()


# Fixes Bootstrap dropdownmenus on iOS

$.unobtrusive () ->
  $('.dropdown-menu').on('touchstart.dropdown.data-api', (e) ->
    e.stopPropagation()
  )

  $('a.dropdown-toggle, .dropdown-menu a').on('touchstart', (e) ->
    e.stopPropagation()
  )


# Fixes data-dismiss

$.unobtrusive () ->
  $('[data-dismiss]').on 'click', () ->
    selector = '.' + $(this).data('dismiss')
    $(this).closest(selector).fadeOut('fast')
<commit_msg>Fixes data-dismiss behaviour (remove, don't just hide)<commit_after>#  Custom unobtrusiveness helpers

$.unobtrusive = (callback) ->
  $(document).bind('activate-unobtrusive-javascript', (event, root) ->
    $(root).each(callback)
  )

$.fn.activateUnobtrusiveJavascript = () ->
  return this.each(() ->
    $(document).trigger('activate-unobtrusive-javascript', this)
  )

$(document).ready () ->
  $(document).activateUnobtrusiveJavascript()


# Fixes Bootstrap dropdownmenus on iOS

$.unobtrusive () ->
  $('.dropdown-menu').on('touchstart.dropdown.data-api', (e) ->
    e.stopPropagation()
  )

  $('a.dropdown-toggle, .dropdown-menu a').on('touchstart', (e) ->
    e.stopPropagation()
  )


# Fixes data-dismiss

$.unobtrusive () ->
  $('[data-dismiss]').on 'click', () ->
    selector = '.' + $(this).data('dismiss')
    target = $(this).closest(selector)
    target.fadeOut 'fast', () ->
      $(this).remove()

{'fraction_non_alphanumeric': 0.20790378006872853, 'fraction_numerical': 0.0, 'mean_word_length': 3.8935574229691876, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 24, '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': '5444889', 'n_tokens_mistral': 617, 'n_tokens_neox': 595, 'n_words': 88}