Hot keys? Nope! We're broiling chars. Charbroil takes an element, finds all links inside of it and tries to be smart about which character from the link to make into the hot key (or broiled char).
Also I make no effort to hide the fact that I ripped off a ton of stuff from Joel Oliveira's chaves.js. Mostly the jasmine tests, project skeleton and only 90% of this README. THX 2 U!
- Easy hot key making
- Control how the hot key looks via a css class
- Define explicit keys per link with data attributes
http://thedudewiththething.github.com/charbroil.js/
The dependencies are jQuery (of course) and Thomas Fuch's Keymaster. Make sure they're loaded before you get down to business.
<ul id="category_list">
<li><a href="#apples">apples</a></li>
<li><a href="#bananas">bananas</a></li>
<li><a href="#cherries">cherries</a></li>
<li><a href="#dates">dates</a></li>
<li><a href="#figs">figs</a></li>
<li><a href="#grapes">grapes</a></li>
<li><a href="#honeydew_melon">honeydew melon</a></li>
</ul>
<script src="/javascript/jquery-1.7.2.js"></script>
<script src="/javascript/keymaster.js"></script>
<script src="/javascript/jquery.charbroil.js"></script>
<script>
$('#category_list').charbroil();
</script>
I'm using Canary as my browser on a Mac for testing and I've set up the following alias for easy file loading / testing.
alias canary='/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --allow-file-access-from-files'
and then
canary SpecRunner.html
- Google, Github and VIM for inspiration
- Thomas Fuchs for his excellent work on keymaster.js
- jayroh for feedback.
- jquery-boilerplate for the .coffee jumpstart.
- 0.4.0 - got some docs now and improved performance with element caching and reduced number of loops
- 0.3.0 - adds ability to add charbroil-key attribute to a tag to override "smart" selecting. Selecting is smarter now too!
- 0.2.0 - I forget
- 0.1.0 - Initial push
- Even smarter selecting of broiled char.
Charbroil.js
- Dual licensed under the MIT and GPL licenses.
- Copyright (c) 2012 Shaun Butler
- https://github.com/TheDudeWithTheThing/charbroil.js
keymaster
- Freely distributable and licensed under the MIT license.
- Copyright (c) 2011 Thomas Fuchs
- https://github.com/madrobby/keymaster