mousetrap-rails 0.0.8 → 0.0.9
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.tar.gz.sig +2 -0
- data/CHANGELOG.md +4 -1
- data/README.md +16 -7
- data/gem-public_cert.pem +20 -0
- data/lib/generators/mousetrap/install/install_generator.rb +5 -0
- data/lib/mousetrap-rails.rb +4 -0
- data/lib/mousetrap-rails/version.rb +1 -1
- data/mousetrap-rails.gemspec +4 -1
- data/vendor/assets/javascripts/mousetrap.js +53 -52
- metadata +42 -14
- metadata.gz.sig +0 -0
    
        data.tar.gz.sig
    ADDED
    
    
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -11,20 +11,28 @@ The `mousetrap-rails` gem integrates Mousetrap javascript library with Rails Ass | |
| 11 11 |  | 
| 12 12 | 
             
            Add this line to your application's Gemfile:
         | 
| 13 13 |  | 
| 14 | 
            -
             | 
| 14 | 
            +
            ```ruby
         | 
| 15 | 
            +
            gem 'mousetrap-rails'
         | 
| 16 | 
            +
            ```
         | 
| 15 17 |  | 
| 16 18 | 
             
            And then execute:
         | 
| 17 19 |  | 
| 18 | 
            -
             | 
| 20 | 
            +
            ```bash
         | 
| 21 | 
            +
            $ bundle install
         | 
| 22 | 
            +
            ```
         | 
| 19 23 |  | 
| 20 24 | 
             
            ### Run generator
         | 
| 21 25 |  | 
| 22 | 
            -
             | 
| 26 | 
            +
            ```bash
         | 
| 27 | 
            +
            $ rails generate mousetrap:install
         | 
| 28 | 
            +
            ```
         | 
| 23 29 |  | 
| 24 30 | 
             
            It will create sample `keybindings.js.coffee` file in `app/assets/javascripts` and insert mousetrap-rails files to manifests of assert pipeline
         | 
| 25 31 |  | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 32 | 
            +
            ```coffeescript
         | 
| 33 | 
            +
            //= require mousetrap     # ---> application.js
         | 
| 34 | 
            +
            *= require mousetrap      # ---> application.css
         | 
| 35 | 
            +
            ```
         | 
| 28 36 |  | 
| 29 37 | 
             
            Voila!
         | 
| 30 38 |  | 
| @@ -32,8 +40,9 @@ Voila! | |
| 32 40 |  | 
| 33 41 | 
             
            Instead of `gem 'mousetrap-rails'` add to your Gemfile
         | 
| 34 42 |  | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 43 | 
            +
            ```ruby
         | 
| 44 | 
            +
            gem 'mousetrap-rails', github: 'kugaevsky/mousetrap-rails'
         | 
| 45 | 
            +
            ```
         | 
| 37 46 |  | 
| 38 47 | 
             
            ## Usage
         | 
| 39 48 |  | 
    
        data/gem-public_cert.pem
    ADDED
    
    | @@ -0,0 +1,20 @@ | |
| 1 | 
            +
            -----BEGIN CERTIFICATE-----
         | 
| 2 | 
            +
            MIIDMDCCAhigAwIBAgIBADANBgkqhkiG9w0BAQUFADA+MQ0wCwYDVQQDDARuaWNr
         | 
| 3 | 
            +
            MRkwFwYKCZImiZPyLGQBGRYJa3VnYWV2c2t5MRIwEAYKCZImiZPyLGQBGRYCcnUw
         | 
| 4 | 
            +
            HhcNMTMwMTMxMTgxMjMwWhcNMTQwMTMxMTgxMjMwWjA+MQ0wCwYDVQQDDARuaWNr
         | 
| 5 | 
            +
            MRkwFwYKCZImiZPyLGQBGRYJa3VnYWV2c2t5MRIwEAYKCZImiZPyLGQBGRYCcnUw
         | 
| 6 | 
            +
            ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3SS01rsI5N3EUG3bSnfI2
         | 
| 7 | 
            +
            pr4Exx9gKCBS5IxV7Ot+pQ2psIiWoenaS4fS2fsmvle92ClEx3NbUqnxxGDES0Eb
         | 
| 8 | 
            +
            FkNHyAH9VwO36vS0loNv/Ox2sSaleUNV3JdvcP1Gm3xGtn9KWNcpuAwPfMl5BSYg
         | 
| 9 | 
            +
            K4WU8zIkbLlwmrO6h85IYZrDwqghb6OCOwhb56d4byjoJE25brUxETxGVdsuVCDr
         | 
| 10 | 
            +
            EQroS+D2BiMAEdwJcn/PepMx3lt+teZrjUoei5UXIcnZ28UYSnmXjXnkySlPXzRV
         | 
| 11 | 
            +
            siLwUMAgGu665huUE5S8idW7ohSHTJv/kH98BoiWi7gi9HFMz4OJMMeR5rZk76Ql
         | 
| 12 | 
            +
            AgMBAAGjOTA3MAkGA1UdEwQCMAAwHQYDVR0OBBYEFCdIKkB9lZ+com0wLBhLQDWe
         | 
| 13 | 
            +
            YnbvMAsGA1UdDwQEAwIEsDANBgkqhkiG9w0BAQUFAAOCAQEANOubFddpzMXJflPv
         | 
| 14 | 
            +
            vXXnWXYvZK2etSxzwewXXOhcbzwSxdU0T4NbKcrlhlFbjUDh/xF4Qzc1dB9OFG9r
         | 
| 15 | 
            +
            ffIUKv0JtEyGM/mOaISsNp+oYUlXxXLNOsX8LT1r+337tQ627GoX/Z0RL5u8Mz6Q
         | 
| 16 | 
            +
            KZUJhGQKNnIp6Rkz6sp4Zh2aqTLt8BDEA86kO+0v4LaVLqFEmLTypf7C568RTYlm
         | 
| 17 | 
            +
            N8LaREQMM5YdvCIYWs5C6iNRVaDhT8bkuWNhtBis0H7YFAfsW1rn9np8OQ7nY2az
         | 
| 18 | 
            +
            8dNQrBlKzc/RLwGGFT1gjzVlIb7/xtNdMdJQ6JwyljSJ70PbKAAzgBRdDLPt9BWt
         | 
| 19 | 
            +
            3AH9mw==
         | 
| 20 | 
            +
            -----END CERTIFICATE-----
         | 
| @@ -1,13 +1,17 @@ | |
| 1 1 | 
             
            module Mousetrap
         | 
| 2 | 
            +
             | 
| 3 | 
            +
              # Mousetrap rails generators module
         | 
| 2 4 | 
             
              module Generators
         | 
| 3 5 | 
             
                class InstallGenerator < ::Rails::Generators::Base
         | 
| 4 6 | 
             
                  desc "Copy Mousetrap default files"
         | 
| 5 7 | 
             
                  source_root File.expand_path('../templates', __FILE__)
         | 
| 6 8 |  | 
| 9 | 
            +
                  # Copy keybindings scripts to assets folder
         | 
| 7 10 | 
             
                  def copy_mousetrap
         | 
| 8 11 | 
             
                    copy_file "keybindings.js.coffee", "app/assets/javascripts/keybindings.js.coffee"
         | 
| 9 12 | 
             
                  end
         | 
| 10 13 |  | 
| 14 | 
            +
                  # Inject moustrap scripts to application.js
         | 
| 11 15 | 
             
                  def add_javascript_assets
         | 
| 12 16 | 
             
                    if File.exist?('app/assets/javascripts/application.js')
         | 
| 13 17 | 
             
                      insert_into_file "app/assets/javascripts/application.js", "//= require mousetrap\n", :after => "jquery_ujs\n"
         | 
| @@ -16,6 +20,7 @@ module Mousetrap | |
| 16 20 | 
             
                    end
         | 
| 17 21 | 
             
                  end
         | 
| 18 22 |  | 
| 23 | 
            +
                  # Inject moustrap styles to application.css
         | 
| 19 24 | 
             
                  def add_css_assets
         | 
| 20 25 | 
             
                    if File.exist?('app/assets/stylesheets/application.css')
         | 
| 21 26 | 
             
                      insert_into_file "app/assets/stylesheets/application.css", "*= require mousetrap\n ", :before => "*= require_tree ."
         | 
    
        data/lib/mousetrap-rails.rb
    CHANGED
    
    
    
        data/mousetrap-rails.gemspec
    CHANGED
    
    | @@ -17,7 +17,10 @@ Gem::Specification.new do |gem| | |
| 17 17 | 
             
              gem.test_files    = gem.files.grep(%r{^(test|spec|features)/})
         | 
| 18 18 | 
             
              gem.require_paths = ["lib"]
         | 
| 19 19 |  | 
| 20 | 
            -
              gem. | 
| 20 | 
            +
              gem.signing_key = '/Users/nick/.ssh/gem-private_key.pem'
         | 
| 21 | 
            +
              gem.cert_chain  = ['gem-public_cert.pem']
         | 
| 22 | 
            +
             | 
| 23 | 
            +
              gem.add_development_dependency 'rails', '~> 3.2.11'
         | 
| 21 24 | 
             
              gem.add_development_dependency 'sqlite3', '~> 1.3.5'
         | 
| 22 25 | 
             
              gem.add_development_dependency 'rspec-rails', '~> 2.12.0'
         | 
| 23 26 | 
             
              gem.add_development_dependency 'genspec', '~> 0.2.7'
         | 
| @@ -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.3.0
         | 
| 20 20 | 
             
             * @url craig.is/killing/mice
         | 
| 21 21 | 
             
             */
         | 
| 22 22 | 
             
            (function() {
         | 
| @@ -148,7 +148,7 @@ | |
| 148 148 | 
             
                     *
         | 
| 149 149 | 
             
                     * @type {Object}
         | 
| 150 150 | 
             
                     */
         | 
| 151 | 
            -
                     | 
| 151 | 
            +
                    _directMap = {},
         | 
| 152 152 |  | 
| 153 153 | 
             
                    /**
         | 
| 154 154 | 
             
                     * keeps track of what level each sequence is at since multiple
         | 
| @@ -156,21 +156,21 @@ | |
| 156 156 | 
             
                     *
         | 
| 157 157 | 
             
                     * @type {Object}
         | 
| 158 158 | 
             
                     */
         | 
| 159 | 
            -
                     | 
| 159 | 
            +
                    _sequenceLevels = {},
         | 
| 160 160 |  | 
| 161 161 | 
             
                    /**
         | 
| 162 162 | 
             
                     * variable to store the setTimeout call
         | 
| 163 163 | 
             
                     *
         | 
| 164 164 | 
             
                     * @type {null|number}
         | 
| 165 165 | 
             
                     */
         | 
| 166 | 
            -
                     | 
| 166 | 
            +
                    _resetTimer,
         | 
| 167 167 |  | 
| 168 168 | 
             
                    /**
         | 
| 169 169 | 
             
                     * temporary state where we will ignore the next keyup
         | 
| 170 170 | 
             
                     *
         | 
| 171 171 | 
             
                     * @type {boolean|string}
         | 
| 172 172 | 
             
                     */
         | 
| 173 | 
            -
                     | 
| 173 | 
            +
                    _ignoreNextKeyup = false,
         | 
| 174 174 |  | 
| 175 175 | 
             
                    /**
         | 
| 176 176 | 
             
                     * are we currently inside of a sequence?
         | 
| @@ -178,7 +178,7 @@ | |
| 178 178 | 
             
                     *
         | 
| 179 179 | 
             
                     * @type {boolean|string}
         | 
| 180 180 | 
             
                     */
         | 
| 181 | 
            -
                     | 
| 181 | 
            +
                    _sequenceType = false;
         | 
| 182 182 |  | 
| 183 183 | 
             
                /**
         | 
| 184 184 | 
             
                 * loop through the f keys, f1 to f19 and add them to the map
         | 
| @@ -252,25 +252,25 @@ | |
| 252 252 | 
             
                /**
         | 
| 253 253 | 
             
                 * resets all sequence counters except for the ones passed in
         | 
| 254 254 | 
             
                 *
         | 
| 255 | 
            -
                 * @param {Object}  | 
| 255 | 
            +
                 * @param {Object} doNotReset
         | 
| 256 256 | 
             
                 * @returns void
         | 
| 257 257 | 
             
                 */
         | 
| 258 | 
            -
                function _resetSequences( | 
| 259 | 
            -
                     | 
| 258 | 
            +
                function _resetSequences(doNotReset, maxLevel) {
         | 
| 259 | 
            +
                    doNotReset = doNotReset || {};
         | 
| 260 260 |  | 
| 261 | 
            -
                    var  | 
| 261 | 
            +
                    var activeSequences = false,
         | 
| 262 262 | 
             
                        key;
         | 
| 263 263 |  | 
| 264 | 
            -
                    for (key in  | 
| 265 | 
            -
                        if ( | 
| 266 | 
            -
                             | 
| 264 | 
            +
                    for (key in _sequenceLevels) {
         | 
| 265 | 
            +
                        if (doNotReset[key] && _sequenceLevels[key] > maxLevel) {
         | 
| 266 | 
            +
                            activeSequences = true;
         | 
| 267 267 | 
             
                            continue;
         | 
| 268 268 | 
             
                        }
         | 
| 269 | 
            -
                         | 
| 269 | 
            +
                        _sequenceLevels[key] = 0;
         | 
| 270 270 | 
             
                    }
         | 
| 271 271 |  | 
| 272 | 
            -
                    if (! | 
| 273 | 
            -
                         | 
| 272 | 
            +
                    if (!activeSequences) {
         | 
| 273 | 
            +
                        _sequenceType = false;
         | 
| 274 274 | 
             
                    }
         | 
| 275 275 | 
             
                }
         | 
| 276 276 |  | 
| @@ -308,7 +308,7 @@ | |
| 308 308 |  | 
| 309 309 | 
             
                        // if this is a sequence but it is not at the right level
         | 
| 310 310 | 
             
                        // then move onto the next match
         | 
| 311 | 
            -
                        if (callback.seq &&  | 
| 311 | 
            +
                        if (callback.seq && _sequenceLevels[callback.seq] != callback.level) {
         | 
| 312 312 | 
             
                            continue;
         | 
| 313 313 | 
             
                        }
         | 
| 314 314 |  | 
| @@ -409,9 +409,9 @@ | |
| 409 409 | 
             
                function _handleCharacter(character, e) {
         | 
| 410 410 | 
             
                    var callbacks = _getMatches(character, _eventModifiers(e), e),
         | 
| 411 411 | 
             
                        i,
         | 
| 412 | 
            -
                         | 
| 413 | 
            -
                         | 
| 414 | 
            -
                         | 
| 412 | 
            +
                        doNotReset = {},
         | 
| 413 | 
            +
                        maxLevel = 0,
         | 
| 414 | 
            +
                        processedSequenceCallback = false;
         | 
| 415 415 |  | 
| 416 416 | 
             
                    // loop through matching callbacks for this key event
         | 
| 417 417 | 
             
                    for (i = 0; i < callbacks.length; ++i) {
         | 
| @@ -422,21 +422,21 @@ | |
| 422 422 | 
             
                        // callback for matching g cause otherwise you can only ever
         | 
| 423 423 | 
             
                        // match the first one
         | 
| 424 424 | 
             
                        if (callbacks[i].seq) {
         | 
| 425 | 
            -
                             | 
| 425 | 
            +
                            processedSequenceCallback = true;
         | 
| 426 426 |  | 
| 427 427 | 
             
                            // as we loop through keep track of the max
         | 
| 428 428 | 
             
                            // any sequence at a lower level will be discarded
         | 
| 429 | 
            -
                             | 
| 429 | 
            +
                            maxLevel = Math.max(maxLevel, callbacks[i].level);
         | 
| 430 430 |  | 
| 431 431 | 
             
                            // keep a list of which sequences were matches for later
         | 
| 432 | 
            -
                             | 
| 432 | 
            +
                            doNotReset[callbacks[i].seq] = 1;
         | 
| 433 433 | 
             
                            _fireCallback(callbacks[i].callback, e, callbacks[i].combo);
         | 
| 434 434 | 
             
                            continue;
         | 
| 435 435 | 
             
                        }
         | 
| 436 436 |  | 
| 437 437 | 
             
                        // if there were no sequence matches but we are still here
         | 
| 438 438 | 
             
                        // that means this is a regular match so we should fire that
         | 
| 439 | 
            -
                        if (! | 
| 439 | 
            +
                        if (!processedSequenceCallback && !_sequenceType) {
         | 
| 440 440 | 
             
                            _fireCallback(callbacks[i].callback, e, callbacks[i].combo);
         | 
| 441 441 | 
             
                        }
         | 
| 442 442 | 
             
                    }
         | 
| @@ -444,8 +444,8 @@ | |
| 444 444 | 
             
                    // if you are inside of a sequence and the key you are pressing
         | 
| 445 445 | 
             
                    // is not a modifier key then we should reset all sequences
         | 
| 446 446 | 
             
                    // that were not matched by this key event
         | 
| 447 | 
            -
                    if (e.type ==  | 
| 448 | 
            -
                        _resetSequences( | 
| 447 | 
            +
                    if (e.type == _sequenceType && !_isModifier(character)) {
         | 
| 448 | 
            +
                        _resetSequences(doNotReset, maxLevel);
         | 
| 449 449 | 
             
                    }
         | 
| 450 450 | 
             
                }
         | 
| 451 451 |  | 
| @@ -470,8 +470,8 @@ | |
| 470 470 | 
             
                        return;
         | 
| 471 471 | 
             
                    }
         | 
| 472 472 |  | 
| 473 | 
            -
                    if (e.type == 'keyup' &&  | 
| 474 | 
            -
                         | 
| 473 | 
            +
                    if (e.type == 'keyup' && _ignoreNextKeyup == character) {
         | 
| 474 | 
            +
                        _ignoreNextKeyup = false;
         | 
| 475 475 | 
             
                        return;
         | 
| 476 476 | 
             
                    }
         | 
| 477 477 |  | 
| @@ -497,8 +497,8 @@ | |
| 497 497 | 
             
                 * @returns void
         | 
| 498 498 | 
             
                 */
         | 
| 499 499 | 
             
                function _resetSequenceTimer() {
         | 
| 500 | 
            -
                    clearTimeout( | 
| 501 | 
            -
                     | 
| 500 | 
            +
                    clearTimeout(_resetTimer);
         | 
| 501 | 
            +
                    _resetTimer = setTimeout(_resetSequences, 1000);
         | 
| 502 502 | 
             
                }
         | 
| 503 503 |  | 
| 504 504 | 
             
                /**
         | 
| @@ -563,7 +563,7 @@ | |
| 563 563 |  | 
| 564 564 | 
             
                    // start off by adding a sequence level record for this combination
         | 
| 565 565 | 
             
                    // and setting the level to 0
         | 
| 566 | 
            -
                     | 
| 566 | 
            +
                    _sequenceLevels[combo] = 0;
         | 
| 567 567 |  | 
| 568 568 | 
             
                    // if there is no action pick the best one for the first key
         | 
| 569 569 | 
             
                    // in the sequence
         | 
| @@ -579,8 +579,8 @@ | |
| 579 579 | 
             
                     * @returns void
         | 
| 580 580 | 
             
                     */
         | 
| 581 581 | 
             
                    var _increaseSequence = function(e) {
         | 
| 582 | 
            -
                             | 
| 583 | 
            -
                            ++ | 
| 582 | 
            +
                            _sequenceType = action;
         | 
| 583 | 
            +
                            ++_sequenceLevels[combo];
         | 
| 584 584 | 
             
                            _resetSequenceTimer();
         | 
| 585 585 | 
             
                        },
         | 
| 586 586 |  | 
| @@ -598,7 +598,7 @@ | |
| 598 598 | 
             
                            // or keypress.  this is so if you finish a sequence and
         | 
| 599 599 | 
             
                            // release the key the final key will not trigger a keyup
         | 
| 600 600 | 
             
                            if (action !== 'keyup') {
         | 
| 601 | 
            -
                                 | 
| 601 | 
            +
                                _ignoreNextKeyup = _characterFromEvent(e);
         | 
| 602 602 | 
             
                            }
         | 
| 603 603 |  | 
| 604 604 | 
             
                            // weird race condition if a sequence ends with the key
         | 
| @@ -621,11 +621,14 @@ | |
| 621 621 | 
             
                 * @param {string} combination
         | 
| 622 622 | 
             
                 * @param {Function} callback
         | 
| 623 623 | 
             
                 * @param {string=} action
         | 
| 624 | 
            -
                 * @param {string=}  | 
| 624 | 
            +
                 * @param {string=} sequenceName - name of sequence if part of sequence
         | 
| 625 625 | 
             
                 * @param {number=} level - what part of the sequence the command is
         | 
| 626 626 | 
             
                 * @returns void
         | 
| 627 627 | 
             
                 */
         | 
| 628 | 
            -
                function _bindSingle(combination, callback, action,  | 
| 628 | 
            +
                function _bindSingle(combination, callback, action, sequenceName, level) {
         | 
| 629 | 
            +
             | 
| 630 | 
            +
                    // store a direct mapped reference for use with Mousetrap.trigger
         | 
| 631 | 
            +
                    _directMap[combination + ':' + action] = callback;
         | 
| 629 632 |  | 
| 630 633 | 
             
                    // make sure multiple spaces in a row become a single space
         | 
| 631 634 | 
             
                    combination = combination.replace(/\s+/g, ' ');
         | 
| @@ -680,7 +683,7 @@ | |
| 680 683 | 
             
                    }
         | 
| 681 684 |  | 
| 682 685 | 
             
                    // remove an existing match if there is one
         | 
| 683 | 
            -
                    _getMatches(key, modifiers, {type: action}, ! | 
| 686 | 
            +
                    _getMatches(key, modifiers, {type: action}, !sequenceName, combination);
         | 
| 684 687 |  | 
| 685 688 | 
             
                    // add this call back to the array
         | 
| 686 689 | 
             
                    // if it is a sequence put it at the beginning
         | 
| @@ -688,11 +691,11 @@ | |
| 688 691 | 
             
                    //
         | 
| 689 692 | 
             
                    // this is important because the way these are processed expects
         | 
| 690 693 | 
             
                    // the sequence ones to come first
         | 
| 691 | 
            -
                    _callbacks[key][ | 
| 694 | 
            +
                    _callbacks[key][sequenceName ? 'unshift' : 'push']({
         | 
| 692 695 | 
             
                        callback: callback,
         | 
| 693 696 | 
             
                        modifiers: modifiers,
         | 
| 694 697 | 
             
                        action: action,
         | 
| 695 | 
            -
                        seq:  | 
| 698 | 
            +
                        seq: sequenceName,
         | 
| 696 699 | 
             
                        level: level,
         | 
| 697 700 | 
             
                        combo: combination
         | 
| 698 701 | 
             
                    });
         | 
| @@ -734,8 +737,8 @@ | |
| 734 737 | 
             
                     * @returns void
         | 
| 735 738 | 
             
                     */
         | 
| 736 739 | 
             
                    bind: function(keys, callback, action) {
         | 
| 737 | 
            -
                         | 
| 738 | 
            -
                         | 
| 740 | 
            +
                        keys = keys instanceof Array ? keys : [keys];
         | 
| 741 | 
            +
                        _bindMultiple(keys, callback, action);
         | 
| 739 742 | 
             
                        return this;
         | 
| 740 743 | 
             
                    },
         | 
| 741 744 |  | 
| @@ -744,24 +747,20 @@ | |
| 744 747 | 
             
                     *
         | 
| 745 748 | 
             
                     * the unbinding sets the callback function of the specified key combo
         | 
| 746 749 | 
             
                     * to an empty function and deletes the corresponding key in the
         | 
| 747 | 
            -
                     *  | 
| 748 | 
            -
                     *
         | 
| 749 | 
            -
                     * the keycombo+action has to be exactly the same as
         | 
| 750 | 
            -
                     * it was defined in the bind method
         | 
| 750 | 
            +
                     * _directMap dict.
         | 
| 751 751 | 
             
                     *
         | 
| 752 752 | 
             
                     * TODO: actually remove this from the _callbacks dictionary instead
         | 
| 753 753 | 
             
                     * of binding an empty function
         | 
| 754 754 | 
             
                     *
         | 
| 755 | 
            +
                     * the keycombo+action has to be exactly the same as
         | 
| 756 | 
            +
                     * it was defined in the bind method
         | 
| 757 | 
            +
                     *
         | 
| 755 758 | 
             
                     * @param {string|Array} keys
         | 
| 756 759 | 
             
                     * @param {string} action
         | 
| 757 760 | 
             
                     * @returns void
         | 
| 758 761 | 
             
                     */
         | 
| 759 762 | 
             
                    unbind: function(keys, action) {
         | 
| 760 | 
            -
                         | 
| 761 | 
            -
                            delete _direct_map[keys + ':' + action];
         | 
| 762 | 
            -
                            this.bind(keys, function() {}, action);
         | 
| 763 | 
            -
                        }
         | 
| 764 | 
            -
                        return this;
         | 
| 763 | 
            +
                        return Mousetrap.bind(keys, function() {}, action);
         | 
| 765 764 | 
             
                    },
         | 
| 766 765 |  | 
| 767 766 | 
             
                    /**
         | 
| @@ -772,7 +771,9 @@ | |
| 772 771 | 
             
                     * @returns void
         | 
| 773 772 | 
             
                     */
         | 
| 774 773 | 
             
                    trigger: function(keys, action) {
         | 
| 775 | 
            -
                         | 
| 774 | 
            +
                        if (_directMap[keys + ':' + action]) {
         | 
| 775 | 
            +
                            _directMap[keys + ':' + action]();
         | 
| 776 | 
            +
                        }
         | 
| 776 777 | 
             
                        return this;
         | 
| 777 778 | 
             
                    },
         | 
| 778 779 |  | 
| @@ -785,7 +786,7 @@ | |
| 785 786 | 
             
                     */
         | 
| 786 787 | 
             
                    reset: function() {
         | 
| 787 788 | 
             
                        _callbacks = {};
         | 
| 788 | 
            -
                         | 
| 789 | 
            +
                        _directMap = {};
         | 
| 789 790 | 
             
                        return this;
         | 
| 790 791 | 
             
                    },
         | 
| 791 792 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,15 +1,42 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: mousetrap-rails
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0.8
         | 
| 5 4 | 
             
              prerelease: 
         | 
| 5 | 
            +
              version: 0.0.9
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| 8 8 | 
             
            - Nick Kugaevsky
         | 
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 | 
            -
            cert_chain: | 
| 12 | 
            -
             | 
| 11 | 
            +
            cert_chain:
         | 
| 12 | 
            +
            - !binary |-
         | 
| 13 | 
            +
              LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURNRENDQWhpZ0F3SUJB
         | 
| 14 | 
            +
              Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREErTVEwd0N3WURWUVFEREFSdWFX
         | 
| 15 | 
            +
              TnIKTVJrd0Z3WUtDWkltaVpQeUxHUUJHUllKYTNWbllXVjJjMnQ1TVJJd0VB
         | 
| 16 | 
            +
              WUtDWkltaVpQeUxHUUJHUllDY25VdwpIaGNOTVRNd01UTXhNVGd4TWpNd1do
         | 
| 17 | 
            +
              Y05NVFF3TVRNeE1UZ3hNak13V2pBK01RMHdDd1lEVlFRRERBUnVhV05yCk1S
         | 
| 18 | 
            +
              a3dGd1lLQ1pJbWlaUHlMR1FCR1JZSmEzVm5ZV1YyYzJ0NU1SSXdFQVlLQ1pJ
         | 
| 19 | 
            +
              bWlaUHlMR1FCR1JZQ2NuVXcKZ2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJ
         | 
| 20 | 
            +
              QkR3QXdnZ0VLQW9JQkFRQzNTUzAxcnNJNU4zRVVHM2JTbmZJMgpwcjRFeHg5
         | 
| 21 | 
            +
              Z0tDQlM1SXhWN090K3BRMnBzSWlXb2VuYVM0ZlMyZnNtdmxlOTJDbEV4M05i
         | 
| 22 | 
            +
              VXFueHhHREVTMEViCkZrTkh5QUg5VndPMzZ2UzBsb052L094MnNTYWxlVU5W
         | 
| 23 | 
            +
              M0pkdmNQMUdtM3hHdG45S1dOY3B1QXdQZk1sNUJTWWcKSzRXVTh6SWtiTGx3
         | 
| 24 | 
            +
              bXJPNmg4NUlZWnJEd3FnaGI2T0NPd2hiNTZkNGJ5am9KRTI1YnJVeEVUeEdW
         | 
| 25 | 
            +
              ZHN1VkNEcgpFUXJvUytEMkJpTUFFZHdKY24vUGVwTXgzbHQrdGVacmpVb2Vp
         | 
| 26 | 
            +
              NVVYSWNuWjI4VVlTbm1Yalhua3lTbFBYelJWCnNpTHdVTUFnR3U2NjVodVVF
         | 
| 27 | 
            +
              NVM4aWRXN29oU0hUSnYva0g5OEJvaVdpN2dpOUhGTXo0T0pNTWVSNXJaazc2
         | 
| 28 | 
            +
              UWwKQWdNQkFBR2pPVEEzTUFrR0ExVWRFd1FDTUFBd0hRWURWUjBPQkJZRUZD
         | 
| 29 | 
            +
              ZElLa0I5bForY29tMHdMQmhMUURXZQpZbmJ2TUFzR0ExVWREd1FFQXdJRXNE
         | 
| 30 | 
            +
              QU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFOT3ViRmRkcHpNWEpmbFB2CnZY
         | 
| 31 | 
            +
              WG5XWFl2WksyZXRTeHp3ZXdYWE9oY2J6d1N4ZFUwVDROYktjcmxobEZialVE
         | 
| 32 | 
            +
              aC94RjRRemMxZEI5T0ZHOXIKZmZJVUt2MEp0RXlHTS9tT2FJU3NOcCtvWVVs
         | 
| 33 | 
            +
              WHhYTE5Pc1g4TFQxciszMzd0UTYyN0dvWC9aMFJMNXU4TXo2UQpLWlVKaEdR
         | 
| 34 | 
            +
              S05uSXA2Umt6NnNwNFpoMmFxVEx0OEJERUE4NmtPKzB2NExhVkxxRkVtTFR5
         | 
| 35 | 
            +
              cGY3QzU2OFJUWWxtCk44TGFSRVFNTTVZZHZDSVlXczVDNmlOUlZhRGhUOGJr
         | 
| 36 | 
            +
              dVdOaHRCaXMwSDdZRkFmc1cxcm45bnA4T1E3blkyYXoKOGROUXJCbEt6Yy9S
         | 
| 37 | 
            +
              THdHR0ZUMWdqelZsSWI3L3h0TmRNZEpRNkp3eWxqU0o3MFBiS0FBemdCUmRE
         | 
| 38 | 
            +
              TFB0OUJXdAozQUg5bXc9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
         | 
| 39 | 
            +
            date: 2013-02-08 00:00:00.000000000 Z
         | 
| 13 40 | 
             
            dependencies:
         | 
| 14 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 42 | 
             
              name: rails
         | 
| @@ -18,15 +45,15 @@ dependencies: | |
| 18 45 | 
             
                requirements:
         | 
| 19 46 | 
             
                - - ~>
         | 
| 20 47 | 
             
                  - !ruby/object:Gem::Version
         | 
| 21 | 
            -
                    version: 3.2. | 
| 48 | 
            +
                    version: 3.2.11
         | 
| 22 49 | 
             
              type: :development
         | 
| 23 | 
            -
              prerelease: false
         | 
| 24 50 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 25 51 | 
             
                none: false
         | 
| 26 52 | 
             
                requirements:
         | 
| 27 53 | 
             
                - - ~>
         | 
| 28 54 | 
             
                  - !ruby/object:Gem::Version
         | 
| 29 | 
            -
                    version: 3.2. | 
| 55 | 
            +
                    version: 3.2.11
         | 
| 56 | 
            +
              prerelease: false
         | 
| 30 57 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 31 58 | 
             
              name: sqlite3
         | 
| 32 59 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -36,13 +63,13 @@ dependencies: | |
| 36 63 | 
             
                  - !ruby/object:Gem::Version
         | 
| 37 64 | 
             
                    version: 1.3.5
         | 
| 38 65 | 
             
              type: :development
         | 
| 39 | 
            -
              prerelease: false
         | 
| 40 66 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 41 67 | 
             
                none: false
         | 
| 42 68 | 
             
                requirements:
         | 
| 43 69 | 
             
                - - ~>
         | 
| 44 70 | 
             
                  - !ruby/object:Gem::Version
         | 
| 45 71 | 
             
                    version: 1.3.5
         | 
| 72 | 
            +
              prerelease: false
         | 
| 46 73 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 47 74 | 
             
              name: rspec-rails
         | 
| 48 75 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -52,13 +79,13 @@ dependencies: | |
| 52 79 | 
             
                  - !ruby/object:Gem::Version
         | 
| 53 80 | 
             
                    version: 2.12.0
         | 
| 54 81 | 
             
              type: :development
         | 
| 55 | 
            -
              prerelease: false
         | 
| 56 82 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 57 83 | 
             
                none: false
         | 
| 58 84 | 
             
                requirements:
         | 
| 59 85 | 
             
                - - ~>
         | 
| 60 86 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 87 | 
             
                    version: 2.12.0
         | 
| 88 | 
            +
              prerelease: false
         | 
| 62 89 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 63 90 | 
             
              name: genspec
         | 
| 64 91 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -68,13 +95,13 @@ dependencies: | |
| 68 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 69 96 | 
             
                    version: 0.2.7
         | 
| 70 97 | 
             
              type: :development
         | 
| 71 | 
            -
              prerelease: false
         | 
| 72 98 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 73 99 | 
             
                none: false
         | 
| 74 100 | 
             
                requirements:
         | 
| 75 101 | 
             
                - - ~>
         | 
| 76 102 | 
             
                  - !ruby/object:Gem::Version
         | 
| 77 103 | 
             
                    version: 0.2.7
         | 
| 104 | 
            +
              prerelease: false
         | 
| 78 105 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 79 106 | 
             
              name: sass
         | 
| 80 107 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -84,13 +111,13 @@ dependencies: | |
| 84 111 | 
             
                  - !ruby/object:Gem::Version
         | 
| 85 112 | 
             
                    version: 3.2.1
         | 
| 86 113 | 
             
              type: :development
         | 
| 87 | 
            -
              prerelease: false
         | 
| 88 114 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 89 115 | 
             
                none: false
         | 
| 90 116 | 
             
                requirements:
         | 
| 91 117 | 
             
                - - ~>
         | 
| 92 118 | 
             
                  - !ruby/object:Gem::Version
         | 
| 93 119 | 
             
                    version: 3.2.1
         | 
| 120 | 
            +
              prerelease: false
         | 
| 94 121 | 
             
            description: Mousetrap is a javascript library for handling keyboard shortcuts in
         | 
| 95 122 | 
             
              your web applications. This gem integrates Mousetrap with Rails asset pipeline for
         | 
| 96 123 | 
             
              easy of use.
         | 
| @@ -109,6 +136,7 @@ files: | |
| 109 136 | 
             
            - Rakefile
         | 
| 110 137 | 
             
            - app/assets/stylesheets/mousetrap.css
         | 
| 111 138 | 
             
            - app/assets/stylesheets/mousetrap.css.sass
         | 
| 139 | 
            +
            - gem-public_cert.pem
         | 
| 112 140 | 
             
            - lib/generators/mousetrap/install/USAGE
         | 
| 113 141 | 
             
            - lib/generators/mousetrap/install/install_generator.rb
         | 
| 114 142 | 
             
            - lib/generators/mousetrap/install/templates/application.css
         | 
| @@ -172,19 +200,19 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 172 200 | 
             
              requirements:
         | 
| 173 201 | 
             
              - - ! '>='
         | 
| 174 202 | 
             
                - !ruby/object:Gem::Version
         | 
| 175 | 
            -
                  version: '0'
         | 
| 176 203 | 
             
                  segments:
         | 
| 177 204 | 
             
                  - 0
         | 
| 178 | 
            -
                  hash:  | 
| 205 | 
            +
                  hash: 3850591978535415950
         | 
| 206 | 
            +
                  version: '0'
         | 
| 179 207 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 180 208 | 
             
              none: false
         | 
| 181 209 | 
             
              requirements:
         | 
| 182 210 | 
             
              - - ! '>='
         | 
| 183 211 | 
             
                - !ruby/object:Gem::Version
         | 
| 184 | 
            -
                  version: '0'
         | 
| 185 212 | 
             
                  segments:
         | 
| 186 213 | 
             
                  - 0
         | 
| 187 | 
            -
                  hash:  | 
| 214 | 
            +
                  hash: 3850591978535415950
         | 
| 215 | 
            +
                  version: '0'
         | 
| 188 216 | 
             
            requirements: []
         | 
| 189 217 | 
             
            rubyforge_project: 
         | 
| 190 218 | 
             
            rubygems_version: 1.8.24
         | 
    
        metadata.gz.sig
    ADDED
    
    | Binary file |