<commit_before>########################################################
# AngularJS service to help with animations.
########################################################

angular.module('feedbunch').service 'animationsSvc',
['$rootScope',
($rootScope)->

  #--------------------------------------------
  # PRIVATE FUNCTION - Add a CSS class that sets identifies entry as open, for testing.
  # Also set explictly height to 'auto' (setting the CSS class alone does not override the explicitly set
  # height otherwise).
  # This way if images in the entry are lazy-loaded after the open animation is finished,
  # the entry height will adjust instantaneously.
  #--------------------------------------------
  add_open_class = ->
    $(this).addClass('entry_open').css 'height', 'auto'

  #--------------------------------------------
  # PRIVATE FUNCTION - Add a CSS class that sets entry height to 'auto'.
  # This way if images in the entry are lazy-loaded after the open animation is finished,
  # the entry height will adjust instantaneously.
  #--------------------------------------------
  remove_open_class = ->
    $(this).removeClass 'entry_open'

  service =

    #---------------------------------------------
    # Animate opening an entry, by transitioning its height from zero to its final value.
    #---------------------------------------------
    open_entry: (entry)->
      # Temporarily make entry content visible (height > 0) to measure its height
      $("#entry-#{entry.id}-summary").css('height', 'auto')
      height_auto = $("#entry-#{entry.id}-summary").outerHeight()
      # Set height back to 0px and animate the transition to its final height
      $("#entry-#{entry.id}-summary")
        .css('height', '0')
        .velocity {height: height_auto, 'padding-top': 15, 'padding-bottom': 15}, 300, 'swing', add_open_class

    #---------------------------------------------
    # Animate closing an entry, by transitioning its height from its current value to zero
    #---------------------------------------------
    close_entry: (entry)->
      $("#entry-#{entry.id}-summary")
        .velocity {height: 0, 'padding-top': 0, 'padding-bottom': 0}, 300, 'swing', remove_open_class

  return service
]<commit_msg>Animations with velocity.js use the single-object argument syntax, instead of three comma-separated arguments.<commit_after>########################################################
# AngularJS service to help with animations.
########################################################

angular.module('feedbunch').service 'animationsSvc',
['$rootScope',
($rootScope)->

  #--------------------------------------------
  # PRIVATE FUNCTION - Add a CSS class that sets identifies entry as open, for testing.
  # Also set explictly height to 'auto' (setting the CSS class alone does not override the explicitly set
  # height otherwise).
  # This way if images in the entry are lazy-loaded after the open animation is finished,
  # the entry height will adjust instantaneously.
  #--------------------------------------------
  add_open_class = ->
    $(this).addClass('entry_open').css 'height', 'auto'

  #--------------------------------------------
  # PRIVATE FUNCTION - Add a CSS class that sets entry height to 'auto'.
  # This way if images in the entry are lazy-loaded after the open animation is finished,
  # the entry height will adjust instantaneously.
  #--------------------------------------------
  remove_open_class = ->
    $(this).removeClass 'entry_open'

  service =

    #---------------------------------------------
    # Animate opening an entry, by transitioning its height from zero to its final value.
    #---------------------------------------------
    open_entry: (entry)->
      # Temporarily make entry content visible (height > 0) to measure its height
      $("#entry-#{entry.id}-summary").css('height', 'auto')
      height_auto = $("#entry-#{entry.id}-summary").outerHeight()
      # Set height back to 0px and animate the transition to its final height
      $("#entry-#{entry.id}-summary")
        .css('height', '0')
        .velocity properties: {height: height_auto, 'padding-top': 15, 'padding-bottom': 15},
          options: {duration: 300, easing: 'swing', complete: add_open_class}

    #---------------------------------------------
    # Animate closing an entry, by transitioning its height from its current value to zero
    #---------------------------------------------
    close_entry: (entry)->
      $("#entry-#{entry.id}-summary")
        .velocity properties: {height: 0, 'padding-top': 0, 'padding-bottom': 0},
          options: {duration: 300, easing: 'swing', complete: remove_open_class}

  return service
]
{'fraction_non_alphanumeric': 0.2923468306126775, 'fraction_numerical': 0.0067839728641085435, 'mean_word_length': 2.0108487555839183, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '5010580', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1093, 'n_words': 406}