From 251db0126c20ae159ce9d4cdf29413330f01dc65 Mon Sep 17 00:00:00 2001 From: StefanVukovic99 Date: Sun, 18 Feb 2024 14:06:01 +0100 Subject: disable kana conversion on search page for other languages (#705) * disable kana conversion for other languages * ternary parentheses * css fix --- ext/js/display/search-display-controller.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'ext/js/display') 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); } /** -- cgit v1.2.3