mousetrapjs 0.0.8 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +0 -0
- data/Gemfile +0 -0
- data/LICENSE +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/lib/mousetrapjs/version.rb +1 -1
- data/lib/mousetrapjs.rb +0 -0
- data/mousetrapjs.gemspec +0 -0
- data/vendor/assets/javascripts/mousetrap.js +16 -12
- metadata +3 -3
data/.gitignore
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/LICENSE
CHANGED
File without changes
|
data/README.md
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/lib/mousetrapjs/version.rb
CHANGED
data/lib/mousetrapjs.rb
CHANGED
File without changes
|
data/mousetrapjs.gemspec
CHANGED
File without changes
|
@@ -16,7 +16,7 @@
|
|
16
16
|
* Mousetrap is a simple keyboard shortcut library for Javascript with
|
17
17
|
* no external dependencies
|
18
18
|
*
|
19
|
-
* @version 1.1.
|
19
|
+
* @version 1.1.3
|
20
20
|
* @url craig.is/killing/mice
|
21
21
|
*/
|
22
22
|
(function() {
|
@@ -298,15 +298,16 @@
|
|
298
298
|
*
|
299
299
|
* @param {string} character
|
300
300
|
* @param {Array} modifiers
|
301
|
-
* @param {
|
301
|
+
* @param {Event|Object} e
|
302
302
|
* @param {boolean=} remove - should we remove any matches
|
303
303
|
* @param {string=} combination
|
304
304
|
* @returns {Array}
|
305
305
|
*/
|
306
|
-
function _getMatches(character, modifiers,
|
306
|
+
function _getMatches(character, modifiers, e, remove, combination) {
|
307
307
|
var i,
|
308
308
|
callback,
|
309
|
-
matches = []
|
309
|
+
matches = [],
|
310
|
+
action = e.type;
|
310
311
|
|
311
312
|
// if there are no events related to this keycode
|
312
313
|
if (!_callbacks[character]) {
|
@@ -335,10 +336,14 @@
|
|
335
336
|
continue;
|
336
337
|
}
|
337
338
|
|
338
|
-
// if this is a keypress event
|
339
|
-
//
|
340
|
-
// well
|
341
|
-
|
339
|
+
// if this is a keypress event and the meta key and control key
|
340
|
+
// are not pressed that means that we need to only look at the
|
341
|
+
// character, otherwise check the modifiers as well
|
342
|
+
//
|
343
|
+
// chrome will not fire a keypress if meta or control is down
|
344
|
+
// safari will fire a keypress if meta or meta+shift is down
|
345
|
+
// firefox will fire a keypress if meta or control is down
|
346
|
+
if ((action == 'keypress' && !e.metaKey && !e.ctrlKey) || _modifiersMatch(modifiers, callback.modifiers)) {
|
342
347
|
|
343
348
|
// remove is used so if you change your mind and call bind a
|
344
349
|
// second time with a new function the first one is overwritten
|
@@ -420,7 +425,7 @@
|
|
420
425
|
return;
|
421
426
|
}
|
422
427
|
|
423
|
-
var callbacks = _getMatches(character, _eventModifiers(e), e
|
428
|
+
var callbacks = _getMatches(character, _eventModifiers(e), e),
|
424
429
|
i,
|
425
430
|
do_not_reset = {},
|
426
431
|
processed_sequence_callback = false;
|
@@ -685,7 +690,7 @@
|
|
685
690
|
}
|
686
691
|
|
687
692
|
// remove an existing match if there is one
|
688
|
-
_getMatches(key, modifiers, action, !sequence_name, combination);
|
693
|
+
_getMatches(key, modifiers, {type: action}, !sequence_name, combination);
|
689
694
|
|
690
695
|
// add this call back to the array
|
691
696
|
// if it is a sequence put it at the beginning
|
@@ -728,8 +733,7 @@
|
|
728
733
|
* binds an event to mousetrap
|
729
734
|
*
|
730
735
|
* can be a single key, a combination of keys separated with +,
|
731
|
-
*
|
732
|
-
* a sequence of keys separated by spaces
|
736
|
+
* an array of keys, or a sequence of keys separated by spaces
|
733
737
|
*
|
734
738
|
* be sure to list the modifier keys first to make sure that the
|
735
739
|
* correct key ends up getting bound (the last key in the pattern)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mousetrapjs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-01 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Gem for Mousetrap, a simple library for handling keyboard shortcuts in
|
15
15
|
Javascript
|
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
48
|
version: '0'
|
49
49
|
requirements: []
|
50
50
|
rubyforge_project:
|
51
|
-
rubygems_version: 1.8.
|
51
|
+
rubygems_version: 1.8.24
|
52
52
|
signing_key:
|
53
53
|
specification_version: 3
|
54
54
|
summary: Mousetrap is a simple library for handling keyboard shortcuts in Javascript
|