<commit_before>FactlinkJailRoot.showShouldSelectTextNotification = ->
  showNotification
    message: 'To create an annotation, select a statement and click the Factlink button.'
    type_classes: 'fl-message-icon-add'

FactlinkJailRoot.showLoadedNotification = ->
  showNotification
    message: 'Factlink is loaded!'
    type_classes: 'fl-message-icon-time fl-message-success'

in_screen_time = 3000
removal_delay = 350 # Should be larger than notification_transition_time
content = """
  <div class="fl-message">
    <div class="fl-message-icon"></div><span class="fl-message-content fl-js-message"></span>
  </div>
""".trim()

showNotification = (options) ->
  frame = null

  renderFrame = ->
    frame = new FactlinkJailRoot.ControlIframe()
    fillFrame()
    positionFrame()
    frame.$el.addClass 'factlink-control-visible'
    setTimeout(remove, in_screen_time)

  fillFrame = ->
    frame.setContent($.parseHTML(content)[0])
    $el = $(frame.doc.body.firstChild)
    $el.find('.fl-js-message').text(options.message)
    $el.addClass(options.type_classes)
    frame.resizeFrame()

  positionFrame = ->
    frame.$el.css
      top: '65px',
      left: '50%',
      position: 'fixed',
      marginLeft: "-#{frame.$el.width()/2}px"

  remove = ->
    frame.$el.removeClass 'factlink-control-visible'
    setTimeout (-> frame.destroy()), removal_delay

  renderFrame()
  return<commit_msg>Use new fadeIn/Out support in notifications too.<commit_after>FactlinkJailRoot.showShouldSelectTextNotification = ->
  showNotification
    message: 'To create an annotation, select a statement and click the Factlink button.'
    type_classes: 'fl-message-icon-add'

FactlinkJailRoot.showLoadedNotification = ->
  showNotification
    message: 'Factlink is loaded!'
    type_classes: 'fl-message-icon-time fl-message-success'

in_screen_time = 3000
content = """
  <div class="fl-message">
    <div class="fl-message-icon"></div><span class="fl-message-content fl-js-message"></span>
  </div>
""".trim()

showNotification = (options) ->
  frame = null

  renderFrame = ->
    frame = new FactlinkJailRoot.ControlIframe()
    fillFrame()
    positionFrame()
    doTransition()

  fillFrame = ->
    frame.setContent($.parseHTML(content)[0])
    $el = $(frame.doc.body.firstChild)
    $el.find('.fl-js-message').text(options.message)
    $el.addClass(options.type_classes)
    frame.resizeFrame()

  positionFrame = ->
    frame.$el.css
      top: '65px',
      left: '50%',
      position: 'fixed',
      marginLeft: "-#{frame.$el.width()/2}px"

  doTransition = ->
    frame
      .fadeIn()
      .then(-> FactlinkJailRoot.Timer(in_screen_time))
      .then(-> frame.fadeOut())
      .then(-> frame.destroy())

  renderFrame()
  return
{'fraction_non_alphanumeric': 0.14646649578908824, 'fraction_numerical': 0.008421823507872574, 'mean_word_length': 3.576214405360134, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 33, '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': '3519237', 'n_tokens_mistral': 886, 'n_tokens_neox': 855, 'n_words': 164}