 # Object which holds the methods that can be called from the factlink core iframe
+
+modalCloseTimeoutHandle = null
 
 FactlinkJailRoot.annotatedSiteReceiver =
   modalFrameReady: (featureToggles) ->

    window.FACTLINK_ON_CORE_LOAD?()

  openModalOverlay: ->
    $("#factlink-modal-frame").fadeIn 'fast'
    console.log 'fadeIn', $("#factlink-modal-frame")[0]
    FactlinkJailRoot.trigger 'modalOpened'

  highlightNewFactlink: (displaystring, id) ->

    FactlinkJailRoot.trigger 'factlinkAdded'

  closeModal_noAction: ->
    $("#factlink-modal-frame").removeClass 'factlink-frame-visible'
    modalCloseTimeoutHandle = setTimeout(-> FactlinkJailRoot.trigger 'modalClosed', 300)

  # For compatibility, please remove the next time you see this
  closeModal_highlightNewFactlink: (displaystring, id) ->
