0
+Plugin to add easy support for javascript hotkeys to a Rails application.
0
+The hotkey.js file should be copied to public/javascripts upon plugin installation. If it's not been installed, run the available rake task to update:
0
+The hotkey.js file is automatically added to the javascript include defaults, so if you're using javascript_include_tag(:defaults), inclusion of the necessary javascript will be handled automatically. If you're not using :defaults, you can include the necessary JavaScript manually using javascript_include_tag('hotkey'). Please note that Prototype is a dependency.
0
+IMPORTANT: To activate hotkeys for a given layout, you must add the following to the _body_ tag:
0
+ onkeydown="Hotkey.process(event)"
0
+Note: You could also attach Hotkey.process in an onload handler unobtrusively. I'd recommend you do this if you have the javascript chops.
0
+While it's recommended that your hotkey definitions are made in a .js vs directly in a view whenever possible, the plugin includes a number of helpers to help you define hotkeys dynamically from Ruby.
0
+Please note that the all hotkeys defined require the pressing of a modifier key as well; due to the spotty nature of javascript character code handling, the modifier key that it is bound may differ from platform-to-platform and browser-to-browser.
0
+Note: If you'd like to define hotkeys directly in your javascript files, look at the provided helpers for examples of how to use Hotkey.add in the javascript API. The
0
+Use hotkey_to_function similar to how you'd use link_to_function (without html options, obviously):
0
+ <%= hotkey_to_function(:h, "$('help-sidebar').show();") %>
0
+This will bind 'h' (with a modifier key)
0
+=== Binding a remote function (AJAX)
0
+Use hotkey_to_remote similar to how you'd use link_to_remote (without html options, obviously)
0
+ <%= hotkey_to_remote(:s, :url => {:controller=>'foo', :action => 'bar'})
0
+This will bind 's' (with a modifier key)
0
+Copyright (c) 2006 - 2008 Bruce Williams (http://codefluency.com)
0
+Permission is hereby granted, free of charge, to any person obtaining
0
+a copy of this software and associated documentation files (the
0
+'Software'), to deal in the Software without restriction, including
0
+without limitation the rights to use, copy, modify, merge, publish,
0
+distribute, sub-license, and/or sell copies of the Software, and to
0
+permit persons to whom the Software is furnished to do so, subject to
0
+the following conditions:
0
+The above copyright notice and this permission notice shall be
0
+included in all copies or substantial portions of the Software.
0
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
0
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
0
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
0
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
0
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
0
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Comments
No one has commented yet.