mousetrapjs 0.0.7 → 0.0.8
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/lib/mousetrapjs/version.rb +1 -1
- data/vendor/assets/javascripts/mousetrap.js +14 -2
- metadata +2 -2
    
        data/lib/mousetrapjs/version.rb
    CHANGED
    
    
| @@ -19,7 +19,7 @@ | |
| 19 19 | 
             
             * @version 1.1.2
         | 
| 20 20 | 
             
             * @url craig.is/killing/mice
         | 
| 21 21 | 
             
             */
         | 
| 22 | 
            -
             | 
| 22 | 
            +
            (function() {
         | 
| 23 23 |  | 
| 24 24 | 
             
                /**
         | 
| 25 25 | 
             
                 * mapping of special keycodes to their corresponding keys
         | 
| @@ -722,7 +722,7 @@ window.Mousetrap = (function() { | |
| 722 722 | 
             
                _addEvent(document, 'keydown', _handleKey);
         | 
| 723 723 | 
             
                _addEvent(document, 'keyup', _handleKey);
         | 
| 724 724 |  | 
| 725 | 
            -
                 | 
| 725 | 
            +
                var mousetrap = {
         | 
| 726 726 |  | 
| 727 727 | 
             
                    /**
         | 
| 728 728 | 
             
                     * binds an event to mousetrap
         | 
| @@ -742,6 +742,7 @@ window.Mousetrap = (function() { | |
| 742 742 | 
             
                    bind: function(keys, callback, action) {
         | 
| 743 743 | 
             
                        _bindMultiple(keys instanceof Array ? keys : [keys], callback, action);
         | 
| 744 744 | 
             
                        _direct_map[keys + ':' + action] = callback;
         | 
| 745 | 
            +
                        return this;
         | 
| 745 746 | 
             
                    },
         | 
| 746 747 |  | 
| 747 748 | 
             
                    /**
         | 
| @@ -766,6 +767,7 @@ window.Mousetrap = (function() { | |
| 766 767 | 
             
                            delete _direct_map[keys + ':' + action];
         | 
| 767 768 | 
             
                            this.bind(keys, function() {}, action);
         | 
| 768 769 | 
             
                        }
         | 
| 770 | 
            +
                        return this;
         | 
| 769 771 | 
             
                    },
         | 
| 770 772 |  | 
| 771 773 | 
             
                    /**
         | 
| @@ -777,6 +779,7 @@ window.Mousetrap = (function() { | |
| 777 779 | 
             
                     */
         | 
| 778 780 | 
             
                    trigger: function(keys, action) {
         | 
| 779 781 | 
             
                        _direct_map[keys + ':' + action]();
         | 
| 782 | 
            +
                        return this;
         | 
| 780 783 | 
             
                    },
         | 
| 781 784 |  | 
| 782 785 | 
             
                    /**
         | 
| @@ -789,6 +792,15 @@ window.Mousetrap = (function() { | |
| 789 792 | 
             
                    reset: function() {
         | 
| 790 793 | 
             
                        _callbacks = {};
         | 
| 791 794 | 
             
                        _direct_map = {};
         | 
| 795 | 
            +
                        return this;
         | 
| 792 796 | 
             
                    }
         | 
| 793 797 | 
             
                };
         | 
| 798 | 
            +
             | 
| 799 | 
            +
                // expose mousetrap to the global object
         | 
| 800 | 
            +
                window.Mousetrap = mousetrap;
         | 
| 801 | 
            +
             | 
| 802 | 
            +
                // expose mousetrap as an AMD module
         | 
| 803 | 
            +
                if (typeof define == 'function' && define.amd) {
         | 
| 804 | 
            +
                    define('mousetrap', function() { return mousetrap; });
         | 
| 805 | 
            +
                }
         | 
| 794 806 | 
             
            }) ();
         | 
    
        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.0.8
         | 
| 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-07- | 
| 12 | 
            +
            date: 2012-07-29 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
         |