mousetrap-rails 0.0.11 → 0.0.12
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.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/CHANGELOG.md +7 -1
- data/README.md +1 -1
- data/lib/generators/mousetrap/install/templates/keybindings.js.coffee +12 -1
- data/lib/mousetrap-rails/version.rb +1 -1
- data/vendor/assets/javascripts/mousetrap.js +4 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7c1c1518dc3723ad152da8bdbeb6731a807f5e7
|
4
|
+
data.tar.gz: b109201e9f8dab37a40a1eb2d05bc140625d1e4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d87bdda376611d3a0c9a0cc48affa09fd1f41e94fbfba42c2643f322a5274177d49aa7053e09b50ce7ab0e39679ea9d1517429ec799252e5e6bc07da7dc71149
|
7
|
+
data.tar.gz: 0a41c7856d6e1c9d280f36dfd8f80cd9e18cb82e8c8e3d08a2d4a516a1ad6cbb8d4e528ffac3dfc136681c87bfc3e1e7bbd3bd3b9b3756e4e8f37063c9978c22
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,13 @@
|
|
1
|
-
## v0.0.
|
1
|
+
## v0.0.13.wip
|
2
2
|
|
3
3
|
* [] Add moustrap extensions generator
|
4
4
|
|
5
|
+
## v0.0.12
|
6
|
+
|
7
|
+
* minor turbolinks compatibility improvements
|
8
|
+
* fix bug with numbers binding in data attributes
|
9
|
+
* update mousetrap.js to 1.4.5
|
10
|
+
|
5
11
|
## v0.0.11
|
6
12
|
|
7
13
|
* add update mousetrap.js rake task
|
data/README.md
CHANGED
@@ -129,5 +129,5 @@ Gosh! It's [here](https://github.com/kugaevsky/mousetrap-rails/blob/master/LICEN
|
|
129
129
|
|
130
130
|
## Authors
|
131
131
|
|
132
|
-
* mousetrap-rails gem by [Nick Kugaevsky](http://kugaevsky.ru)
|
132
|
+
* mousetrap-rails gem by [Nick Kugaevsky](http://kugaevsky.ru) and [contributors](https://github.com/kugaevsky/mousetrap-rails/graphs/contributors)
|
133
133
|
* original mousetrap library by [Craig Campbell](http://craig.is/)
|
@@ -1,8 +1,19 @@
|
|
1
1
|
$ ->
|
2
|
+
handleKeyBindings()
|
3
|
+
|
4
|
+
$(document).on 'page:change', ->
|
5
|
+
handleKeyBindings()
|
6
|
+
|
7
|
+
handleKeyBindings = ->
|
8
|
+
# As turbolinks does not refresh the page, some old keybindings could be still present. Therefore a reset is required.
|
9
|
+
Mousetrap.reset()
|
10
|
+
|
2
11
|
# Hotkey binding to links with 'data-keybinding' attribute
|
3
12
|
# Navigate link when hotkey pressed
|
4
13
|
$('a[data-keybinding]').each (i, el) ->
|
5
|
-
|
14
|
+
bindedKey = $(el).data('keybinding')
|
15
|
+
bindedKey = bindedKey.toString() if typeof(bindedKey) == 'number'
|
16
|
+
Mousetrap.bind bindedKey, (e) ->
|
6
17
|
if typeof(Turbolinks) == 'undefined'
|
7
18
|
# Emulate click if turbolinks defined
|
8
19
|
el.click()
|
@@ -17,10 +17,10 @@
|
|
17
17
|
* Mousetrap is a simple keyboard shortcut library for Javascript with
|
18
18
|
* no external dependencies
|
19
19
|
*
|
20
|
-
* @version 1.4.
|
20
|
+
* @version 1.4.5
|
21
21
|
* @url craig.is/killing/mice
|
22
22
|
*/
|
23
|
-
(function() {
|
23
|
+
(function(window, document, undefined) {
|
24
24
|
|
25
25
|
/**
|
26
26
|
* mapping of special keycodes to their corresponding keys
|
@@ -246,12 +246,6 @@
|
|
246
246
|
character = character.toLowerCase();
|
247
247
|
}
|
248
248
|
|
249
|
-
// String.fromCharCode(32) for spacebar returns " " for the
|
250
|
-
// character name, make sure it matches the mousetrap name
|
251
|
-
if (character == ' ') {
|
252
|
-
return 'space';
|
253
|
-
}
|
254
|
-
|
255
249
|
return character;
|
256
250
|
}
|
257
251
|
|
@@ -918,7 +912,7 @@
|
|
918
912
|
}
|
919
913
|
|
920
914
|
// stop for input, select, and textarea
|
921
|
-
return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagName == 'TEXTAREA' ||
|
915
|
+
return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagName == 'TEXTAREA' || element.isContentEditable;
|
922
916
|
},
|
923
917
|
|
924
918
|
/**
|
@@ -934,4 +928,4 @@
|
|
934
928
|
if (typeof define === 'function' && define.amd) {
|
935
929
|
define(Mousetrap);
|
936
930
|
}
|
937
|
-
}) ();
|
931
|
+
}) (window, document);
|
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.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Kugaevsky
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- gem-public_cert.pem
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|