From ad313fd1825ed1b077ad9a59af9423e93032ce44 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sat, 18 Mar 2017 17:53:21 -0700 Subject: polish --- tmpl/kanji.html | 1 + 1 file changed, 1 insertion(+) (limited to 'tmpl/kanji.html') diff --git a/tmpl/kanji.html b/tmpl/kanji.html index 4bb524cf..3cc7f966 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -1,6 +1,7 @@ {{#*inline "kanji"}}
+ {{#if addable}} {{/if}} -- cgit v1.2.3 From 6d55767191f50bceef86bf78df7d340f9c5971c7 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sat, 18 Mar 2017 18:21:02 -0700 Subject: wip --- ext/bg/js/templates.js | 12 ++++++------ ext/fg/frame.html | 12 +++++++----- ext/mixed/js/display.js | 4 ++++ tmpl/kanji.html | 6 +++--- tmpl/terms.html | 8 ++++---- 5 files changed, 24 insertions(+), 18 deletions(-) (limited to 'tmpl/kanji.html') diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index 333147ba..f267da80 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -284,7 +284,7 @@ templates['fields.html'] = template({"1":function(container,depth0,helpers,parti templates['kanji.html'] = template({"1":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : {}; - return "
\n
\n \n" + return "
\n
\n \n" + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.addable : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.source : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
\n\n
" @@ -299,9 +299,9 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(11, data, 0),"inverse":container.program(15, data, 0),"data":data})) != null ? stack1 : "") + "
\n
\n"; },"2":function(container,depth0,helpers,partials,data) { - return " \n"; + return " \n"; },"4":function(container,depth0,helpers,partials,data) { - return " \n"; + return " \n"; },"6":function(container,depth0,helpers,partials,data) { var stack1; @@ -442,7 +442,7 @@ templates['terms.html'] = template({"1":function(container,depth0,helpers,partia },"12":function(container,depth0,helpers,partials,data) { var stack1, alias1=depth0 != null ? depth0 : {}; - return "
\n
\n \n" + return "
\n
\n \n" + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.addable : depth0),{"name":"if","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.playback : depth0),{"name":"if","hash":{},"fn":container.program(15, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
\n\n" @@ -453,9 +453,9 @@ templates['terms.html'] = template({"1":function(container,depth0,helpers,partia + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.grouped : depth0),{"name":"if","hash":{},"fn":container.program(26, data, 0),"inverse":container.program(32, data, 0),"data":data})) != null ? stack1 : "") + "
\n
\n"; },"13":function(container,depth0,helpers,partials,data) { - return " \n \n"; + return " \n \n"; },"15":function(container,depth0,helpers,partials,data) { - return " \n"; + return " \n"; },"17":function(container,depth0,helpers,partials,data) { var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", buffer = "
"; diff --git a/ext/fg/frame.html b/ext/fg/frame.html index c593db8d..09d1689e 100644 --- a/ext/fg/frame.html +++ b/ext/fg/frame.html @@ -21,11 +21,13 @@
-

Yomichan Updated!

-

- The Yomichan extension has been updated to a new version! In order to continue - viewing definitions on this page you must reload this tab or restart your browser. -

+
+

Yomichan Updated!

+

+ The Yomichan extension has been updated to a new version! In order to continue + viewing definitions on this page you must reload this tab or restart your browser. +

+
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 2ceef282..707d70ee 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -236,6 +236,10 @@ class Display { 220: /* \ */ () => { this.audioPlay(this.definitions[this.index]); + }, + + 8: /* backspace */ () => { + } }; diff --git a/tmpl/kanji.html b/tmpl/kanji.html index 3cc7f966..be5e8541 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -1,12 +1,12 @@ {{#*inline "kanji"}}
- + {{#if addable}} - + {{/if}} {{#if source}} - + {{/if}}
diff --git a/tmpl/terms.html b/tmpl/terms.html index 6212cb21..f108da26 100644 --- a/tmpl/terms.html +++ b/tmpl/terms.html @@ -20,13 +20,13 @@ {{#*inline "term"}}
- + {{#if addable}} - - + + {{/if}} {{#if playback}} - + {{/if}}
-- cgit v1.2.3 From 9d31801b73ad3f2a273f20aecda0e7157c481d46 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sat, 25 Mar 2017 18:08:42 -0700 Subject: more hotkey work --- ext/bg/js/templates.js | 12 ++++++------ ext/mixed/js/display.js | 29 ++++++++++++++++++----------- tmpl/kanji.html | 8 ++++---- tmpl/terms.html | 10 +++++----- 4 files changed, 33 insertions(+), 26 deletions(-) (limited to 'tmpl/kanji.html') diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index f267da80..1afe124f 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -284,7 +284,7 @@ templates['fields.html'] = template({"1":function(container,depth0,helpers,parti templates['kanji.html'] = template({"1":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : {}; - return "
\n
\n \n" + return "
\n
\n \n" + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.addable : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.source : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
\n\n
" @@ -299,9 +299,9 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(11, data, 0),"inverse":container.program(15, data, 0),"data":data})) != null ? stack1 : "") + "
\n
\n"; },"2":function(container,depth0,helpers,partials,data) { - return " \n"; + return " \n"; },"4":function(container,depth0,helpers,partials,data) { - return " \n"; + return " \n"; },"6":function(container,depth0,helpers,partials,data) { var stack1; @@ -442,7 +442,7 @@ templates['terms.html'] = template({"1":function(container,depth0,helpers,partia },"12":function(container,depth0,helpers,partials,data) { var stack1, alias1=depth0 != null ? depth0 : {}; - return "
\n
\n \n" + return "
\n
\n \n" + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.addable : depth0),{"name":"if","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.playback : depth0),{"name":"if","hash":{},"fn":container.program(15, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
\n\n" @@ -453,9 +453,9 @@ templates['terms.html'] = template({"1":function(container,depth0,helpers,partia + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.grouped : depth0),{"name":"if","hash":{},"fn":container.program(26, data, 0),"inverse":container.program(32, data, 0),"data":data})) != null ? stack1 : "") + "
\n
\n"; },"13":function(container,depth0,helpers,partials,data) { - return " \n \n"; + return " \n \n"; },"15":function(container,depth0,helpers,partials,data) { - return " \n"; + return " \n"; },"17":function(container,depth0,helpers,partials,data) { var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", buffer = "
"; diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 639c2673..1b629dec 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -164,16 +164,7 @@ class Display { onSourceTerm(e) { e.preventDefault(); - - if (this.context && this.context.source) { - const context = { - url: this.context.source.url, - sentence: this.context.source.sentence, - index: this.context.source.index - }; - - this.showTermDefs(this.context.source.definitions, this.options, context); - } + this.sourceBack(); } onKanjiLookup(e) { @@ -247,6 +238,10 @@ class Display { this.entryScroll(this.index + 1, true); }, + 66: /* b */ () => { + this.sourceBack(); + }, + 69: /* e */ () => { noteTryAdd('term-kanji'); }, @@ -260,7 +255,7 @@ class Display { }, 80: /* p */ () => { - if (Display.adderButtonFind(this.index, 'kanji').length === 0) { + if ($('.entry').eq(this.index).data('type') === 'term') { this.audioPlay(this.definitions[this.index]); } } @@ -273,6 +268,18 @@ class Display { } } + sourceBack() { + if (this.context && this.context.source) { + const context = { + url: this.context.source.url, + sentence: this.context.source.sentence, + index: this.context.source.index + }; + + this.showTermDefs(this.context.source.definitions, this.options, context); + } + } + noteAdd(definition, mode) { this.spinner.show(); return this.definitionAdd(definition, mode).then(success => { diff --git a/tmpl/kanji.html b/tmpl/kanji.html index be5e8541..7a2df8db 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -1,12 +1,12 @@ {{#*inline "kanji"}} -
+
- + {{#if addable}} - + {{/if}} {{#if source}} - + {{/if}}
diff --git a/tmpl/terms.html b/tmpl/terms.html index f108da26..83b16106 100644 --- a/tmpl/terms.html +++ b/tmpl/terms.html @@ -18,15 +18,15 @@ {{/inline}} {{#*inline "term"}} -
+
- + {{#if addable}} - - + + {{/if}} {{#if playback}} - + {{/if}}
-- cgit v1.2.3 From 063f3d4dbf8c896f4f7b022cfae6e2b907769251 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sat, 25 Mar 2017 18:18:31 -0700 Subject: version bump, finishing up keyboard shortcuts --- ext/bg/js/templates.js | 4 ++-- ext/bg/popup.html | 6 ++--- ext/manifest.json | 2 +- ext/mixed/js/display.js | 62 ++++++++++++++++++++++++++++++++++++++----------- tmpl/kanji.html | 2 +- tmpl/terms.html | 2 +- 6 files changed, 56 insertions(+), 22 deletions(-) (limited to 'tmpl/kanji.html') diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index 1afe124f..0346e4c7 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -284,7 +284,7 @@ templates['fields.html'] = template({"1":function(container,depth0,helpers,parti templates['kanji.html'] = template({"1":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : {}; - return "
\n
\n \n" + return "
\n
\n \n" + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.addable : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.source : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
\n\n
" @@ -442,7 +442,7 @@ templates['terms.html'] = template({"1":function(container,depth0,helpers,partia },"12":function(container,depth0,helpers,partials,data) { var stack1, alias1=depth0 != null ? depth0 : {}; - return "
\n
\n \n" + return "
\n
\n \n" + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.addable : depth0),{"name":"if","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.playback : depth0),{"name":"if","hash":{},"fn":container.program(15, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
\n\n" diff --git a/ext/bg/popup.html b/ext/bg/popup.html index 22fc0d40..e223e241 100644 --- a/ext/bg/popup.html +++ b/ext/bg/popup.html @@ -18,12 +18,12 @@

- +

- - + +

diff --git a/ext/manifest.json b/ext/manifest.json index e759c4dc..ae7cf8e3 100644 --- a/ext/manifest.json +++ b/ext/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Yomichan", - "version": "1.1.7", + "version": "1.1.8", "description": "Japanese dictionary with Anki integration", "icons": {"16": "mixed/img/icon16.png", "48": "mixed/img/icon48.png", "128": "mixed/img/icon128.png"}, diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 1b629dec..db14a43c 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -212,59 +212,93 @@ class Display { const handlers = { 27: /* escape */ () => { this.clearSearch(); + return true; }, 33: /* page up */ () => { - this.entryScroll(this.index - 3, true); + if (e.altKey) { + this.entryScroll(this.index - 3, true); + return true; + } }, 34: /* page down */ () => { - this.entryScroll(this.index + 3, true); + if (e.altKey) { + this.entryScroll(this.index + 3, true); + return true; + } }, 35: /* end */ () => { - this.entryScroll(this.definitions.length - 1, true); + if (e.altKey) { + this.entryScroll(this.definitions.length - 1, true); + return true; + } }, 36: /* home */ () => { - this.entryScroll(0, true); + if (e.altKey) { + this.entryScroll(0, true); + return true; + } }, 38: /* up */ () => { - this.entryScroll(this.index - 1, true); + if (e.altKey) { + this.entryScroll(this.index - 1, true); + return true; + } }, 40: /* down */ () => { - this.entryScroll(this.index + 1, true); + if (e.altKey) { + this.entryScroll(this.index + 1, true); + return true; + } }, 66: /* b */ () => { - this.sourceBack(); + if (e.altKey) { + this.sourceBack(); + return true; + } }, 69: /* e */ () => { - noteTryAdd('term-kanji'); + if (e.altKey) { + noteTryAdd('term-kanji'); + return true; + } }, 75: /* k */ () => { - noteTryAdd('kanji'); + if (e.altKey) { + noteTryAdd('kanji'); + return true; + } }, 82: /* r */ () => { - noteTryAdd('term-kana'); + if (e.altKey) { + noteTryAdd('term-kana'); + return true; + } }, 80: /* p */ () => { - if ($('.entry').eq(this.index).data('type') === 'term') { - this.audioPlay(this.definitions[this.index]); + if (e.altKey) { + if ($('.entry').eq(this.index).data('type') === 'term') { + this.audioPlay(this.definitions[this.index]); + } + + return true; } } }; const handler = handlers[e.keyCode]; - if (handler && (e.altKey || !['e', 'k', 'p'].includes(e.keyCode))) { + if (handler && handler()) { e.preventDefault(); - handler(); } } diff --git a/tmpl/kanji.html b/tmpl/kanji.html index 7a2df8db..acd79036 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -1,7 +1,7 @@ {{#*inline "kanji"}}
- + {{#if addable}} {{/if}} diff --git a/tmpl/terms.html b/tmpl/terms.html index 83b16106..dc50efe2 100644 --- a/tmpl/terms.html +++ b/tmpl/terms.html @@ -20,7 +20,7 @@ {{#*inline "term"}}
- + {{#if addable}} -- cgit v1.2.3