Sha256: 8d21d9aab03b00cd11f14140edab4251ad73e12ecf0e24c020e96ab704e2cce8

Contents?: true

Size: 902 Bytes

Versions: 16

Compression:

Stored size: 902 Bytes

Contents

window.Alchemy = {} if typeof(window.Alchemy) is 'undefined'

# Handles Alchemy hotkeys
#
Alchemy.Hotkeys = (scope) ->
  $search_fields = $('#search_field, #search_input_field', scope)
  $search_fields_clear = $('.search_field_clear, .js_filter_field_clear', scope)

  # Binds keyboard shortcuts to searchfields
  keymage 'alt-f',
    ->
      $search_fields.focus()
      keymage.setScope('search')
    ,
    preventDefault: true
  keymage 'search', 'esc', ->
    $search_fields_clear.click()
    $search_fields.blur()

  # Binds click events to hotkeys
  #
  # Simply add a data-alchemy-hotkey attribute to your link.
  # If a hotkey is triggered by user, the click event of the element gets triggerd.
  #
  $('[data-alchemy-hotkey]', scope).each ->
    $this = $(this)
    keymage $this.data('alchemy-hotkey'), ->
      $this.click()

  keymage 'alt-w', ->
    Alchemy.CurrentWindow.dialog('close')

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
alchemy_cms-2.9.1 app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee
alchemy_cms-2.9.0 app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee
alchemy_cms-2.8.3 app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee
alchemy_cms-2.7.5 app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee
alchemy_cms-2.6.3 app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee
alchemy_cms-2.7.4 app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee
alchemy_cms-2.8.2 app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee
alchemy_cms-2.8.1 app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee
alchemy_cms-2.7.3 app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee
alchemy_cms-2.7.2 app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee
alchemy_cms-2.7.1 app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee
alchemy_cms-2.7.0 app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee
alchemy_cms-2.6.2.1 app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee
alchemy_cms-2.6.2 app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee
alchemy_cms-2.6.1 app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee
alchemy_cms-2.6.0 app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee