diff options
author | StefanVukovic99 <stefanvukovic44@gmail.com> | 2024-02-18 14:06:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-18 13:06:01 +0000 |
commit | 251db0126c20ae159ce9d4cdf29413330f01dc65 (patch) | |
tree | 4e8095f83c0197ad1f4cf4c7b65f79f009324183 /ext/js/display/search-display-controller.js | |
parent | 90449bc745546f0f25bc93ee4b06d21b7c0210e8 (diff) |
disable kana conversion on search page for other languages (#705)
* disable kana conversion for other languages
* ternary parentheses
* css fix
Diffstat (limited to 'ext/js/display/search-display-controller.js')
-rw-r--r-- | ext/js/display/search-display-controller.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ext/js/display/search-display-controller.js b/ext/js/display/search-display-controller.js index 4b8141e1..23824aed 100644 --- a/ext/js/display/search-display-controller.js +++ b/ext/js/display/search-display-controller.js @@ -47,6 +47,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} */ @@ -184,9 +186,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); } /** |