From 2644f2f8ff62592db8f509660af8822ea1376071 Mon Sep 17 00:00:00 2001 From: Kuuuube <61125188+Kuuuube@users.noreply.github.com> Date: Sun, 28 Jul 2024 00:19:50 -0400 Subject: [PATCH 1/4] Fix note generator audio (#1278) * Log error instead of ignoring when unknown error found in audio download * Add languagesummary to anki note generator --- ext/js/background/backend.js | 1 + ext/js/pages/settings/anki-deck-generator-controller.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js index 96e8206bee..5617941b62 100644 --- a/ext/js/background/backend.js +++ b/ext/js/background/backend.js @@ -2187,6 +2187,7 @@ export class Backend { const error = this._getAudioDownloadError(e); if (error !== null) { throw error; } // No audio + log.error(e); return null; } diff --git a/ext/js/pages/settings/anki-deck-generator-controller.js b/ext/js/pages/settings/anki-deck-generator-controller.js index 1a65d80f9a..8db12d9300 100644 --- a/ext/js/pages/settings/anki-deck-generator-controller.js +++ b/ext/js/pages/settings/anki-deck-generator-controller.js @@ -21,6 +21,7 @@ import {toError} from '../../core/to-error.js'; import {AnkiNoteBuilder} from '../../data/anki-note-builder.js'; import {getDynamicTemplates} from '../../data/anki-template-util.js'; import {querySelectorNotNull} from '../../dom/query-selector.js'; +import {getLanguageSummaries} from '../../language/languages.js'; import {TemplateRendererProxy} from '../../templates/template-renderer-proxy.js'; export class AnkiDeckGeneratorController { @@ -443,7 +444,8 @@ export class AnkiDeckGeneratorController { } } const idleTimeout = (Number.isFinite(options.anki.downloadTimeout) && options.anki.downloadTimeout > 0 ? options.anki.downloadTimeout : null); - const mediaOptions = addMedia ? {audio: {sources: options.audio.sources, preferredAudioIndex: null, idleTimeout: idleTimeout}} : null; + const languageSummary = getLanguageSummaries().find(({iso}) => iso === options.general.language); + const mediaOptions = addMedia ? {audio: {sources: options.audio.sources, preferredAudioIndex: null, idleTimeout: idleTimeout, languageSummary: languageSummary}} : null; const requirements = addMedia ? [...this._getDictionaryEntryMedia(dictionaryEntry), {type: 'audio'}] : []; const dictionaryStylesMap = this._ankiNoteBuilder.getDictionaryStylesMap(options.dictionaries); const {note} = await this._ankiNoteBuilder.createNote(/** @type {import('anki-note-builder').CreateNoteDetails} */ ({ From 0288b24feec4209af69f6dde548cf816cd2b5add Mon Sep 17 00:00:00 2001 From: Kuuuube <61125188+Kuuuube@users.noreply.github.com> Date: Sun, 28 Jul 2024 15:02:20 -0400 Subject: [PATCH 2/4] Move search parser option under settings modal (#1281) * Move search parser option under settings modal * Remove unused css --- ext/css/search.css | 14 -------------- ext/search.html | 15 +++++++++++---- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/ext/css/search.css b/ext/css/search.css index 455799ce9e..81e4a74c78 100644 --- a/ext/css/search.css +++ b/ext/css/search.css @@ -174,20 +174,6 @@ h1 { .search-option-label { padding-left: 0.5em; } -.search-option-pre-label { - padding-right: 0.5em; -} -#query-parser-mode-container { - flex: 1 1 auto; -} -#query-parser-mode-container:not([hidden]) { - display: flex; -} -#query-parser-mode-select { - flex: 1 1 auto; - max-width: 220px; - min-width: 100px; -} /* Search styles */ #intro { diff --git a/ext/search.html b/ext/search.html index 6bc6024ed4..958b8a2858 100644 --- a/ext/search.html +++ b/ext/search.html @@ -44,10 +44,6 @@

Yomitan Search

Clipboard monitor -
@@ -102,6 +98,17 @@

Yomitan Search

-
+
Show debug information
A menu option to log debugging information will be shown in the search results.
@@ -2512,7 +2521,7 @@

Yomitan Settings