 
     noop: -> # TODO required?
 
-Log.Scroll = ->
+Log.Scroll = (options) ->
+  options ||= {}
+  @beforeScroll = options.beforeScroll
+  this
 Log.Scroll.prototype = $.extend new Log.Listener,
   insert: (log, data, pos) ->
     @tryScroll() if @numbers


    createEngine: ->
      console.log 'log view: create engine' if Log.DEBUG
      @scroll = new Log.Scroll
      @engine = Log.create(limit: Log.LIMIT, listeners: [@scroll])
      @logFolder = new Travis.LogFolder(@$().find('#log'))
      @lineSelector = new Travis.LinesSelector(@$().find('#log'), @scroll, @logFolder)
      @observeParts()

    observeParts: ->
      parts = @get('log.parts')


  tryScroll: ->
    if element = $("#log p:visible.highlight:first")
      if @beforeScroll
        @beforeScroll()
      $('#main').scrollTop(0)
      $('html, body').scrollTop(element.offset()?.top - (window.innerHeight / 3)) # weird, html works in chrome, body in firefox

