   onClickMenuItem: (params)->
     ()=> window.location.hash = '#/?' + @queryParam(params)
 
+  onTouchStartTools: (event)->
+    event.stopPropagation()
+
   render: ->
     clearInterval @interval if @interval
     if @props.cards.query.auto != 'off'

window.onerror = (error, url, line) -> alert error

Flash = React.createClass
  componentDidMount: ->
    console.log '[views/flash] componentDidMount', @props
    $(document).on 'keydown', @onKeyDown
    #for eventName in ['touchstart', 'touchmove', 'touchend', 'gesturestart', 'gesturechange', 'gestureend']
    #  $(document).on eventName, (event)-> event.preventDefault(); event.stopPropagation()

    @setState currCards: @props.cards


  componentWillUnmount: ->
    console.log '[views/flash] FlashMain componentWillUnmount'
    $(document).off 'keydown', @onKeyDown
    for eventName in @scrollEventNames
      $(document).off eventName, @preventScroll

  onKeyDown: (event)->
    switch event.keyCode
      when 27 then @props.router.navigate(@closeLink())
      when 37 then @onClickPrev()
      when 39 then @onClickNext()

  preventScroll: (event)->
    tagName = event.target.tagName.toLowerCase()
    return if tagName == 'button' || tagName == 'a'
    event.preventDefault()

  getInitialState: ->
    currCard: null
