summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-03-25 17:18:55 -0700
committerAlex Yatskov <alex@foosoft.net>2017-03-25 17:18:55 -0700
commitf5a8383d2a670f32d5431150fe6571a3ada3bf18 (patch)
tree3c18eda3128e7fbdd0c0aba7e81dd829f7640f31
parent218db0771fae0754a50cadc1891a042112b58699 (diff)
wip
-rw-r--r--ext/manifest.json6
-rw-r--r--ext/mixed/js/display.js19
2 files changed, 14 insertions, 11 deletions
diff --git a/ext/manifest.json b/ext/manifest.json
index 215397d0..e759c4dc 100644
--- a/ext/manifest.json
+++ b/ext/manifest.json
@@ -43,6 +43,12 @@
"default": "Alt+Insert"
},
"description": "Open search window"
+ },
+ "options": {
+ "suggested_key": {
+ "default": "Alt+End"
+ },
+ "description": "Open options page"
}
},
"web_accessible_resources": ["fg/frame.html"],
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 50940e58..dca32e78 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -211,11 +211,8 @@ class Display {
}
onKeyDown(e) {
+ const requireAlt = ['e', 'k', 'p'];
const handlers = {
- 8: /* backspace */ () => {
-
- },
-
27: /* escape */ () => {
this.clearSearch();
},
@@ -244,21 +241,21 @@ class Display {
this.entryScroll(this.index + 1, true);
},
- 209: /* [ */ () => {
-
+ 69: /* e */ () => {
+ this.noteAdd(this.definitions[this.index], 'term-kanji');
},
- 220: /* \ */ () => {
- this.audioPlay(this.definitions[this.index]);
+ 75: /* k */ () => {
+ this.noteAdd(this.definitions[this.index], 'term-kana');
},
- 221: /* ] */ () => {
-
+ 80: /* p */ () => {
+ this.audioPlay(this.definitions[this.index]);
}
};
const handler = handlers[e.keyCode];
- if (handler) {
+ if (handler && (e.altKey || !requireAlt.includes(e.keyCode))) {
e.preventDefault();
handler();
}