     @_attentionSpan.loseAttentionNow()
 
   destroy: ->
-    @_tether.destroy()
-    @_robustHover.destroy()
+    @_iconButton.destroy()
     @_attentionSpan.destroy()
     @_robustParagraphHover?.destroy()
-    @$el.remove()
     FactlinkJailRoot.off 'factlink.factsLoaded factlinkAdded', @_destroyUnlessValid
-    @$paragraph.off 'mousemove', @_showOnlyThisParagraphButton
     FactlinkJailRoot.off 'hideAllParagraphButtons', @_onHideAllParagraphButtons
 
   _destroyUnlessValid: =>

class FactlinkJailRoot.ShowButton
  constructor: (highlightElements, factId) ->
    @$el = $('<factlink-icon-button><factlink-bubble-icon><factlink-bubble-icon-triangle></factlink-bubble-icon-triangle></factlink-bubble-icon></factlink-icon-button>')
    FactlinkJailRoot.$factlinkCoreContainer.append(@$el)

    @$highlightElements = $(highlightElements)
    @_factId = factId

    @_robustHover = new FactlinkJailRoot.RobustHover
      $el: @$el
      mouseenter: @_onHover
      mouseleave: @_onUnhover
    @$el.on 'click', @_onClick

    @$el.addClass 'factlink-control-visible'

    # TODO: really do grouping, so we don't have to do hacks like this!
    textContainer = @_textContainer(@$highlightElements[0])
    verticalOffset = @$highlightElements.offset().top - $(textContainer).offset().top
    verticalOffsetPercentage = verticalOffset*100 / $(textContainer).height()

    @_tether = new Tether
      element: @$el[0]
      target: textContainer
      attachment: 'top left'
      targetAttachment: 'top right'
      classPrefix: 'factlink-tether'
      targetOffset: "#{verticalOffsetPercentage}% 0"

    @$el.css
      # 'color': $(textContainer).css('color')
      'line-height': $(textContainer).css('line-height')
      'font-size': Math.max 15, Math.min 20, parseInt $(textContainer).css('font-size')

  destroy: ->
    @_tether.destroy()
    @_robustHover.destroy()
    @$el.remove()

  _onHover: =>
    @$highlightElements.addClass 'fl-active'

    @$paragraph = $(paragraphElement)
    return unless @_valid()

    @_iconButton = new IconButton
      content: '+'
      targetElement: @$paragraph[0]
      mouseenter: => @_attentionSpan.gainAttention()
      mouseleave: => @_attentionSpan.loseAttention()
      click: @_onClick

    @_attentionSpan = new FactlinkJailRoot.AttentionSpan
      wait_for_neglection: 500
      onAttentionGained: => @_iconButton.fadeIn()
      onAttentionLost: => @_iconButton.fadeOut()

    FactlinkJailRoot.on 'factlink.factsLoaded factlinkAdded', @_destroyUnlessValid

    if FactlinkJailRoot.isTouchDevice()
      @_iconButton.fadeIn()
    else
      @_robustParagraphHover = new FactlinkJailRoot.RobustHover
        $el: @$paragraph
        mouseenter: @_showOnlyThisParagraphButton
        mouseleave: => @_attentionSpan.loseAttention()
      FactlinkJailRoot.on 'hideAllParagraphButtons', @_onHideAllParagraphButtons

