Skip to content

Commit

Permalink
V1.1: remove preminified version and ender support
Browse files Browse the repository at this point in the history
  • Loading branch information
madrobby committed Nov 20, 2013
1 parent a2b06f5 commit e3d2035
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
keymaster.min.js
2 changes: 1 addition & 1 deletion MIT-LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2011-2012 Thomas Fuchs
Copyright (c) 2011-2013 Thomas Fuchs

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# To run this, you'll need to install UglifyJS:
# npm install uglify-js@1 -g
default:
uglifyjs -o keymaster.min.js keymaster.js
29 changes: 14 additions & 15 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ it in.*

## Usage

Include `keymaster.min.js` in your web app, by loading it as usual:
Include `keymaster.js` in your web app*, by loading it as usual:

```html
<script src="keymaster.min.js"></script>
<script src="keymaster.js"></script>
```

Keymaster has no dependencies and can be used completely standalone.
It should not interfere with any JavaScript libraries or frameworks.

_*Preferably use a minified version that fits your workflow. You can
run `make` to have UglifyJS (if you have it installed) create a
`keymaster.min.js` file for you._

## Defining shortcuts

One global method is exposed, `key` which defines shortcuts when
Expand Down Expand Up @@ -50,6 +54,7 @@ key('⌘+r, ctrl+r', function(event, handler){
// "ctrl+r", "all"
```


## Supported keys

Keymaster understands the following modifiers:
Expand All @@ -60,6 +65,7 @@ The following special keys can be used for shortcuts:
`up`, `down`, `left`, `right`, `home`, `end`, `pageup`, `pagedown`, `del`, `delete`
and `f1` through `f19`.


## Modifier key queries

At any point in time (even in code other than key shortcut handlers),
Expand All @@ -71,6 +77,7 @@ allows easy implementation of things like shift+click handlers. For example,
if(key.shift) alert('shift is pressed, OMGZ!');
```


## Other key queries

At any point in time (even in code other than key shortcut handlers),
Expand Down Expand Up @@ -103,6 +110,7 @@ key('o, enter', 'files', function(){ /* do something else */ });
key.setScope('issues'); // default scope is 'all'
```


## Filter key presses

By default, when an `INPUT`, `SELECT` or `TEXTAREA` element is focused, Keymaster doesn't process any shortcuts.
Expand Down Expand Up @@ -136,6 +144,7 @@ key.filter = function(event){
However a more robust way to handle this is to use proper
focus and blur event handlers on your input element, and change scopes there as you see fit.


## noConflict mode

You can call ```key.noConflict``` to remove the ```key``` function from global scope and restore whatever ```key``` was defined to before Keymaster was loaded. Calling ```key.noConflict``` will return the Keymaster ```key``` function.
Expand All @@ -148,6 +157,7 @@ key()
// --> TypeError: 'undefined' is not a function
```


## Unbinding shortcuts

Similar to defining shortcuts, they can be unbound using `key.unbind`.
Expand All @@ -162,13 +172,15 @@ key.unbind('o, enter', 'issues');
key.unbind('o, enter', 'files');
```


## Notes

Keymaster should work with any browser that fires `keyup` and `keydown` events,
and is tested with IE (6+), Safari, Firefox and Chrome.

See [http://madrobby.github.com/keymaster/](http://madrobby.github.com/keymaster/) for a live demo.


## CoffeeScript

If you're using CoffeeScript, configuring key shortcuts couldn't be simpler:
Expand All @@ -186,19 +198,6 @@ key 'o, enter', 'issues', ->
alert 'shift is pressed, OMGZ!' if key.shift
```

## Ender support

Add `keymaster` as a top level method to your [Ender](http://ender.no.de) compilation.

$ ender add keymaster

Use it:

``` js
$.key('⌘+r', function () {
alert('reload!')
})
```

## Contributing

Expand Down
5 changes: 0 additions & 5 deletions ender.js

This file was deleted.

2 changes: 1 addition & 1 deletion keymaster.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// keymaster.js
// (c) 2011-2012 Thomas Fuchs
// (c) 2011-2013 Thomas Fuchs
// keymaster.js may be freely distributed under the MIT license.

;(function(global){
Expand Down
4 changes: 0 additions & 4 deletions keymaster.min.js

This file was deleted.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"name": "keymaster",
"description": "library for defining and dispatching keyboard shortcuts",
"version": "1.0.2",
"author": "Thomas Fuchs <> (http://mir.aculo.us)",
"version": "1.1",
"author": "Thomas Fuchs <thomas@slash7.com> (http://mir.aculo.us)",
"repository": {
"type": "git",
"url": "https://github.com/madrobby/keymaster"
},
"main": "./keymaster.js",
"ender": "./ender.js"
}

0 comments on commit e3d2035

Please sign in to comment.