     config: false
     selector: false
 
-  constructor: (@config) ->
+  constructor: (@config, element = null) ->
     @element = null
 
     @config.offset ?= 100

    Common.installListener window, "keyup", @KeyUpHandler = (event) => @onKeyUp event
    Common.installListener window, "scroll", @scrollHandler = (event) => @onScroll event
    chrome.runtime.sendMessage name: "icon", show: @config.selectors?

  onKeyDown: (event) ->
    # console.clear()


    (event) ->
      cancel()
      unless @element and Common.isInViewport @element
        if element = @getElements("down")[0]
          timer = Common.setTimeout 200, =>
            timer = null
            unless @element and Common.isInViewport @element
              @selectElement element, false

init = ->
  chrome.runtime.sendMessage { name: "config", url: document.location.toString() }, (config) ->
