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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51c1d6cf86a69c1b00cd4fb2b6f0f078b780cee0
4
- data.tar.gz: a1193c616141eb56dd86283e6307ab7d27576c17
3
+ metadata.gz: d7c1c1518dc3723ad152da8bdbeb6731a807f5e7
4
+ data.tar.gz: b109201e9f8dab37a40a1eb2d05bc140625d1e4d
5
5
  SHA512:
6
- metadata.gz: ab650c2ee1e6c05554c810cc1b68e0c3eee7f9964dc824bd05fb9bc6a380d093bd75607594046d69eccc535f78de4fd4cd1c0714c7e74b7afc9d8ebaa1cb2b4b
7
- data.tar.gz: 6f7aede7bfd66c11b2818d2ad7fb9e2d4ab12611fdf91babd6b28ca97b4a55f7b14595066ed6aac76d4bc78286ba521e4b8a0aa2910e5d50edd60ae1f5e191cb
6
+ metadata.gz: d87bdda376611d3a0c9a0cc48affa09fd1f41e94fbfba42c2643f322a5274177d49aa7053e09b50ce7ab0e39679ea9d1517429ec799252e5e6bc07da7dc71149
7
+ data.tar.gz: 0a41c7856d6e1c9d280f36dfd8f80cd9e18cb82e8c8e3d08a2d4a516a1ad6cbb8d4e528ffac3dfc136681c87bfc3e1e7bbd3bd3b9b3756e4e8f37063c9978c22
data/.travis.yml CHANGED
@@ -3,5 +3,4 @@ rvm:
3
3
  - 1.9.2
4
4
  - 1.9.3
5
5
  - 2.0.0
6
- - ruby-head
7
6
  - rbx-19mode
data/CHANGELOG.md CHANGED
@@ -1,7 +1,13 @@
1
- ## v0.0.12.wip
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
- Mousetrap.bind $(el).data('keybinding'), (e) ->
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()
@@ -1,5 +1,5 @@
1
1
  module Mousetrap
2
2
  module Rails
3
- VERSION = "0.0.11"
3
+ VERSION = "0.0.12"
4
4
  end
5
5
  end
@@ -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.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' || (element.contentEditable && element.contentEditable == 'true');
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.11
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-07-08 00:00:00.000000000 Z
12
+ date: 2013-09-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails