       @$boundingBox = FactlinkJailRoot.drawBoundingBox contentBox, 'red'
 
 
-class ParagraphButton extends IconButton
+class ParagraphButton
   content: '<div class="fl-icon-button"><span class="icon-comment"></span>+</div>'
 
   constructor: (paragraphElement) ->

class IconButton
  destroy: =>
    $(window).off 'resize', @_updatePosition
    clearInterval @_interval
    @$boundingBox?.remove()

  # TODO: do all updates of different buttons in one pass
  _updatePositionRegularly: ->
    $(window).on 'resize', @_updatePosition
    @_interval = setInterval @_updatePosition, 1000
    @_updatePosition()


class FactlinkJailRoot.ShowButton extends IconButton
  content: '<div class="fl-icon-button"><span class="icon-comment"></span></div>'

  constructor: (highlightElements, factId) ->

    $el.on 'click', @_onClick

    @$paragraph = $(paragraphElement)
    @frame.fadeIn()
    FactlinkJailRoot.on 'updateIconButtons', @_update
    @_update()

  destroy: ->
    @$boundingBox?.remove()
    @_robustHover.destroy()
    @frame.destroy()
    FactlinkJailRoot.off 'updateIconButtons', @_update

  _update: =>
    @_updatePosition()
    @_destroyIfContainsFactlink()

  _destroyIfContainsFactlink: =>
    if @$paragraph.find('.factlink').length > 0
