<commit_before>class DomView extends Backbone.View
  el: 'body'

  events:
    'ajax:complete'                 : 'ajaxComplete'
    'mouseover .product-widget'     : 'widgetMouseover'
    'mouseout .product-widget'      : 'widgetMousetout'

  # widgetMouseout - handle when a user mouses over a product widget.
  widgetMouseover: (ev) ->
    $(ev.currentTarget).find('.overlay').removeClass 'hide'

  # widgetMouseout - handle when a user mouses out from a product widget.
  widgetMouseout: (ev) ->
    $(ev.currentTarget).find('.overlay').addClass 'hide'

  # ajaxComplete - figure out what the ajax was for, and execute it.
  ajaxComplete: (xhr, status) =>
    if status.getResponseHeader('Ajax-Type') == 'flash'
      @ajaxFlash(xhr, status)
    else if status.getResponseHeader('Ajax-Type') == 'popup'
      @ajaxPopup(xhr, status)

  # ajaxFlash - when an ajax request is complete, if it is for a flash, show it.
  ajaxFlash: (xhr, status) =>
    $flash = $ '.flash'

    if status.getResponseHeader('Flash-Message-Type') == 'success'
      $flash.removeClass 'error'
      $flash.addClass 'success'
      @delay 1500, ->
        @resetReveal()
    else
      $flash.removeClass 'success'
      $flash.addClass 'error'

    $flash.text status.getResponseHeader('Flash-Message')<commit_msg>code style tweaks<commit_after>class DomView extends Backbone.View
  el: 'body'

  events:
    'mouseover .product-widget'     : 'widgetMouseover'
    'mouseout .product-widget'      : 'widgetMousetout'
    'ajax:complete'                 : 'ajaxComplete'

  # widgetMouseout - handle when a user mouses over a product widget.
  widgetMouseover: (ev) ->
    $(ev.currentTarget).find('.overlay').removeClass 'hide'

  # widgetMouseout - handle when a user mouses out from a product widget.
  widgetMouseout: (ev) ->
    $(ev.currentTarget).find('.overlay').addClass 'hide'

  # ajaxComplete - figure out what the ajax was for, and execute it.
  ajaxComplete: (xhr, status) =>
    if status.getResponseHeader('Ajax-Type') == 'flash'
      @ajaxFlash(xhr, status)
    else if status.getResponseHeader('Ajax-Type') == 'popup'
      @ajaxPopup(xhr, status)

  # ajaxFlash - when an ajax request is complete, if it is for a flash, show it.
  ajaxFlash: (xhr, status) =>
    $flash = $ '.flash'

    if status.getResponseHeader('Flash-Message-Type') == 'success'
      $flash.removeClass 'error'
      $flash.addClass 'success'
      @delay 1500, ->
        @resetReveal()
    else
      $flash.removeClass 'success'
      $flash.addClass 'error'

    $flash.text status.getResponseHeader('Flash-Message')
{'fraction_non_alphanumeric': 0.12885802469135801, 'fraction_numerical': 0.0030864197530864196, 'mean_word_length': 3.1488, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '4874484', 'n_tokens_mistral': 822, 'n_tokens_neox': 785, 'n_words': 213}