aboutsummaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
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>