Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
khaitruong922 committed Jul 29, 2024
2 parents 824fda8 + b602851 commit ea7ef6f
Showing 12 changed files with 95 additions and 39 deletions.
14 changes: 0 additions & 14 deletions ext/css/search.css
Original file line number Diff line number Diff line change
@@ -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 {
19 changes: 19 additions & 0 deletions ext/css/settings.css
Original file line number Diff line number Diff line change
@@ -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 {
5 changes: 5 additions & 0 deletions ext/data/schemas/options-schema.json
Original file line number Diff line number Diff line change
@@ -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"],
1 change: 1 addition & 0 deletions ext/js/background/backend.js
Original file line number Diff line number Diff line change
@@ -2187,6 +2187,7 @@ export class Backend {
const error = this._getAudioDownloadError(e);
if (error !== null) { throw error; }
// No audio
log.error(e);
return null;
}

14 changes: 12 additions & 2 deletions ext/js/data/options-util.js
Original file line number Diff line number Diff line change
@@ -1436,11 +1436,21 @@ export class OptionsUtil {
}

/**
* - Added dictionary alias
* - Added general.showDebug
* @type {import('options-util').UpdateFunction}
*/
async _updateVersion48(options) {
await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v48.handlebars');
for (const profile of options.profiles) {
profile.options.general.showDebug = false;
}
}

/**
* - Added dictionary alias
* @type {import('options-util').UpdateFunction}
*/
async _updateVersion49(options) {
await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v49.handlebars');
for (const {options: profileOptions} of options.profiles) {
if (Array.isArray(profileOptions.dictionaries)) {
for (const dictionary of profileOptions.dictionaries) {
32 changes: 16 additions & 16 deletions ext/js/language/ja/japanese-transforms.js
Original file line number Diff line number Diff line change
@@ -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': {
4 changes: 3 additions & 1 deletion ext/js/pages/settings/anki-deck-generator-controller.js
Original file line number Diff line number Diff line change
@@ -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} */ ({
15 changes: 11 additions & 4 deletions ext/search.html
Original file line number Diff line number Diff line change
@@ -44,10 +44,6 @@ <h1>Yomitan Search</h1>
<label class="toggle"><input type="checkbox" id="clipboard-monitor-enable"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label>
<span class="search-option-label">Clipboard monitor</span>
</label>
<div class="search-option" id="query-parser-mode-container" hidden>
<span class="search-option-pre-label">Parser:</span>
<select id="query-parser-mode-select"></select>
</div>
</div>
<div class="search-option" id="search-settings-button" data-modal-action="show,search-settings"><span class="icon" data-icon="cog"></span></div>
</div>
@@ -102,6 +98,17 @@ <h1>Yomitan Search</h1>
<div class="modal-title">Search Settings</div>
</div>
<div class="modal-body">
<div class="settings-item" id="query-parser-mode-container" hidden><div class="settings-item-inner">
<div class="settings-item-left">
<div class="settings-item-label">
Parser
</div>
</div>
<div class="settings-item-right">
<select id="query-parser-mode-select"></select>
</div>
</div></div>

<div class="settings-item" id="search-option-wanakana"><div class="settings-item-inner">
<div class="settings-item-left">
<div class="settings-item-label">
13 changes: 11 additions & 2 deletions ext/settings.html
Original file line number Diff line number Diff line change
@@ -52,6 +52,15 @@
}'
><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label>
</span><span class="outline-item-label">Advanced</span></label>
<label class="button outline-item advanced-only"><span class="outline-item-left">
<label class="toggle debug-toggle"><input id="debug-checkbox" type="checkbox" data-setting="general.showDebug"
data-transform='{
"type": "setAttribute",
"selector": ":root",
"attribute": "data-debug"
}'
><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label>
</span><span class="outline-item-label">Debug</span></label>
<a href="/info.html" class="button outline-item"><span class="outline-item-left"><span class="outline-item-icon icon" data-icon="question-mark"></span></span><span class="outline-item-label">About Yomitan</span></a>
</div>
</div></div>
@@ -852,7 +861,7 @@ <h1>Yomitan Settings</h1>
<label class="toggle"><input type="checkbox" data-setting="scanning.enableSearchTags"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label>
</div>
</div></div>
<div class="settings-item advanced-only"><div class="settings-item-inner">
<div class="settings-item debug-only"><div class="settings-item-inner">
<div class="settings-item-left">
<div class="settings-item-label">Show debug information</div>
<div class="settings-item-description">A menu option to log debugging information will be shown in the search results.</div>
@@ -2512,7 +2521,7 @@ <h1>Yomitan Settings</h1>
</div>
<div class="modal-footer">
<button type="button" class="low-emphasis danger dictionary-database-mutating-input" id="dictionary-delete-all-button">Delete All</button>
<button type="button" class="low-emphasis dictionary-database-mutating-input advanced-only" id="dictionary-check-integrity">Check Integrity</button>
<button type="button" class="low-emphasis dictionary-database-mutating-input debug-only" id="dictionary-check-integrity">Check Integrity</button>
<button type="button" class="low-emphasis dictionary-database-mutating-input" id="dictionary-check-updates">Check for Updates</button>
<button type="button" class="low-emphasis dictionary-database-mutating-input" id="dictionary-import-button">Import</button>
<button type="button" data-modal-action="hide">Close</button>
Loading

0 comments on commit ea7ef6f

Please sign in to comment.