mousetrap-rails 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +6 -0
- data/lib/mousetrap-rails/version.rb +1 -1
- data/vendor/assets/javascripts/mousetrap.js +14 -14
- metadata +4 -4
data/CHANGELOG.md
CHANGED
@@ -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.
|
19
|
+
* @version 1.2
|
20
20
|
* @url craig.is/killing/mice
|
21
21
|
*/
|
22
22
|
(function() {
|
@@ -378,8 +378,14 @@
|
|
378
378
|
* @param {Event} e
|
379
379
|
* @returns void
|
380
380
|
*/
|
381
|
-
function _fireCallback(callback, e) {
|
382
|
-
|
381
|
+
function _fireCallback(callback, e, combo) {
|
382
|
+
|
383
|
+
// if this event should not happen stop here
|
384
|
+
if (Mousetrap.stopCallback(e, e.target || e.srcElement, combo)) {
|
385
|
+
return;
|
386
|
+
}
|
387
|
+
|
388
|
+
if (callback(e, combo) === false) {
|
383
389
|
if (e.preventDefault) {
|
384
390
|
e.preventDefault();
|
385
391
|
}
|
@@ -401,12 +407,6 @@
|
|
401
407
|
* @returns void
|
402
408
|
*/
|
403
409
|
function _handleCharacter(character, e) {
|
404
|
-
|
405
|
-
// if this event should not happen stop here
|
406
|
-
if (Mousetrap.stopCallback(e, e.target || e.srcElement)) {
|
407
|
-
return;
|
408
|
-
}
|
409
|
-
|
410
410
|
var callbacks = _getMatches(character, _eventModifiers(e), e),
|
411
411
|
i,
|
412
412
|
do_not_reset = {},
|
@@ -425,14 +425,14 @@
|
|
425
425
|
|
426
426
|
// keep a list of which sequences were matches for later
|
427
427
|
do_not_reset[callbacks[i].seq] = 1;
|
428
|
-
_fireCallback(callbacks[i].callback, e);
|
428
|
+
_fireCallback(callbacks[i].callback, e, callbacks[i].combo);
|
429
429
|
continue;
|
430
430
|
}
|
431
431
|
|
432
432
|
// if there were no sequence matches but we are still here
|
433
433
|
// that means this is a regular match so we should fire that
|
434
434
|
if (!processed_sequence_callback && !_inside_sequence) {
|
435
|
-
_fireCallback(callbacks[i].callback, e);
|
435
|
+
_fireCallback(callbacks[i].callback, e, callbacks[i].combo);
|
436
436
|
}
|
437
437
|
}
|
438
438
|
|
@@ -587,7 +587,7 @@
|
|
587
587
|
* @returns void
|
588
588
|
*/
|
589
589
|
_callbackAndReset = function(e) {
|
590
|
-
_fireCallback(callback, e);
|
590
|
+
_fireCallback(callback, e, combo);
|
591
591
|
|
592
592
|
// we should ignore the next key up if the action is key down
|
593
593
|
// or keypress. this is so if you finish a sequence and
|
@@ -791,7 +791,7 @@
|
|
791
791
|
* @param {Element} element
|
792
792
|
* @return {boolean}
|
793
793
|
*/
|
794
|
-
stopCallback: function(e, element) {
|
794
|
+
stopCallback: function(e, element, combo) {
|
795
795
|
|
796
796
|
// if the element has the class "mousetrap" then no need to stop
|
797
797
|
if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) {
|
@@ -807,7 +807,7 @@
|
|
807
807
|
window.Mousetrap = Mousetrap;
|
808
808
|
|
809
809
|
// expose mousetrap as an AMD module
|
810
|
-
if (typeof define
|
810
|
+
if (typeof define === 'function' && define.amd) {
|
811
811
|
define('mousetrap', function() { return Mousetrap; });
|
812
812
|
}
|
813
813
|
}) ();
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mousetrap-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
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-10-
|
12
|
+
date: 2012-10-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -175,7 +175,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
175
175
|
version: '0'
|
176
176
|
segments:
|
177
177
|
- 0
|
178
|
-
hash:
|
178
|
+
hash: 1619050546139319244
|
179
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
180
|
none: false
|
181
181
|
requirements:
|
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
184
|
version: '0'
|
185
185
|
segments:
|
186
186
|
- 0
|
187
|
-
hash:
|
187
|
+
hash: 1619050546139319244
|
188
188
|
requirements: []
|
189
189
|
rubyforge_project:
|
190
190
|
rubygems_version: 1.8.24
|