<commit_before>define [
  'jquery'
  'marionette'
  'aloha'
  'hbs!templates/workspace/menu/toolbar-aloha'
  'hbs!templates/workspace/menu/toolbar-popover'
], ($, Marionette, Aloha, toolbarTemplate, toolbarPopover) ->

  return new class ToolbarAlohaView extends Marionette.ItemView
    template: toolbarTemplate
    tagName: 'span'

    onRender: ->
      # If someone clicks the heading button, don't reload the page
      @$el.find('.btn.currentHeading').on 'click', (e) -> e.preventDefault()

      # If any action is marked with data-content, add a popover to it to
      # aid discoverability. If a flash-action event is received for this
      # action, generated by the toolbar when a plugin requests that the user's
      # attention be drawn to a button, show the popover. But only do it once.
      @$el.find('.action[data-content]')
      .popover(
        placement: 'bottom',
        trigger: 'manual'
        html: true
        template: toolbarPopover({})
        container: '#menu-and-content')
      .on 'shown', (e1) ->
        $(e1.target).data('popover').$tip.find('.close').off('click').on 'click', (e2) ->
          e2.preventDefault()<commit_msg>Reword the comment about what this does.<commit_after>define [
  'jquery'
  'marionette'
  'aloha'
  'hbs!templates/workspace/menu/toolbar-aloha'
  'hbs!templates/workspace/menu/toolbar-popover'
], ($, Marionette, Aloha, toolbarTemplate, toolbarPopover) ->

  return new class ToolbarAlohaView extends Marionette.ItemView
    template: toolbarTemplate
    tagName: 'span'

    onRender: ->
      # If someone clicks the heading button, don't reload the page
      @$el.find('.btn.currentHeading').on 'click', (e) -> e.preventDefault()

      # This will attach a popover to any button in the toolbar that has a
      # data-content attribute. This essentially defers what buttons
      # have a popover to the toolbar template itself. It allows the design of
      # a UI that can occasionally point to a button and tell the user what it
      # does, that is, it aids in discoverability. This uses the new `flash`
      # feature in the aloha toolbar. Whenever a plugin asks the toolbar to
      # flash a button, we catch that event and show the popover. We only show
      # the popover on the first flash event. Finally, we also glue a handler
      # to the .close element inside that popover, because bootstrap does not
      # handle this natively.

      @$el.find('.action[data-content]')
      .popover(
        placement: 'bottom',
        trigger: 'manual'
        html: true
        template: toolbarPopover({})
        container: '#menu-and-content')
      .on 'shown', (e1) ->
        $(e1.target).data('popover').$tip.find('.close').off('click').on 'click', (e2) ->
          e2.preventDefault()
{'fraction_non_alphanumeric': 0.11506652283351312, 'fraction_numerical': 0.002876663070837828, 'mean_word_length': 2.9405099150141645, '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': '365196', 'n_tokens_mistral': 843, 'n_tokens_neox': 798, 'n_words': 276}