summaryrefslogtreecommitdiff
path: root/ext/bg/js/display-window.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-03-25 18:19:38 -0700
committerAlex Yatskov <alex@foosoft.net>2017-03-25 18:19:38 -0700
commit37321e8d52849b0824132e2339760e96308abbb6 (patch)
tree1e6b986768e65d07337bc31ae1d8c2641f60d9f4 /ext/bg/js/display-window.js
parent2c164fb65f286e2852c7e5eb5e7098c5a4fe6f1a (diff)
parent063f3d4dbf8c896f4f7b022cfae6e2b907769251 (diff)
Merge branch 'dev'
Diffstat (limited to 'ext/bg/js/display-window.js')
-rw-r--r--ext/bg/js/display-window.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/ext/bg/js/display-window.js b/ext/bg/js/display-window.js
index ad193c5b..ae97cd36 100644
--- a/ext/bg/js/display-window.js
+++ b/ext/bg/js/display-window.js
@@ -20,8 +20,13 @@
window.displayWindow = new class extends Display {
constructor() {
super($('#spinner'), $('#content'));
- $('#search').click(this.onSearch.bind(this));
- window.wanakana.bind($('#query').get(0));
+
+ const search = $('#search');
+ search.click(this.onSearch.bind(this));
+
+ const query = $('#query');
+ query.on('input', () => search.prop('disabled', query.val().length === 0));
+ window.wanakana.bind(query.get(0));
}
definitionAdd(definition, mode) {
@@ -44,6 +49,10 @@ window.displayWindow = new class extends Display {
window.alert(`Error: ${error}`);
}
+ clearSearch() {
+ $('#query').focus().select();
+ }
+
onSearch(e) {
e.preventDefault();
$('#intro').slideUp();