summaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-08-13 16:11:51 -0700
committerAlex Yatskov <alex@foosoft.net>2017-08-13 16:11:51 -0700
commitaac2a58b5f821c6f90c95bb19f3b0a755d5e1739 (patch)
treed6c4b503f6a8daeabfa15f757866ef18ef4c5c64 /ext/bg
parent7fbe2ddaf33bad05fb26aec759806e0f6ae250d2 (diff)
wip
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/background.html1
-rw-r--r--ext/bg/js/display-window.js14
-rw-r--r--ext/bg/search.html2
3 files changed, 9 insertions, 8 deletions
diff --git a/ext/bg/background.html b/ext/bg/background.html
index 40f37b11..fd3b7dd1 100644
--- a/ext/bg/background.html
+++ b/ext/bg/background.html
@@ -20,6 +20,7 @@
<script src="/bg/js/templates.js"></script>
<script src="/bg/js/translator.js"></script>
<script src="/bg/js/util.js"></script>
+ <script src="/bg/js/util.js"></script>
<script src="/mixed/js/audio.js"></script>
<script src="/mixed/js/japanese.js"></script>
<script src="/mixed/js/request.js"></script>
diff --git a/ext/bg/js/display-window.js b/ext/bg/js/display-window.js
index 52c0cafa..cbb96681 100644
--- a/ext/bg/js/display-window.js
+++ b/ext/bg/js/display-window.js
@@ -17,26 +17,26 @@
*/
-window.displayWindow = new class extends Display {
+window.yomichan_window = new class extends Display {
constructor() {
super($('#spinner'), $('#content'));
this.search = $('#search').click(this.onSearch.bind(this));
- this.query = $('#query').on('input', this.inputSearch.bind(this));
+ this.query = $('#query').on('input', this.onSearchInput.bind(this));
this.intro = $('#intro');
window.wanakana.bind(this.query.get(0));
}
- handleError(error) {
+ onError(error) {
window.alert(`Error: ${error}`);
}
- clearSearch() {
+ onSearchClear() {
this.query.focus().select();
}
- inputSearch() {
+ onSearchInput() {
this.search.prop('disabled', this.query.val().length === 0);
}
@@ -46,9 +46,9 @@ window.displayWindow = new class extends Display {
try {
this.intro.slideUp();
const {length, definitions} = await apiTermsFind(this.query.val());
- super.showTermDefs(definitions, await apiOptionsGet());
+ super.termsShow(definitions, await apiOptionsGet());
} catch (e) {
- this.handleError(e);
+ this.onError(e);
}
}
};
diff --git a/ext/bg/search.html b/ext/bg/search.html
index 655d7819..fe44d74e 100644
--- a/ext/bg/search.html
+++ b/ext/bg/search.html
@@ -40,10 +40,10 @@
<script src="/bg/js/dictionary.js"></script>
<script src="/bg/js/handlebars.js"></script>
<script src="/bg/js/templates.js"></script>
+ <script src="/bg/js/util.js"></script>
<script src="/mixed/js/audio.js"></script>
<script src="/mixed/js/display.js"></script>
<script src="/mixed/js/japanese.js"></script>
- <script src="/mixed/js/request.js"></script>
<script src="/bg/js/display-window.js"></script>
</body>