Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable kana conversion on search page for other languages #705

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions ext/css/search.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

/* Variables */
:root {
--main-content-horizontal-padding: 0.72em;
--entry-horizontal-padding: 0;

--padding: calc(10em / var(--font-size-no-units));
Expand Down Expand Up @@ -132,12 +131,12 @@ h1 {
.search-options {
display: flex;
flex-flow: row wrap;
margin: 0.5em calc(-1 * var(--main-content-horizontal-padding));
margin: 0.5em 0;
align-items: center;
}
.search-option {
flex: 0 1 auto;
margin: 0.5em 1em;
margin: 0.5em 2em 0.5em 0;
align-items: center;
cursor: pointer;
}
Expand Down
10 changes: 7 additions & 3 deletions ext/js/display/search-display-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export class SearchDisplayController {
this._clipboardMonitorEnableCheckbox = querySelectorNotNull(document, '#clipboard-monitor-enable');
/** @type {HTMLInputElement} */
this._wanakanaEnableCheckbox = querySelectorNotNull(document, '#wanakana-enable');
/** @type {HTMLElement} */
this._wanakanaSearchOption = querySelectorNotNull(document, '#search-option-wanakana');
/** @type {EventListenerCollection} */
this._queryInputEvents = new EventListenerCollection();
/** @type {boolean} */
Expand Down Expand Up @@ -190,9 +192,11 @@ export class SearchDisplayController {
this._clipboardMonitorEnabled = options.clipboard.enableSearchPageMonitor;
this._updateClipboardMonitorEnabled();

const enableWanakana = !!options.general.enableWanakana;
this._wanakanaEnableCheckbox.checked = enableWanakana;
this._setWanakanaEnabled(enableWanakana);
const {language, enableWanakana} = options.general;
const wanakanaEnabled = language === 'ja' && enableWanakana;
this._wanakanaEnableCheckbox.checked = wanakanaEnabled;
this._wanakanaSearchOption.style.display = language === 'ja' ? '' : 'none';
this._setWanakanaEnabled(wanakanaEnabled);
}

/**
Expand Down
18 changes: 9 additions & 9 deletions ext/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,23 @@ <h1>Yomitan Search</h1>

<div class="scan-disable">
<div class="search-options">
<label class="search-option">
<label class="toggle"><input type="checkbox" id="wanakana-enable"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label>
<span class="search-option-label">Automatic kana conversion</span>
</label>
<div class="search-option" id="search-option-profile-select">
<span class="profile-select-container"><select class="profile-select" id="profile-select">
<optgroup label="Primary Profile" id="profile-select-option-group"></optgroup>
</select></span>
</div>
<label class="search-option" id="search-option-clipboard-monitor-container">
<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>
<label class="search-option" id="search-option-wanakana">
<label class="toggle"><input type="checkbox" id="wanakana-enable"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label>
<span class="search-option-label">Automatic kana conversion</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 class="search-option" id="search-option-profile-select">
<span class="profile-select-container"><select class="profile-select" id="profile-select">
<optgroup label="Primary Profile" id="profile-select-option-group"></optgroup>
</select></span>
</div>
</div>
<div class="search-textbox-container">
<textarea id="search-textbox" class="scrollbar" placeholder="Input a term, expression, sentence, or block of text" autocomplete="off" lang="ja" autofocus></textarea>
Expand Down
Loading