-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.js
24 lines (22 loc) · 951 Bytes
/
demo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var demo = function(){
if(keymap != undefined){
for(var key in keymap){
var style = highlight.size + " " + highlight.style + " " + highlight.color,
styletransparent = highlight.size + " " + highlight.style + " transparent";
Mousetrap.bind(key , function(event) {
var keypressed = String.fromCharCode(event.keyCode).toLowerCase();
$(keymap[keypressed]).css('outline', style);
event.preventDefault();
event.stopPropagation();
return false;
}, 'keydown');
Mousetrap.bind(key, function(event) {
var keypressed = String.fromCharCode(event.keyCode).toLowerCase();
$(keymap[keypressed]).css('outline', styletransparent);
event.preventDefault();
event.stopPropagation();
return false;
}, 'keyup');
}
}
}