From 3ad619139ebeeb7aa697653ceb44a9d9ce8009d5 Mon Sep 17 00:00:00 2001
From: Kuuuube <61125188+Kuuuube@users.noreply.github.com>
Date: Tue, 5 Nov 2024 14:20:26 -0500
Subject: [PATCH] Force scan resolution "character" for ja, zh, yue, and ko
(#1542)
* Force scan resolution "character" for ja, zh, yue, ko
* Split out visibility modifiers
* Hide scan resolution setting for jp, zh, yue, ko
* Remove unused visibility modifiers css from search-settings
---------
Signed-off-by: Kuuuube <61125188+Kuuuube@users.noreply.github.com>
---
ext/css/search-settings.css | 6 ------
ext/css/settings.css | 12 ------------
ext/css/visibility-modifiers.css | 15 +++++++++++++++
ext/js/language/text-scanner.js | 5 ++++-
ext/settings.html | 3 ++-
5 files changed, 21 insertions(+), 20 deletions(-)
create mode 100644 ext/css/visibility-modifiers.css
diff --git a/ext/css/search-settings.css b/ext/css/search-settings.css
index b145745675..5693c5f2f7 100644
--- a/ext/css/search-settings.css
+++ b/ext/css/search-settings.css
@@ -384,12 +384,6 @@ button.icon-button.modal-header-button>.icon-button-inner>.icon {
.settings-item-children.settings-item-children-group .settings-item-children {
padding-left: 0;
}
-:root:not([data-advanced=true]) .advanced-only {
- display: none;
-}
-:root:not([data-advanced=false]) .basic-only {
- display: none;
-}
.settings-item.settings-item-button,
a.settings-item.settings-item-button {
cursor: pointer;
diff --git a/ext/css/settings.css b/ext/css/settings.css
index 7e6c4bc158..65f05dcf16 100644
--- a/ext/css/settings.css
+++ b/ext/css/settings.css
@@ -638,18 +638,6 @@ 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;
-}
-:root:not([data-advanced=false]) .basic-only {
- display: none;
-}
-:root:not([data-language=ja]):not([data-language=zh]):not([data-language=yue]) .jpzhyue-only {
- display: none;
-}
.settings-item.settings-item-button,
a.settings-item.settings-item-button {
cursor: pointer;
diff --git a/ext/css/visibility-modifiers.css b/ext/css/visibility-modifiers.css
new file mode 100644
index 0000000000..f461b9c11f
--- /dev/null
+++ b/ext/css/visibility-modifiers.css
@@ -0,0 +1,15 @@
+:root:not([data-debug=true]) .debug-only {
+ display: none;
+}
+:root:not([data-advanced=true]) .advanced-only {
+ display: none;
+}
+:root:not([data-advanced=false]) .basic-only {
+ display: none;
+}
+:root:not([data-language=ja]):not([data-language=zh]):not([data-language=yue]) .jpzhyue-only {
+ display: none;
+}
+:root:is([data-language=ja], [data-language=zh], [data-language=yue], [data-language=ko]) .not-jpzhyueko {
+ display: none;
+}
diff --git a/ext/js/language/text-scanner.js b/ext/js/language/text-scanner.js
index f76bdf5251..4af6d00e93 100644
--- a/ext/js/language/text-scanner.js
+++ b/ext/js/language/text-scanner.js
@@ -24,6 +24,8 @@ import {clone} from '../core/utilities.js';
import {anyNodeMatchesSelector, everyNodeMatchesSelector, getActiveModifiers, getActiveModifiersAndButtons, isPointInSelection} from '../dom/document-util.js';
import {TextSourceElement} from '../dom/text-source-element.js';
+const SCAN_RESOLUTION_EXCLUDED_LANGUAGES = new Set(['ja', 'zh', 'yue', 'ko']);
+
/**
* @augments EventDispatcherYomitan Settings