password-manager/frontend/delta/js/MouseTrap/mousetrap-pause.js
Giulio Cesare Solaroli 7a116201f7 Removed clipperz copyright/license note
The script that automatically adds the copyright notice was wrongly configured.
2015-03-22 21:10:48 +01:00

30 lines
678 B
JavaScript

/**
* adds a pause and unpause method to Mousetrap
* this allows you to enable or disable keyboard shortcuts
* without having to reset Mousetrap and rebind everything
*/
/* global Mousetrap:true */
Mousetrap = (function(Mousetrap) {
var self = Mousetrap,
_originalStopCallback = self.stopCallback,
enabled = true;
self.stopCallback = function(e, element, combo) {
if (!enabled) {
return true;
}
return _originalStopCallback(e, element, combo);
};
self.pause = function() {
enabled = false;
};
self.unpause = function() {
enabled = true;
};
return self;
}) (Mousetrap);