Improvements
This commit is contained in:
parent
8c1ebe6bcb
commit
9b9985bd4b
@ -23,13 +23,13 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia
|
|||||||
},"2":function(container,depth0,helpers,partials,data,blockParams,depths) {
|
},"2":function(container,depth0,helpers,partials,data,blockParams,depths) {
|
||||||
var helper, alias1=container.lambda, alias2=container.escapeExpression;
|
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))
|
+ alias2(alias1((depths[1] != null ? depths[1].sequence : depths[1]), depth0))
|
||||||
+ "\" data-mode=\"kanji\" data-index=\""
|
+ "\" 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)))
|
+ 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=\""
|
+ "\"><img src=\""
|
||||||
+ alias2(alias1((depths[1] != null ? depths[1].root : depths[1]), depth0))
|
+ 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) {
|
},"4":function(container,depth0,helpers,partials,data) {
|
||||||
var stack1;
|
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) {
|
},"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";
|
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))
|
+ alias2(alias1((depths[1] != null ? depths[1].sequence : depths[1]), depth0))
|
||||||
+ "\" data-mode=\"vocabExp\" data-index=\""
|
+ "\" 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)))
|
+ 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=\""
|
+ "\"><img src=\""
|
||||||
+ alias2(alias1((depths[1] != null ? depths[1].root : depths[1]), depth0))
|
+ 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))
|
+ alias2(alias1((depths[1] != null ? depths[1].sequence : depths[1]), depth0))
|
||||||
+ "\" data-mode=\"vocabReading\" data-index=\""
|
+ "\" 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)))
|
+ alias2(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : alias4),(typeof helper === alias5 ? helper.call(alias3,{"name":"index","hash":{},"data":data}) : helper)))
|
||||||
|
@ -51,7 +51,7 @@ class Yomichan {
|
|||||||
|
|
||||||
onMessage(request, sender, callback) {
|
onMessage(request, sender, callback) {
|
||||||
const {action, params} = request, handlers = {
|
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)),
|
findKanji: (text) => callback(this.translator.findKanji(text)),
|
||||||
findTerm: (text) => callback(this.translator.findTerm(text)),
|
findTerm: (text) => callback(this.translator.findTerm(text)),
|
||||||
getOptions: () => callback(this.options),
|
getOptions: () => callback(this.options),
|
||||||
|
@ -45,6 +45,6 @@ function bgGetState(callback) {
|
|||||||
bgSendMessage('getState', null, callback);
|
bgSendMessage('getState', null, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function bgCanAddNotes(definitions, callback) {
|
function bgCanAddNotes(definitions, modes, callback) {
|
||||||
bgSendMessage('canAddNotes', definitions, callback);
|
bgSendMessage('canAddNotes', {definitions, modes}, callback);
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ class Client {
|
|||||||
this.definitions = definitions;
|
this.definitions = definitions;
|
||||||
this.showPopup(range, content);
|
this.showPopup(range, content);
|
||||||
|
|
||||||
bgCanAddNotes(definitions, (states) => {
|
bgCanAddNotes(definitions, ['vocabExp', 'vocabReading'], (states) => {
|
||||||
if (states !== null) {
|
if (states !== null) {
|
||||||
states.forEach((state, index) => this.popup.sendMessage(
|
states.forEach((state, index) => this.popup.sendMessage(
|
||||||
'setActionState',
|
'setActionState',
|
||||||
@ -149,7 +149,7 @@ class Client {
|
|||||||
this.definitions = definitions;
|
this.definitions = definitions;
|
||||||
this.popup.setContent(content, definitions);
|
this.popup.setContent(content, definitions);
|
||||||
|
|
||||||
bgCanAddNotes(definitions, (states) => {
|
bgCanAddNotes(definitions, ['kanji'], (states) => {
|
||||||
if (states !== null) {
|
if (states !== null) {
|
||||||
states.forEach((state, index) => this.popup.sendMessage(
|
states.forEach((state, index) => this.popup.sendMessage(
|
||||||
'setActionState',
|
'setActionState',
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
<div class="kanji-definition">
|
<div class="kanji-definition">
|
||||||
{{#with options}}
|
{{#with options}}
|
||||||
{{#if enableAnkiConnect}}
|
{{#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}}
|
{{/if}}
|
||||||
{{/with}}
|
{{/with}}
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
{{#with options}}
|
{{#with options}}
|
||||||
{{#if enableAnkiConnect}}
|
{{#if enableAnkiConnect}}
|
||||||
<div class="action-bar">
|
<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 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 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 reading" class="action-link disabled" data-sequence="{{../sequence}}" data-mode="vocabReading" data-index="{{@index}}"><img src="{{../root}}/img/add_reading.png"></a>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/with}}
|
{{/with}}
|
||||||
|
Loading…
Reference in New Issue
Block a user