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
-
- Parser:
-
-
@@ -102,6 +98,17 @@ Yomitan Search
Search Settings
+
+
From e8b22c05bfeab40fbbe50dc5e7e00f6eeb587fb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Vukovi=C4=87?=
Date: Mon, 29 Jul 2024 06:33:25 +0200
Subject: [PATCH 3/4] [ja] deinflect -nya as -neba+ya (#1279)
* [ja] deinflect -nya as -neba+ya
* remove dupe
---
ext/js/language/ja/japanese-transforms.js | 32 +++++++++++------------
test/language/japanese-transforms.test.js | 16 ++++++++++++
2 files changed, 32 insertions(+), 16 deletions(-)
diff --git a/ext/js/language/ja/japanese-transforms.js b/ext/js/language/ja/japanese-transforms.js
index 42b4abc607..d42657a57f 100644
--- a/ext/js/language/ja/japanese-transforms.js
+++ b/ext/js/language/ja/japanese-transforms.js
@@ -801,22 +801,22 @@ export const japaneseTransforms = {
},
],
rules: [
- suffixInflection('ねば', 'る', [], ['v1']),
- suffixInflection('かねば', 'く', [], ['v5']),
- suffixInflection('がねば', 'ぐ', [], ['v5']),
- suffixInflection('さねば', 'す', [], ['v5']),
- suffixInflection('たねば', 'つ', [], ['v5']),
- suffixInflection('なねば', 'ぬ', [], ['v5']),
- suffixInflection('ばねば', 'ぶ', [], ['v5']),
- suffixInflection('まねば', 'む', [], ['v5']),
- suffixInflection('らねば', 'る', [], ['v5']),
- suffixInflection('わねば', 'う', [], ['v5']),
- suffixInflection('ぜねば', 'ずる', [], ['vz']),
- suffixInflection('せねば', 'する', [], ['vs']),
- suffixInflection('為ねば', '為る', [], ['vs']),
- suffixInflection('こねば', 'くる', [], ['vk']),
- suffixInflection('来ねば', '来る', [], ['vk']),
- suffixInflection('來ねば', '來る', [], ['vk']),
+ suffixInflection('ねば', 'る', ['-ba'], ['v1']),
+ suffixInflection('かねば', 'く', ['-ba'], ['v5']),
+ suffixInflection('がねば', 'ぐ', ['-ba'], ['v5']),
+ suffixInflection('さねば', 'す', ['-ba'], ['v5']),
+ suffixInflection('たねば', 'つ', ['-ba'], ['v5']),
+ suffixInflection('なねば', 'ぬ', ['-ba'], ['v5']),
+ suffixInflection('ばねば', 'ぶ', ['-ba'], ['v5']),
+ suffixInflection('まねば', 'む', ['-ba'], ['v5']),
+ suffixInflection('らねば', 'る', ['-ba'], ['v5']),
+ suffixInflection('わねば', 'う', ['-ba'], ['v5']),
+ suffixInflection('ぜねば', 'ずる', ['-ba'], ['vz']),
+ suffixInflection('せねば', 'する', ['-ba'], ['vs']),
+ suffixInflection('為ねば', '為る', ['-ba'], ['vs']),
+ suffixInflection('こねば', 'くる', ['-ba'], ['vk']),
+ suffixInflection('来ねば', '来る', ['-ba'], ['vk']),
+ suffixInflection('來ねば', '來る', ['-ba'], ['vk']),
],
},
'-ku': {
diff --git a/test/language/japanese-transforms.test.js b/test/language/japanese-transforms.test.js
index 7b390e1a97..fb1cbaf7c5 100644
--- a/test/language/japanese-transforms.test.js
+++ b/test/language/japanese-transforms.test.js
@@ -89,6 +89,7 @@ const tests = [
{term: '食べる', source: '食べん', rule: 'v1', reasons: ['-n']},
{term: '食べる', source: '食べざる', rule: 'v1', reasons: ['-zaru']},
{term: '食べる', source: '食べねば', rule: 'v1', reasons: ['-neba']},
+ {term: '食べる', source: '食べにゃ', rule: 'v1', reasons: ['-neba', '-ya']},
{term: '食べる', source: '食べ', rule: 'v1d', reasons: ['continuative']},
{term: '食べる', source: '食べましょう', rule: 'v1', reasons: ['-masu', 'volitional']},
{term: '食べる', source: '食べよう', rule: 'v1', reasons: ['volitional']},
@@ -145,6 +146,7 @@ const tests = [
{term: '買う', source: '買わん', rule: 'v5', reasons: ['-n']},
{term: '買う', source: '買わざる', rule: 'v5', reasons: ['-zaru']},
{term: '買う', source: '買わねば', rule: 'v5', reasons: ['-neba']},
+ {term: '買う', source: '買わにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
{term: '買う', source: '買い', rule: 'v5', reasons: ['continuative']},
{term: '買う', source: '買いましょう', rule: 'v5', reasons: ['-masu', 'volitional']},
{term: '買う', source: '買おう', rule: 'v5', reasons: ['volitional']},
@@ -201,6 +203,7 @@ const tests = [
{term: '行く', source: '行かん', rule: 'v5', reasons: ['-n']},
{term: '行く', source: '行かざる', rule: 'v5', reasons: ['-zaru']},
{term: '行く', source: '行かねば', rule: 'v5', reasons: ['-neba']},
+ {term: '行く', source: '行かにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
{term: '行く', source: '行き', rule: 'v5', reasons: ['continuative']},
{term: '行く', source: '行きましょう', rule: 'v5', reasons: ['-masu', 'volitional']},
{term: '行く', source: '行こう', rule: 'v5', reasons: ['volitional']},
@@ -257,6 +260,7 @@ const tests = [
{term: '泳ぐ', source: '泳がん', rule: 'v5', reasons: ['-n']},
{term: '泳ぐ', source: '泳がざる', rule: 'v5', reasons: ['-zaru']},
{term: '泳ぐ', source: '泳がねば', rule: 'v5', reasons: ['-neba']},
+ {term: '泳ぐ', source: '泳がにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
{term: '泳ぐ', source: '泳ぎ', rule: 'v5', reasons: ['continuative']},
{term: '泳ぐ', source: '泳ぎましょう', rule: 'v5', reasons: ['-masu', 'volitional']},
{term: '泳ぐ', source: '泳ごう', rule: 'v5', reasons: ['volitional']},
@@ -312,6 +316,7 @@ const tests = [
{term: '話す', source: '話さん', rule: 'v5', reasons: ['-n']},
{term: '話す', source: '話さざる', rule: 'v5', reasons: ['-zaru']},
{term: '話す', source: '話さねば', rule: 'v5', reasons: ['-neba']},
+ {term: '話す', source: '話さにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
{term: '話す', source: '話し', rule: 'v5', reasons: ['continuative']},
{term: '話す', source: '話しましょう', rule: 'v5', reasons: ['-masu', 'volitional']},
{term: '話す', source: '話そう', rule: 'v5', reasons: ['volitional']},
@@ -370,6 +375,7 @@ const tests = [
{term: '待つ', source: '待たん', rule: 'v5', reasons: ['-n']},
{term: '待つ', source: '待たざる', rule: 'v5', reasons: ['-zaru']},
{term: '待つ', source: '待たねば', rule: 'v5', reasons: ['-neba']},
+ {term: '待つ', source: '待たにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
{term: '待つ', source: '待ち', rule: 'v5', reasons: ['continuative']},
{term: '待つ', source: '待ちましょう', rule: 'v5', reasons: ['-masu', 'volitional']},
{term: '待つ', source: '待とう', rule: 'v5', reasons: ['volitional']},
@@ -426,6 +432,7 @@ const tests = [
{term: '死ぬ', source: '死なん', rule: 'v5', reasons: ['-n']},
{term: '死ぬ', source: '死なざる', rule: 'v5', reasons: ['-zaru']},
{term: '死ぬ', source: '死なねば', rule: 'v5', reasons: ['-neba']},
+ {term: '死ぬ', source: '死なにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
{term: '死ぬ', source: '死に', rule: 'v5', reasons: ['continuative']},
{term: '死ぬ', source: '死にましょう', rule: 'v5', reasons: ['-masu', 'volitional']},
{term: '死ぬ', source: '死のう', rule: 'v5', reasons: ['volitional']},
@@ -481,6 +488,7 @@ const tests = [
{term: '遊ぶ', source: '遊ばん', rule: 'v5', reasons: ['-n']},
{term: '遊ぶ', source: '遊ばざる', rule: 'v5', reasons: ['-zaru']},
{term: '遊ぶ', source: '遊ばねば', rule: 'v5', reasons: ['-neba']},
+ {term: '遊ぶ', source: '遊ばにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
{term: '遊ぶ', source: '遊び', rule: 'v5', reasons: ['continuative']},
{term: '遊ぶ', source: '遊びましょう', rule: 'v5', reasons: ['-masu', 'volitional']},
{term: '遊ぶ', source: '遊ぼう', rule: 'v5', reasons: ['volitional']},
@@ -536,6 +544,7 @@ const tests = [
{term: '飲む', source: '飲まん', rule: 'v5', reasons: ['-n']},
{term: '飲む', source: '飲まざる', rule: 'v5', reasons: ['-zaru']},
{term: '飲む', source: '飲まねば', rule: 'v5', reasons: ['-neba']},
+ {term: '飲む', source: '飲まにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
{term: '飲む', source: '飲み', rule: 'v5', reasons: ['continuative']},
{term: '飲む', source: '飲みましょう', rule: 'v5', reasons: ['-masu', 'volitional']},
{term: '飲む', source: '飲もう', rule: 'v5', reasons: ['volitional']},
@@ -591,6 +600,7 @@ const tests = [
{term: '作る', source: '作らん', rule: 'v5', reasons: ['-n']},
{term: '作る', source: '作らざる', rule: 'v5', reasons: ['-zaru']},
{term: '作る', source: '作らねば', rule: 'v5', reasons: ['-neba']},
+ {term: '作る', source: '作らにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
{term: '作る', source: '作り', rule: 'v5', reasons: ['continuative']},
{term: '作る', source: '作りましょう', rule: 'v5', reasons: ['-masu', 'volitional']},
{term: '作る', source: '作ろう', rule: 'v5', reasons: ['volitional']},
@@ -651,6 +661,7 @@ const tests = [
{term: '為る', source: '為ん', rule: 'vs', reasons: ['-n']},
{term: '為る', source: '為ざる', rule: 'vs', reasons: ['-zaru']},
{term: '為る', source: '為ねば', rule: 'vs', reasons: ['-neba']},
+ {term: '為る', source: '為にゃ', rule: 'vs', reasons: ['-neba', '-ya']},
// ['continuative']
{term: '為る', source: '為ましょう', rule: 'vs', reasons: ['-masu', 'volitional']},
{term: '為る', source: '為よう', rule: 'vs', reasons: ['volitional']},
@@ -708,6 +719,7 @@ const tests = [
{term: 'する', source: 'せん', rule: 'vs', reasons: ['-n']},
{term: 'する', source: 'せざる', rule: 'vs', reasons: ['-zaru']},
{term: 'する', source: 'せねば', rule: 'vs', reasons: ['-neba']},
+ {term: 'する', source: 'せにゃ', rule: 'vs', reasons: ['-neba', '-ya']},
{term: 'する', source: 'し', rule: 'vs', reasons: ['continuative']},
{term: 'する', source: 'しましょう', rule: 'vs', reasons: ['-masu', 'volitional']},
{term: 'する', source: 'しよう', rule: 'vs', reasons: ['volitional']},
@@ -760,6 +772,7 @@ const tests = [
{term: '来る', source: '来ん', rule: 'vk', reasons: ['-n']},
{term: '来る', source: '来ざる', rule: 'vk', reasons: ['-zaru']},
{term: '来る', source: '来ねば', rule: 'vk', reasons: ['-neba']},
+ {term: '来る', source: '来にゃ', rule: 'vk', reasons: ['-neba', '-ya']},
{term: '来る', source: '来', rule: 'vk', reasons: ['continuative']},
{term: '来る', source: '来ましょう', rule: 'vk', reasons: ['-masu', 'volitional']},
{term: '来る', source: '来よう', rule: 'vk', reasons: ['volitional']},
@@ -811,6 +824,7 @@ const tests = [
{term: '來る', source: '來ん', rule: 'vk', reasons: ['-n']},
{term: '來る', source: '來ざる', rule: 'vk', reasons: ['-zaru']},
{term: '來る', source: '來ねば', rule: 'vk', reasons: ['-neba']},
+ {term: '來る', source: '來にゃ', rule: 'vk', reasons: ['-neba', '-ya']},
{term: '來る', source: '來', rule: 'vk', reasons: ['continuative']},
{term: '來る', source: '來ましょう', rule: 'vk', reasons: ['-masu', 'volitional']},
{term: '來る', source: '來よう', rule: 'vk', reasons: ['volitional']},
@@ -862,6 +876,7 @@ const tests = [
{term: 'くる', source: 'こん', rule: 'vk', reasons: ['-n']},
{term: 'くる', source: 'こざる', rule: 'vk', reasons: ['-zaru']},
{term: 'くる', source: 'こねば', rule: 'vk', reasons: ['-neba']},
+ {term: 'くる', source: 'こにゃ', rule: 'vk', reasons: ['-neba', '-ya']},
{term: 'くる', source: 'き', rule: 'vk', reasons: ['continuative']},
{term: 'くる', source: 'きましょう', rule: 'vk', reasons: ['-masu', 'volitional']},
{term: 'くる', source: 'こよう', rule: 'vk', reasons: ['volitional']},
@@ -925,6 +940,7 @@ const tests = [
{term: '論ずる', source: '論ぜん', rule: 'vz', reasons: ['-n']},
{term: '論ずる', source: '論ぜざる', rule: 'vz', reasons: ['-zaru']},
{term: '論ずる', source: '論ぜねば', rule: 'vz', reasons: ['-neba']},
+ {term: '論ずる', source: '論ぜにゃ', rule: 'vz', reasons: ['-neba', '-ya']},
// ['continuative']
{term: '論ずる', source: '論じましょう', rule: 'vz', reasons: ['-masu', 'volitional']},
{term: '論ずる', source: '論じよう', rule: 'vz', reasons: ['volitional']},
From b60285143791e995518d10683fc21a74bec1882f Mon Sep 17 00:00:00 2001
From: Kuuuube <61125188+Kuuuube@users.noreply.github.com>
Date: Mon, 29 Jul 2024 08:11:22 -0400
Subject: [PATCH 4/4] Add toggle for debug settings (#1282)
* Add showDebug setting
* Move check integrity and debug information under debug settings
* Remove advanced-only from Check Integrity
---
ext/css/settings.css | 19 +++++++++++++++++++
ext/data/schemas/options-schema.json | 5 +++++
ext/js/data/options-util.js | 11 +++++++++++
ext/settings.html | 13 +++++++++++--
test/options-util.test.js | 3 ++-
5 files changed, 48 insertions(+), 3 deletions(-)
diff --git a/ext/css/settings.css b/ext/css/settings.css
index 651d805b8c..598673f43c 100644
--- a/ext/css/settings.css
+++ b/ext/css/settings.css
@@ -638,6 +638,9 @@ a.heading-link-light {
.settings-item-children.settings-item-children-group .settings-item-children {
padding-left: 0;
}
+:root:not([data-debug=true]) .debug-only {
+ display: none;
+}
:root:not([data-advanced=true]) .advanced-only {
display: none;
}
@@ -769,6 +772,22 @@ select.short-height {
--accent-color-transparent25: var(--advanced-color-transparent25);
}
+/* Debug settings */
+.settings-group.debug-only>.settings-item::after,
+.settings-item.debug-only::after {
+ content: '';
+ background-color: var(--danger-color-lighter);
+ position: absolute;
+ right: 0;
+ top: 0;
+ height: 100%;
+ width: 0.25em;
+}
+.debug-toggle {
+ --accent-color: var(--danger-color);
+ --accent-color-lighter: var(--danger-color-lighter);
+ --accent-color-transparent25: var(--danger-color-transparent25);
+}
/* Modal */
.modal {
diff --git a/ext/data/schemas/options-schema.json b/ext/data/schemas/options-schema.json
index 7deec5ffd9..fba2bc208f 100644
--- a/ext/data/schemas/options-schema.json
+++ b/ext/data/schemas/options-schema.json
@@ -86,6 +86,7 @@
"debugInfo",
"maxResults",
"showAdvanced",
+ "showDebug",
"popupDisplayMode",
"popupWidth",
"popupHeight",
@@ -166,6 +167,10 @@
"type": "boolean",
"default": false
},
+ "showDebug": {
+ "type": "boolean",
+ "default": false
+ },
"popupDisplayMode": {
"type": "string",
"enum": ["default", "full-width"],
diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js
index 40fc20ddf3..a56dca458c 100644
--- a/ext/js/data/options-util.js
+++ b/ext/js/data/options-util.js
@@ -559,6 +559,7 @@ export class OptionsUtil {
this._updateVersion45,
this._updateVersion46,
this._updateVersion47,
+ this._updateVersion48,
];
/* eslint-enable @typescript-eslint/unbound-method */
if (typeof targetVersion === 'number' && targetVersion < result.length) {
@@ -1434,6 +1435,16 @@ export class OptionsUtil {
}
}
+ /**
+ * - Added general.showDebug
+ * @type {import('options-util').UpdateFunction}
+ */
+ async _updateVersion48(options) {
+ for (const profile of options.profiles) {
+ profile.options.general.showDebug = false;
+ }
+ }
+
/**
* @param {string} url
* @returns {Promise}
diff --git a/ext/settings.html b/ext/settings.html
index 0dc6b637a1..d552a1d2de 100644
--- a/ext/settings.html
+++ b/ext/settings.html
@@ -52,6 +52,15 @@
}'
>
Advanced
+
About Yomitan
@@ -852,7 +861,7 @@
Yomitan Settings
-
+
Show debug information
A menu option to log debugging information will be shown in the search results.
@@ -2512,7 +2521,7 @@
Yomitan Settings