Sha256: 8f1b1a06fa00f1cd2e2a687166d76a8a9e248c2b7d2a551a3af54bb9e2bf6bab

Contents?: true

Size: 519 Bytes

Versions: 2

Compression:

Stored size: 519 Bytes

Contents

$ ->
  # Hotkey binding to links with 'data-keybindings' attribute
  # Navigate link when hotkey pressed
  $('a[data-keybinding]').each (i, el) ->
    Mousetrap.bind $(el).data('keybinding'), (e) -> el.click()

  # Hotkey binding to inputs with 'data-keybindings' attribute
  # Focus input when hotkey pressed
  $('input[data-keybinding]').each (i, el) ->
    Mousetrap.bind $(el).data('keybinding'), (e) ->
      el.focus()
      if e.preventDefault
        e.preventDefault()
      else
        e.returnValue = false

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mousetrap-rails-0.0.3 lib/generators/mousetrap/install/templates/keybindings.js.coffee
mousetrap-rails-0.0.2 lib/generators/mousetrap/install/templates/keybindings.js.coffee