version bump, finishing up keyboard shortcuts

This commit is contained in:
Alex Yatskov 2017-03-25 18:18:31 -07:00
parent 9d31801b73
commit 063f3d4dbf
6 changed files with 56 additions and 22 deletions

View File

@ -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) { templates['kanji.html'] = template({"1":function(container,depth0,helpers,partials,data) {
var stack1, helper, alias1=depth0 != null ? depth0 : {}; var stack1, helper, alias1=depth0 != null ? depth0 : {};
return "<div class=\"entry\" data-type=\"kanji\">\n <div class=\"actions\">\n <img src=\"/mixed/img/entry-current.png\" class=\"current\" title=\"Current entry (Up/Down/Home/End/PgUp/PgDn)\" alt>\n" return "<div class=\"entry\" data-type=\"kanji\">\n <div class=\"actions\">\n <img src=\"/mixed/img/entry-current.png\" class=\"current\" title=\"Current entry (Alt + Up/Down/Home/End/PgUp/PgDn)\" alt>\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.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 : "") + ((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 : "")
+ " </div>\n\n <div class=\"glyph\">" + " </div>\n\n <div class=\"glyph\">"
@ -442,7 +442,7 @@ templates['terms.html'] = template({"1":function(container,depth0,helpers,partia
},"12":function(container,depth0,helpers,partials,data) { },"12":function(container,depth0,helpers,partials,data) {
var stack1, alias1=depth0 != null ? depth0 : {}; var stack1, alias1=depth0 != null ? depth0 : {};
return "<div class=\"entry\" data-type=\"term\">\n <div class=\"actions\">\n <img src=\"/mixed/img/entry-current.png\" class=\"current\" title=\"Current entry (Up/Down/Home/End/PgUp/PgDn)\" alt>\n" return "<div class=\"entry\" data-type=\"term\">\n <div class=\"actions\">\n <img src=\"/mixed/img/entry-current.png\" class=\"current\" title=\"Current entry (Alt + Up/Down/Home/End/PgUp/PgDn)\" alt>\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.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 : "") + ((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 : "")
+ " </div>\n\n" + " </div>\n\n"

View File

@ -18,12 +18,12 @@
</head> </head>
<body> <body>
<p> <p>
<input type="checkbox" id="enable-search"> <input type="checkbox" id="enable-search" title="Toggle (Alt + Delete)">
</p> </p>
<p> <p>
<div class="btn-group" style="white-space: nowrap"> <div class="btn-group" style="white-space: nowrap">
<button type="button" id="open-search" title="Search" class="btn btn-default btn-xs glyphicon glyphicon-search"></button> <button type="button" id="open-search" title="Search (Alt + Insert)" class="btn btn-default btn-xs glyphicon glyphicon-search"></button>
<button type="button" id="open-options" title="Options" class="btn btn-default btn-xs glyphicon glyphicon-wrench"></button> <button type="button" id="open-options" title="Options (Alt + End)" class="btn btn-default btn-xs glyphicon glyphicon-wrench"></button>
<button type="button" id="open-help" title="Help" class="btn btn-default btn-xs glyphicon glyphicon-question-sign"></button> <button type="button" id="open-help" title="Help" class="btn btn-default btn-xs glyphicon glyphicon-question-sign"></button>
</div> </div>
</p> </p>

View File

@ -1,7 +1,7 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "Yomichan", "name": "Yomichan",
"version": "1.1.7", "version": "1.1.8",
"description": "Japanese dictionary with Anki integration", "description": "Japanese dictionary with Anki integration",
"icons": {"16": "mixed/img/icon16.png", "48": "mixed/img/icon48.png", "128": "mixed/img/icon128.png"}, "icons": {"16": "mixed/img/icon16.png", "48": "mixed/img/icon48.png", "128": "mixed/img/icon128.png"},

View File

@ -212,59 +212,93 @@ class Display {
const handlers = { const handlers = {
27: /* escape */ () => { 27: /* escape */ () => {
this.clearSearch(); this.clearSearch();
return true;
}, },
33: /* page up */ () => { 33: /* page up */ () => {
if (e.altKey) {
this.entryScroll(this.index - 3, true); this.entryScroll(this.index - 3, true);
return true;
}
}, },
34: /* page down */ () => { 34: /* page down */ () => {
if (e.altKey) {
this.entryScroll(this.index + 3, true); this.entryScroll(this.index + 3, true);
return true;
}
}, },
35: /* end */ () => { 35: /* end */ () => {
if (e.altKey) {
this.entryScroll(this.definitions.length - 1, true); this.entryScroll(this.definitions.length - 1, true);
return true;
}
}, },
36: /* home */ () => { 36: /* home */ () => {
if (e.altKey) {
this.entryScroll(0, true); this.entryScroll(0, true);
return true;
}
}, },
38: /* up */ () => { 38: /* up */ () => {
if (e.altKey) {
this.entryScroll(this.index - 1, true); this.entryScroll(this.index - 1, true);
return true;
}
}, },
40: /* down */ () => { 40: /* down */ () => {
if (e.altKey) {
this.entryScroll(this.index + 1, true); this.entryScroll(this.index + 1, true);
return true;
}
}, },
66: /* b */ () => { 66: /* b */ () => {
if (e.altKey) {
this.sourceBack(); this.sourceBack();
return true;
}
}, },
69: /* e */ () => { 69: /* e */ () => {
if (e.altKey) {
noteTryAdd('term-kanji'); noteTryAdd('term-kanji');
return true;
}
}, },
75: /* k */ () => { 75: /* k */ () => {
if (e.altKey) {
noteTryAdd('kanji'); noteTryAdd('kanji');
return true;
}
}, },
82: /* r */ () => { 82: /* r */ () => {
if (e.altKey) {
noteTryAdd('term-kana'); noteTryAdd('term-kana');
return true;
}
}, },
80: /* p */ () => { 80: /* p */ () => {
if (e.altKey) {
if ($('.entry').eq(this.index).data('type') === 'term') { if ($('.entry').eq(this.index).data('type') === 'term') {
this.audioPlay(this.definitions[this.index]); this.audioPlay(this.definitions[this.index]);
} }
return true;
}
} }
}; };
const handler = handlers[e.keyCode]; const handler = handlers[e.keyCode];
if (handler && (e.altKey || !['e', 'k', 'p'].includes(e.keyCode))) { if (handler && handler()) {
e.preventDefault(); e.preventDefault();
handler();
} }
} }

View File

@ -1,7 +1,7 @@
{{#*inline "kanji"}} {{#*inline "kanji"}}
<div class="entry" data-type="kanji"> <div class="entry" data-type="kanji">
<div class="actions"> <div class="actions">
<img src="/mixed/img/entry-current.png" class="current" title="Current entry (Up/Down/Home/End/PgUp/PgDn)" alt> <img src="/mixed/img/entry-current.png" class="current" title="Current entry (Alt + Up/Down/Home/End/PgUp/PgDn)" alt>
{{#if addable}} {{#if addable}}
<a href="#" class="action-add-note pending disabled" data-mode="kanji"><img src="/mixed/img/add-kanji.png" title="Add Kanji (Alt + K)" alt></a> <a href="#" class="action-add-note pending disabled" data-mode="kanji"><img src="/mixed/img/add-kanji.png" title="Add Kanji (Alt + K)" alt></a>
{{/if}} {{/if}}

View File

@ -20,7 +20,7 @@
{{#*inline "term"}} {{#*inline "term"}}
<div class="entry" data-type="term"> <div class="entry" data-type="term">
<div class="actions"> <div class="actions">
<img src="/mixed/img/entry-current.png" class="current" title="Current entry (Up/Down/Home/End/PgUp/PgDn)" alt> <img src="/mixed/img/entry-current.png" class="current" title="Current entry (Alt + Up/Down/Home/End/PgUp/PgDn)" alt>
{{#if addable}} {{#if addable}}
<a href="#" class="action-add-note pending disabled" data-mode="term-kanji"><img src="/mixed/img/add-term-kanji.png" title="Add expression (Alt + E)" alt></a> <a href="#" class="action-add-note pending disabled" data-mode="term-kanji"><img src="/mixed/img/add-term-kanji.png" title="Add expression (Alt + E)" alt></a>
<a href="#" class="action-add-note pending disabled" data-mode="term-kana"><img src="/mixed/img/add-term-kana.png" title="Add reading (Alt + R)" alt></a> <a href="#" class="action-add-note pending disabled" data-mode="term-kana"><img src="/mixed/img/add-term-kana.png" title="Add reading (Alt + R)" alt></a>