aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/bg/js/templates.js8
-rw-r--r--ext/bg/js/yomichan.js2
-rw-r--r--ext/fg/js/api.js4
-rw-r--r--ext/fg/js/client.js4
-rw-r--r--util/tmpl/kanji.html4
-rw-r--r--util/tmpl/term.html4
6 files changed, 14 insertions, 12 deletions
diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js
index d0749d7b..1ed644a1 100644
--- a/ext/bg/js/templates.js
+++ b/ext/bg/js/templates.js
@@ -23,13 +23,13 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia
},"2":function(container,depth0,helpers,partials,data,blockParams,depths) {
var helper, alias1=container.lambda, alias2=container.escapeExpression;
- return " <a href=\"#\" title=\"Add Kanji\" class=\"action-link disabled\" data-sequence=\""
+ return " <div class=\"action-bar\">\n <a href=\"#\" title=\"Add Kanji\" class=\"action-link disabled\" data-sequence=\""
+ alias2(alias1((depths[1] != null ? depths[1].sequence : depths[1]), depth0))
+ "\" data-mode=\"kanji\" data-index=\""
+ alias2(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"index","hash":{},"data":data}) : helper)))
+ "\"><img src=\""
+ alias2(alias1((depths[1] != null ? depths[1].root : depths[1]), depth0))
- + "/add_kanji.png\"></a>\n";
+ + "/img/add_kanji.png\"></a>\n </div>\n";
},"4":function(container,depth0,helpers,partials,data) {
var stack1;
@@ -97,13 +97,13 @@ templates['term.html'] = template({"1":function(container,depth0,helpers,partial
},"2":function(container,depth0,helpers,partials,data,blockParams,depths) {
var helper, alias1=container.lambda, alias2=container.escapeExpression, alias3=depth0 != null ? depth0 : {}, alias4=helpers.helperMissing, alias5="function";
- return " <div class=\"action-bar\">\n <a href=\"#\" title=\"Add as expression\" class=\"action-link disabled\" data-sequence=\""
+ return " <div class=\"action-bar\">\n <a href=\"#\" title=\"Add term as expression\" class=\"action-link disabled\" data-sequence=\""
+ alias2(alias1((depths[1] != null ? depths[1].sequence : depths[1]), depth0))
+ "\" data-mode=\"vocabExp\" data-index=\""
+ alias2(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : alias4),(typeof helper === alias5 ? helper.call(alias3,{"name":"index","hash":{},"data":data}) : helper)))
+ "\"><img src=\""
+ alias2(alias1((depths[1] != null ? depths[1].root : depths[1]), depth0))
- + "/img/add_expression.png\"></a>\n <a href=\"#\" title=\"Add as reading\" class=\"action-link disabled\" data-sequence=\""
+ + "/img/add_expression.png\"></a>\n <a href=\"#\" title=\"Add term as reading\" class=\"action-link disabled\" data-sequence=\""
+ alias2(alias1((depths[1] != null ? depths[1].sequence : depths[1]), depth0))
+ "\" data-mode=\"vocabReading\" data-index=\""
+ alias2(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : alias4),(typeof helper === alias5 ? helper.call(alias3,{"name":"index","hash":{},"data":data}) : helper)))
diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js
index f1cda178..abbcefe4 100644
--- a/ext/bg/js/yomichan.js
+++ b/ext/bg/js/yomichan.js
@@ -51,7 +51,7 @@ class Yomichan {
onMessage(request, sender, callback) {
const {action, params} = request, handlers = {
- canAddNotes: (definitions) => this.ankiInvoke('canAddNotes', definitions, 'notes', callback),
+ canAddNotes: ({definitions, modes}) => this.ankiInvoke('canAddNotes', {definitions: definitions, modes: modes}, 'notes', callback),
findKanji: (text) => callback(this.translator.findKanji(text)),
findTerm: (text) => callback(this.translator.findTerm(text)),
getOptions: () => callback(this.options),
diff --git a/ext/fg/js/api.js b/ext/fg/js/api.js
index 9026c8d3..e13c1421 100644
--- a/ext/fg/js/api.js
+++ b/ext/fg/js/api.js
@@ -45,6 +45,6 @@ function bgGetState(callback) {
bgSendMessage('getState', null, callback);
}
-function bgCanAddNotes(definitions, callback) {
- bgSendMessage('canAddNotes', definitions, callback);
+function bgCanAddNotes(definitions, modes, callback) {
+ bgSendMessage('canAddNotes', {definitions, modes}, callback);
}
diff --git a/ext/fg/js/client.js b/ext/fg/js/client.js
index b4c1c2d4..4b34ef9a 100644
--- a/ext/fg/js/client.js
+++ b/ext/fg/js/client.js
@@ -115,7 +115,7 @@ class Client {
this.definitions = definitions;
this.showPopup(range, content);
- bgCanAddNotes(definitions, (states) => {
+ bgCanAddNotes(definitions, ['vocabExp', 'vocabReading'], (states) => {
if (states !== null) {
states.forEach((state, index) => this.popup.sendMessage(
'setActionState',
@@ -149,7 +149,7 @@ class Client {
this.definitions = definitions;
this.popup.setContent(content, definitions);
- bgCanAddNotes(definitions, (states) => {
+ bgCanAddNotes(definitions, ['kanji'], (states) => {
if (states !== null) {
states.forEach((state, index) => this.popup.sendMessage(
'setActionState',
diff --git a/util/tmpl/kanji.html b/util/tmpl/kanji.html
index 2b195577..7a5affb7 100644
--- a/util/tmpl/kanji.html
+++ b/util/tmpl/kanji.html
@@ -1,7 +1,9 @@
<div class="kanji-definition">
{{#with options}}
{{#if enableAnkiConnect}}
- <a href="#" title="Add Kanji" class="action-link disabled" data-sequence="{{../sequence}}" data-mode="kanji" data-index="{{@index}}"><img src="{{../root}}/add_kanji.png"></a>
+ <div class="action-bar">
+ <a href="#" title="Add Kanji" class="action-link disabled" data-sequence="{{../sequence}}" data-mode="kanji" data-index="{{@index}}"><img src="{{../root}}/img/add_kanji.png"></a>
+ </div>
{{/if}}
{{/with}}
diff --git a/util/tmpl/term.html b/util/tmpl/term.html
index 4d764f0a..216ccf0a 100644
--- a/util/tmpl/term.html
+++ b/util/tmpl/term.html
@@ -2,8 +2,8 @@
{{#with options}}
{{#if enableAnkiConnect}}
<div class="action-bar">
- <a href="#" title="Add as expression" class="action-link disabled" data-sequence="{{../sequence}}" data-mode="vocabExp" data-index="{{@index}}"><img src="{{../root}}/img/add_expression.png"></a>
- <a href="#" title="Add as reading" class="action-link disabled" data-sequence="{{../sequence}}" data-mode="vocabReading" data-index="{{@index}}"><img src="{{../root}}/img/add_reading.png"></a>
+ <a href="#" title="Add term as expression" class="action-link disabled" data-sequence="{{../sequence}}" data-mode="vocabExp" data-index="{{@index}}"><img src="{{../root}}/img/add_expression.png"></a>
+ <a href="#" title="Add term as reading" class="action-link disabled" data-sequence="{{../sequence}}" data-mode="vocabReading" data-index="{{@index}}"><img src="{{../root}}/img/add_reading.png"></a>
</div>
{{/if}}
{{/with}}