Sha256: e2918e5d6d5a0875da9eb4c4e334564ffa4c6de483d9a049a9165cb644e66ddc

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

#
# Trigger 'edit' on editable elements when double-clicked.
# This is especially usefull, when the element is shown as hyperlink
# when not edited.
#
#jQuery ->
#
#  $( document ).on( "dblclick", ".editable", ->
#    $( this ).trigger( "click" )
#  )
##  $( ".editable a" ).off( "click" )
#
#  dblclicked = false
#  clicked = false
#  link = ""
#  $(".editable a").bind( "click", ->
#    console.log "click"
#    event.stopPropagation() # Otherwise this will trigger 'edit'.
#    event.preventDefault()
#    unless clicked
#      link = $( this ).attr( "href" )
#      setTimeout( ->
#        console.log "callback"
#        unless dblclicked
#          console.log "forward"
#          console.log link
#          document.location = link
#        dblclicked = false
#        clicked = false
#        link = ""
#      , 200 )
#    clicked = true
#
#
#  ).bind( "dblclick", (event)->
#    console.log "dblclick"
#    dblclicked = true
#  )
#  # unfortunately, this does not work:
#  #$( document ).on( "click", ".editable a", (event) ->
#  #  event.stopPropagation()
#  #)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
your_platform-1.0.1 app/assets/javascripts/your_platform/editable_dbl_click.js.coffee
your_platform-1.0.0 app/assets/javascripts/your_platform/editable_dbl_click.js.coffee
your_platform-0.0.2 app/assets/javascripts/your_platform/editable_dbl_click.js.coffee