Last active
August 29, 2015 14:12
-
-
Save smmoosavi/2b937a501cdeacc5fd4a to your computer and use it in GitHub Desktop.
change keymaster.js lib behavior with inputs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var keymaster = key.noConflict(); | |
(function(){ | |
var _lastScope = keymaster.getScope(); | |
var _inputScope = false; | |
keymaster.filter = function () { | |
var tagName = (event.target || event.srcElement).tagName; | |
if (tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA') { | |
if (!_inputScope) { | |
_inputScope = true; | |
_lastScope = keymaster.getScope(); | |
} | |
keymaster.setScope('input'); | |
} else if (_inputScope) { | |
_inputScope = false; | |
keymaster.setScope(_lastScope); | |
} | |
return true; | |
}; | |
keymaster.getLastScope = function(){ | |
return _lastScope; | |
}; | |
keymaster.isInputScope = function(){ | |
return _inputScope; | |
}; | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
cp bower_components/keymaster/keymaster.js my/keymaster.js | |
cat keymaster-patch.js >> my/keymaster.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment