Merge branch 'master' into firefox-amo
This commit is contained in:
commit
d5b4b04998
10
README.md
10
README.md
@ -24,7 +24,7 @@ Yomichan provides advanced features not available in other browser-based diction
|
||||
|
||||
[![](https://foosoft.net/projects/yomichan/img/chrome-web-store.png)](https://chrome.google.com/webstore/detail/yomichan/ogmnaimimemjmbakcfefmnahgdfhfami)
|
||||
|
||||
* **Mozilla Firefox** (versions 51+)
|
||||
* **Mozilla Firefox** (versions 52+)
|
||||
|
||||
[![](https://foosoft.net/projects/yomichan/img/firefox-marketplace.png)](https://addons.mozilla.org/en-US/firefox/addon/yomichan/)
|
||||
|
||||
@ -39,7 +39,7 @@ different languages. You must download and import the dictionaries you wish to u
|
||||
definition lookups. If you have proprietary EPWING dictionaries that you would like to use, please see the [Yomichan
|
||||
Import](https://foosoft.net/projects/yomichan-import) page to learn how to convert and import them into Yomichan.
|
||||
|
||||
* **JMdict** (Japanese vocabulary)
|
||||
* **[JMdict](http://www.edrdg.org/enamdict/enamdict_doc.html)** (Japanese vocabulary)
|
||||
* [jmdict_dutch.zip](https://foosoft.net/projects/yomichan/dl/dict/jmdict_dutch.zip)
|
||||
* [jmdict_english.zip](https://foosoft.net/projects/yomichan/dl/dict/jmdict_english.zip)
|
||||
* [jmdict_french.zip](https://foosoft.net/projects/yomichan/dl/dict/jmdict_french.zip)
|
||||
@ -50,13 +50,15 @@ Import](https://foosoft.net/projects/yomichan-import) page to learn how to conve
|
||||
* [jmdict_slovenian.zip](https://foosoft.net/projects/yomichan/dl/dict/jmdict_slovenian.zip)
|
||||
* [jmdict_spanish.zip](https://foosoft.net/projects/yomichan/dl/dict/jmdict_spanish.zip)
|
||||
* [jmdict_swedish.zip](https://foosoft.net/projects/yomichan/dl/dict/jmdict_swedish.zip)
|
||||
* **JMnedict** (Japanese names)
|
||||
* **[JMnedict](http://www.edrdg.org/enamdict/enamdict_doc.html)** (Japanese names)
|
||||
* [jmnedict.zip](https://foosoft.net/projects/yomichan/dl/dict/jmnedict.zip)
|
||||
* **KANJIDIC** (Japanese Kanji)
|
||||
* **[KANJIDIC](http://nihongo.monash.edu/kanjidic2/index.html)** (Japanese Kanji)
|
||||
* [kanjidic_english.zip](https://foosoft.net/projects/yomichan/dl/dict/kanjidic_english.zip)
|
||||
* [kanjidic_french.zip](https://foosoft.net/projects/yomichan/dl/dict/kanjidic_french.zip)
|
||||
* [kanjidic_portuguese.zip](https://foosoft.net/projects/yomichan/dl/dict/kanjidic_portuguese.zip)
|
||||
* [kanjidic_spanish.zip](https://foosoft.net/projects/yomichan/dl/dict/kanjidic_spanish.zip)
|
||||
* **[KireiCake](https://kireicake.com/rikaicakes/)** (Japanese slang)
|
||||
* [kireicake.zip](https://foosoft.net/projects/yomichan/dl/dict/kireicake.zip)
|
||||
|
||||
## Basic Usage ##
|
||||
|
||||
|
@ -66,6 +66,9 @@ async function apiDefinitionAdd(definition, mode) {
|
||||
}
|
||||
|
||||
async function apiDefinitionsAddable(definitions, modes) {
|
||||
const states = [];
|
||||
|
||||
try {
|
||||
const notes = [];
|
||||
for (const definition of definitions) {
|
||||
for (const mode of modes) {
|
||||
@ -74,7 +77,6 @@ async function apiDefinitionsAddable(definitions, modes) {
|
||||
}
|
||||
|
||||
const results = await utilBackend().anki.canAddNotes(notes);
|
||||
const states = [];
|
||||
for (let resultBase = 0; resultBase < results.length; resultBase += modes.length) {
|
||||
const state = {};
|
||||
for (let modeOffset = 0; modeOffset < modes.length; ++modeOffset) {
|
||||
@ -83,6 +85,9 @@ async function apiDefinitionsAddable(definitions, modes) {
|
||||
|
||||
states.push(state);
|
||||
}
|
||||
} catch (e) {
|
||||
// NOP
|
||||
}
|
||||
|
||||
return states;
|
||||
}
|
||||
|
@ -223,10 +223,7 @@ function dictFieldFormat(field, definition, mode, options) {
|
||||
modeKanji: mode === 'kanji'
|
||||
};
|
||||
|
||||
field = field.replace(
|
||||
`{${marker}}`,
|
||||
handlebarsRender('fields.html', data)
|
||||
);
|
||||
field = field.replace(`{${marker}}`, handlebarsRender('fields.html', data));
|
||||
}
|
||||
|
||||
return field;
|
||||
|
@ -51,5 +51,5 @@ function handlebarsRender(template, data) {
|
||||
Handlebars.registerHelper('multiLine', handlebarsMultiLine);
|
||||
}
|
||||
|
||||
return Handlebars.templates[template](data);
|
||||
return Handlebars.templates[template](data).trim();
|
||||
}
|
||||
|
@ -331,11 +331,6 @@ function ankiFieldsToDict(selection) {
|
||||
|
||||
async function ankiDeckAndModelPopulate(options) {
|
||||
const ankiFormat = $('#anki-format').hide();
|
||||
const ankiTermsModel = $('#anki-terms-model').val(options.anki.terms.model);
|
||||
const ankiKanjiModel = $('#anki-kanji-model').val(options.anki.kanji.model);
|
||||
|
||||
$('#anki-terms-deck').val(options.anki.terms.deck);
|
||||
$('#anki-kanji-deck').val(options.anki.kanji.deck);
|
||||
|
||||
const deckNames = await utilAnkiGetDeckNames();
|
||||
const ankiDeck = $('.anki-deck');
|
||||
@ -347,8 +342,11 @@ async function ankiDeckAndModelPopulate(options) {
|
||||
ankiModel.find('option').remove();
|
||||
modelNames.sort().forEach(name => ankiModel.append($('<option/>', {value: name, text: name})));
|
||||
|
||||
await ankiFieldsPopulate(ankiTermsModel, options);
|
||||
await ankiFieldsPopulate(ankiKanjiModel, options);
|
||||
$('#anki-terms-deck').val(options.anki.terms.deck);
|
||||
await ankiFieldsPopulate($('#anki-terms-model').val(options.anki.terms.model), options);
|
||||
|
||||
$('#anki-kanji-deck').val(options.anki.kanji.deck);
|
||||
await ankiFieldsPopulate($('#anki-kanji-model').val(options.anki.kanji.model), options);
|
||||
|
||||
ankiFormat.show();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Yomichan",
|
||||
"version": "1.3.0",
|
||||
"version": "1.3.2",
|
||||
|
||||
"description": "Japanese dictionary with Anki integration",
|
||||
"icons": {"16": "mixed/img/icon16.png", "48": "mixed/img/icon48.png", "128": "mixed/img/icon128.png"},
|
||||
|
Loading…
Reference in New Issue
Block a user