diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/bg/data/options-schema.json | 22 | ||||
-rw-r--r-- | ext/bg/js/options.js | 5 | ||||
-rw-r--r-- | ext/bg/settings.html | 2 | ||||
-rw-r--r-- | ext/bg/settings2.html | 66 | ||||
-rw-r--r-- | ext/fg/js/frontend.js | 2 | ||||
-rw-r--r-- | ext/mixed/css/material.css | 1 | ||||
-rw-r--r-- | ext/mixed/img/sentence-parsing.svg | 1 | ||||
-rw-r--r-- | ext/mixed/js/display.js | 4 |
8 files changed, 69 insertions, 34 deletions
diff --git a/ext/bg/data/options-schema.json b/ext/bg/data/options-schema.json index 12c4097d..9053ebb1 100644 --- a/ext/bg/data/options-schema.json +++ b/ext/bg/data/options-schema.json @@ -68,7 +68,8 @@ "translation", "dictionaries", "parsing", - "anki" + "anki", + "sentenceParsing" ], "properties": { "general": { @@ -732,7 +733,6 @@ "enable", "server", "tags", - "sentenceExt", "screenshot", "terms", "kanji", @@ -758,11 +758,6 @@ "yomichan" ] }, - "sentenceExt": { - "type": "integer", - "minimum": 0, - "default": 200 - }, "screenshot": { "type": "object", "required": [ @@ -847,6 +842,19 @@ "default": null } } + }, + "sentenceParsing": { + "type": "object", + "required": [ + "scanExtent" + ], + "properties": { + "scanExtent": { + "type": "integer", + "minimum": 0, + "default": 200 + } + } } } } diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js index adf3cfd4..441d56ec 100644 --- a/ext/bg/js/options.js +++ b/ext/bg/js/options.js @@ -683,11 +683,16 @@ class OptionsUtil { _updateVersion8(options) { // Version 8 changes: // Added translation.textReplacements. + // Moved anki.sentenceExt to sentenceParsing.scanExtent. for (const profile of options.profiles) { profile.options.translation.textReplacements = { searchOriginal: true, groups: [] }; + profile.options.sentenceParsing = { + scanExtent: profile.options.anki.sentenceExt + }; + delete profile.options.anki.sentenceExt; } return options; } diff --git a/ext/bg/settings.html b/ext/bg/settings.html index ec048a3b..d206d697 100644 --- a/ext/bg/settings.html +++ b/ext/bg/settings.html @@ -960,7 +960,7 @@ <div class="form-group options-advanced"> <label for="sentence-detection-extent">Sentence detection extent <span class="label-light">(in characters)</span></label> - <input type="number" min="1" step="1" id="sentence-detection-extent" class="form-control" data-setting="anki.sentenceExt"> + <input type="number" min="0" step="1" id="sentence-detection-extent" class="form-control" data-setting="sentenceParsing.scanExtent"> </div> <div class="form-group options-advanced"> diff --git a/ext/bg/settings2.html b/ext/bg/settings2.html index b74c4ec1..e5f105f0 100644 --- a/ext/bg/settings2.html +++ b/ext/bg/settings2.html @@ -31,6 +31,7 @@ <a href="#!window" class="outline-item"><span class="outline-item-left"><span class="outline-item-icon icon" data-icon="window"></span></span><span class="outline-item-label">Window</span></a> <a href="#!audio" class="outline-item"><span class="outline-item-left"><span class="outline-item-icon icon" data-icon="speaker"></span></span><span class="outline-item-label">Audio</span></a> <a href="#!text-parsing" class="outline-item"><span class="outline-item-left"><span class="outline-item-icon icon" data-icon="text-parsing"></span></span><span class="outline-item-label">Text Parsing</span></a> + <a href="#!sentence-parsing" class="outline-item advanced-only"><span class="outline-item-left"><span class="outline-item-icon icon" data-icon="sentence-parsing"></span></span><span class="outline-item-label">Sentence Parsing</span></a> <a href="#!translation" class="outline-item"><span class="outline-item-left"><span class="outline-item-icon icon" data-icon="translation"></span></span><span class="outline-item-label">Translation</span></a> <a href="#!anki" class="outline-item"><span class="outline-item-left"><span class="outline-item-icon icon" data-icon="note-card"></span></span><span class="outline-item-label">Anki</span></a> <a href="#!shortcuts" class="outline-item"><span class="outline-item-left"><span class="outline-item-icon icon" data-icon="keyboard"></span></span><span class="outline-item-label">Shortcuts</span></a> @@ -1107,6 +1108,48 @@ </div></div> </div> + <!-- Text Parsing --> + <div class="advanced-only"> + <div class="heading-container"> + <div class="heading-container-icon"><span class="icon" data-icon="sentence-parsing"></span></div> + <div class="heading-container-left"><h2 id="sentence-parsing"><a href="#!sentence-parsing">Sentence Parsing</a></h2></div> + <div class="heading-container-right"><a class="more-toggle more-only heading-link-light" data-parent-distance="3">Info…</a></div> + </div> + <div class="heading-description more" hidden> + <p> + Yomichan can will scan and parse sentences which can be used as contextual information for Anki cards. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + <div class="settings-group advanced-only"> + <div class="settings-item"> + <div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label"> + Sentence scanning extent + <a class="more-toggle more-only" data-parent-distance="4">(?)</a> + </div> + </div> + <div class="settings-item-right"> + <input type="number" data-setting="sentenceParsing.scanExtent" min="0" step="1"> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + This option controls the maximum scanning distance used to determine the bounds of a sentence, + in number of characters. + Sentence scanning is bidirectional and begins from both the start and end of the source term. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + </div> + <!-- Translation --> <div> <div class="heading-container"> @@ -1389,29 +1432,6 @@ </div> </div> </div></div> - <div class="settings-item advanced-only"> - <div class="settings-item-inner settings-item-inner-wrappable"> - <div class="settings-item-left"> - <div class="settings-item-label"> - Sentence scanning extent - <a class="more-toggle more-only" data-parent-distance="4">(?)</a> - </div> - </div> - <div class="settings-item-right"> - <input type="number" data-setting="anki.sentenceExt" min="1" step="1"> - </div> - </div> - <div class="settings-item-children more" hidden> - <p> - This option controls the maximum scanning distance used to determine the bounds of a sentence, - in number of characters. - Sentence scanning is bidirectional and begins from both the start and end of the source term. - </p> - <p> - <a class="more-toggle" data-parent-distance="3">Less…</a> - </p> - </div> - </div> <div class="settings-item settings-item-button" data-modal-action="show,anki-cards"><div class="settings-item-inner"> <div class="settings-item-left"> <div class="settings-item-label">Configure Anki card format…</div> diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index 3a5a2a44..c14c2feb 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -326,7 +326,7 @@ class Frontend { touchInputEnabled: scanningOptions.touchInputEnabled, pointerEventsEnabled: scanningOptions.pointerEventsEnabled, scanLength: scanningOptions.length, - sentenceExtent: options.anki.sentenceExt, + sentenceExtent: options.sentenceParsing.scanExtent, layoutAwareScan: scanningOptions.layoutAwareScan, preventMiddleMouse }); diff --git a/ext/mixed/css/material.css b/ext/mixed/css/material.css index a21dc2bb..b4a80807 100644 --- a/ext/mixed/css/material.css +++ b/ext/mixed/css/material.css @@ -181,6 +181,7 @@ .icon[data-icon=expand] { --icon-image: url(/mixed/img/expand.svg); } .icon[data-icon=window] { --icon-image: url(/mixed/img/window.svg); } .icon[data-icon=cross] { --icon-image: url(/mixed/img/cross.svg); } +.icon[data-icon=sentence-parsing] { --icon-image: url(/mixed/img/sentence-parsing.svg); } .icon[data-icon=material-down-arrow] { --icon-image: url(/mixed/img/material-down-arrow.svg); --icon-size: var(--material-arrow-dimension2) var(--material-arrow-dimension1); diff --git a/ext/mixed/img/sentence-parsing.svg b/ext/mixed/img/sentence-parsing.svg new file mode 100644 index 00000000..7c883175 --- /dev/null +++ b/ext/mixed/img/sentence-parsing.svg @@ -0,0 +1 @@ +<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M2.5996 1.8008C1.5996 2.8008 1 3.75 1 5c0 .55228.44772 1 1 1s1-.44772 1-1c0-.54895-.44255-.89427-.99023-.89844.04617-.75567.59691-1.3901.89062-1.9023l-.30078-.39844zm2.5 0C4.0996 2.8008 3.5 3.75 3.5 5c0 .55228.44772 1 1 1s1-.44772 1-1c0-.54895-.44255-.89427-.99023-.89844.04617-.75567.59691-1.3901.89062-1.9023l-.30078-.39844zM6.5 5v1H15V5H6.5zM1 7v1h7V7H1zm8 0v1h3V7H9zm4 0v1h2V7h-2zM1 9v1h2V9H1zm3 0v1h3V9H4zm4 0v1h3V9H8zm5.5 0c-.8225 0-1.5.6775-1.5 1.5s.6775 1.5 1.5 1.5 1.5-.6775 1.5-1.5S14.3225 9 13.5 9zm0 1c.28206 0 .5.21794.5.5s-.21794.5-.5.5-.5-.21794-.5-.5.21794-.5.5-.5zM1 11v1h4v-1H1zm5 0v1h5v-1H6z" fill="#333"/></svg>
\ No newline at end of file diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index e4433925..60842a3d 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -327,7 +327,7 @@ class Display extends EventDispatcher { touchInputEnabled: scanning.touchInputEnabled, pointerEventsEnabled: scanning.pointerEventsEnabled, scanLength: scanning.length, - sentenceExtent: options.anki.sentenceExt, + sentenceExtent: options.sentenceParsing.scanExtent, layoutAwareScan: scanning.layoutAwareScan, preventMiddleMouse: scanning.preventMiddleMouse.onSearchQuery } @@ -1832,7 +1832,7 @@ class Display extends EventDispatcher { touchInputEnabled: false, pointerEventsEnabled: false, scanLength: scanningOptions.length, - sentenceExtent: options.anki.sentenceExt, + sentenceExtent: options.sentenceParsing.scanExtent, layoutAwareScan: scanningOptions.layoutAwareScan, preventMiddleMouse: false }); |