<commit_before>#= require jquery.mousewheel

preventScroll = (event, delta) ->
  $el = $(event.delegateTarget)

  # Scrolling upward but cannot scroll any further
  return true if delta > 0 && $el.scrollTop() <= 0

  # Scrolling downward but cannot scroll any further
  return true if delta < 0 && $el.scrollTop() >= $el[0].scrollHeight - $el.innerHeight()

  false

$.fn.preventScrollPropagation = ->
  @each ->
    $(this).on 'mousewheel', (event, delta) ->
      event.stopPropagation() # allow nesting of scrollable containers

      event.preventDefault() if preventScroll(event, delta)<commit_msg>Don't handle scrolling when there is deliberately no scrollbar<commit_after>#= require jquery.mousewheel

shouldHandleScrolling = (event) ->
  $el = $(event.delegateTarget)

  # There isn't anything to scroll, and we only show a scrollbar when there is
  return false if $el[0].scrollHeight <= $el.innerHeight() && $el.css('overflow-y') == 'auto'

  true

preventScroll = (event, delta) ->
  $el = $(event.delegateTarget)

  # Scrolling upward but cannot scroll any further
  return true if delta > 0 && $el.scrollTop() <= 0

  # Scrolling downward but cannot scroll any further
  return true if delta < 0 && $el.scrollTop() >= $el[0].scrollHeight - $el.innerHeight()

  false

$.fn.preventScrollPropagation = ->
  @each ->
    $(this).on 'mousewheel', (event, delta) ->
      return unless shouldHandleScrolling(event)

      event.stopPropagation() # allow nesting of scrollable containers
      event.preventDefault() if preventScroll(event, delta)
{'fraction_non_alphanumeric': 0.12612612612612611, 'fraction_numerical': 0.005791505791505791, 'mean_word_length': 3.983974358974359, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 16, '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': '4044128', 'n_tokens_mistral': 465, 'n_tokens_neox': 444, 'n_words': 148}