forked from zombieFox/nightTab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeyboard.js
More file actions
62 lines (58 loc) · 1.4 KB
/
Copy pathkeyboard.js
File metadata and controls
62 lines (58 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
var keyboard = (function() {
var _bind = function() {
window.addEventListener("keydown", function(event) {
// esc
if (event.keyCode == 27) {
if (state.get().menu.active) {
menu.close();
shade.destroy();
} else if (state.get().modal.active) {
modal.destroy();
shade.destroy();
} else if (state.get().edit.active) {
state.change({
path: "edit.active",
value: false
});
control.update();
control.render();
};
data.save();
};
// ctrl+alt+a
if (event.ctrlKey && event.altKey && event.keyCode == 65) {
menu.close();
link.add();
};
// ctrl+alt+m
if (event.ctrlKey && event.altKey && event.keyCode == 77) {
shade.destroy();
modal.destroy();
menu.toggle();
};
// ctrl+alt+e
if (event.ctrlKey && event.altKey && event.keyCode == 69) {
if (state.get().edit.active) {
state.change({
path: "edit.active",
value: false
});
} else {
state.change({
path: "edit.active",
value: true
});
};
control.update();
control.render();
data.save();
};
}, false);
};
var init = function() {
_bind();
};
return {
init: init
};
})();