diff options
-rw-r--r-- | ext/bg/css/settings2.css | 2448 | ||||
-rw-r--r-- | ext/bg/js/settings2/nested-popups-controller.js | 71 | ||||
-rw-r--r-- | ext/bg/js/settings2/secondary-search-dictionary-controller.js | 61 | ||||
-rw-r--r-- | ext/bg/js/settings2/settings-display-controller.js | 348 | ||||
-rw-r--r-- | ext/bg/js/settings2/settings-main.js | 128 | ||||
-rw-r--r-- | ext/bg/settings2.html | 2411 |
6 files changed, 5467 insertions, 0 deletions
diff --git a/ext/bg/css/settings2.css b/ext/bg/css/settings2.css new file mode 100644 index 00000000..245331a3 --- /dev/null +++ b/ext/bg/css/settings2.css @@ -0,0 +1,2448 @@ +/* + * Copyright (C) 2020 Yomichan Authors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +/* Variables */ +:root { + --padding: 10px; + --padding-negative: calc(var(--padding) * -1); + --main-content-size: 700px; + --main-content-padding: 10px; + --sidebar-size: 200px; + --preview-sidebar-expanded-width: 400px; + --shadow-color: rgba(0, 0, 0, 0.185); + --shadow-color-off: rgba(0, 0, 0, 0); + --shadow-color-light: rgba(0, 0, 0, 0.085); + --shadow-vertical: 0 1px 4px 0 var(--shadow-color), 0 2px 2px 0 var(--shadow-color); + --shadow-vertical-strong: 0 1px 3px 1px var(--shadow-color), 0 2px 4px 3px var(--shadow-color); + --shadow-vertical-top: 0 -1px 4px 0 var(--shadow-color), 0 -2px 2px 0 var(--shadow-color); + --shadow-left: -1px 0 4px 0 var(--shadow-color), -2px 0 2px 0 var(--shadow-color); + --shadow-right: 1px 0 4px 0 var(--shadow-color), 2px 0 2px 0 var(--shadow-color); + --animation-duration: 0s; + --animation-duration2: calc(var(--animation-duration) * 2); + --animation-duration-half: calc(var(--animation-duration) / 2); + --settings-group-horizontal-margin: 0; + --settings-group-inner-vertical-margin: 0.75em; + --settings-group-inner-vertical-padding: 0.85em; + --settings-group-inner-horizontal-padding: 1.5em; + --settings-group-inner-horizontal-padding-half: calc(var(--settings-group-inner-horizontal-padding) * 0.5); + --settings-group-inner-horizontal-padding-half-wrappable: var(--settings-group-inner-horizontal-padding-half); + --settings-group-inner-horizontal-padding-fourth: calc(var(--settings-group-inner-horizontal-padding) * 0.25); + --settings-group-border-radius: 0.3em; + --settings-group-right-max-height: 40px; + --settings-group-wrap: nowrap; + --show-preview-label-height: 40px; + + --font-size-default: 14px; + --font-size-small: 12px; + --line-height-default: calc(20 / 14); + --outline-item-height: 40px; + --outline-item-icon-size: 32px; + --input-width: 100px; + --input-width-large: 200px; + --input-short: 80px; + --input-height: 32px; + --input-height-short: 24px; + --input-half-width: calc(var(--input-width-large) / 2 - var(--padding) / 2); + --thin-border-size: 1px; + --icon-button-size: 36px; + --fab-button-size: 56px; + --fab-button-padding: 16px; + --checkbox-size: 16px; + --toggle-size: 16px; + --radio-size: 20px; + --button-shadow-params: 0 1px 2px 0; + --material-arrow-dimension1: 5px; + --material-arrow-dimension2: 10px; + --modal-width: 600px; + --modal-height: 400px; + --modal-width-small: 400px; + --modal-height-small: 200px; + --modal-transition-offset: -64px; + + --menu-border-radius: 0.3em; + --menu-item-hover-color: #bbbbbb; + --menu-item-active-color: #aaaaaa; + + --text-color-default: #222222; + --background-color: #f8f9fa; + --background-color-light: #ffffff; + --input-background-color: #f2f2f2; + --input-background-color-dark: #dddddd; + --input-background-color-darker: #cccccc; + --input-outline-color: var(--text-color-default); + --link-color: var(--accent-color); + --link-color-hover: var(--accent-color-dark); + --text-color-light: #666666; + --text-color-lighter: #888888; + --separator-color1: #cccccc; + --separator-color2: #eeeeee; + --outline-item-background-color: rgba(13, 13, 13, 0.0); + --outline-item-background-color-hover: rgba(13, 13, 13, 0.15); + --button-text-color: #ffffff; + --button-border-color: var(--separator-color1); + --accent-color: #1a73e8; + --accent-color-light: #4a91ed; + --accent-color-lighter: #8db9f4; + --accent-color-lightest: #a7c9f6; + --accent-color-dark: #1060c0; + --accent-color-transparent0: rgba(28, 116, 233, 0); + --accent-color-transparent5: rgba(28, 116, 233, 0.05); + --accent-color-transparent25: rgba(28, 116, 233, 0.25); + --danger-color: #c83c28; + --danger-color-light: #dd6755; + --danger-color-lighter: #e68d7f; + --danger-color-lightest: #eeb3aa; + --danger-color-transparent0: rgba(200, 60, 40, 0); + --danger-color-transparent5: rgba(200, 60, 40, 0.05); + --danger-color-transparent25: rgba(200, 60, 40, 0.25); + --warning-color: #96751c; + --warning-color-light: hsl(44, 80%, 65%); + --disabled-color: #aaaaaa; + --disabled-color-light: #dddddd; + --disabled-color-lighter: #eeeeee; + --dim-background-color: rgba(0, 0, 0, 0.5); + --checkbox-checked: var(--accent-color); + --checkbox-unchecked: #666666; + --checkbox-check-color: var(--background-color-light); + --checkbox-disabled: #aaaaaa; + --toggle-track-color: #cccccc; + --toggle-knob-color: var(--background-color-light); + --selectable-indicator-color: rgba(160, 160, 160, 0.25); + --content-dimmer-color: rgba(0, 0, 0, 0.1); + --button-icon-color: #333333; + --button-icon-color-light: #666666; + + --modal-padding-horizontal: 1em; + --modal-padding-vertical: 0.625em; + --modal-padding-vertical-half: calc(var(--modal-padding-vertical) * 0.5); + --modal-button-spacing: 0.625em; + + --text-input-border-radius: 0.25em; + --textarea-line-height: 1.25em; + --textarea-padding: 0.5em; +} +:root[data-loaded=true] { + --animation-duration: 0.125s; +} + +@media (max-width: 700px) { + :root { + --settings-group-horizontal-margin: calc(var(--main-content-padding) * -1); + --settings-group-inner-horizontal-padding: var(--main-content-padding); + --settings-group-border-radius: 0; + } +} + +@media (max-width: 400px) { + :root { + --settings-group-horizontal-margin: calc(var(--main-content-padding) * -1); + --settings-group-inner-horizontal-padding: var(--main-content-padding); + --settings-group-inner-horizontal-padding-half-wrappable: var(--settings-group-inner-horizontal-padding); + --settings-group-wrap: wrap; + } +} + + +/* Common styles */ +:root { + height: 100%; +} +body { + background-color: var(--background-color); + margin: 0; + padding: 0; + border: none; + font-size: var(--font-size-default); + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + color: var(--text-color-default); + line-height: var(--line-height-default); + height: 100%; + overflow: hidden; +} +p { + margin: 0; +} +ol, +ul { + margin: 0; + padding: 0 0 0 1.5em; +} +p+p, p+ol, p+ul, +ol+p, ol+ol, ol+ul, +ul+p, ul+ol, ul+ul, +li { + margin: 0.425em 0; +} +a { + color: var(--link-color); + text-decoration: none; + cursor: pointer; +} +a:hover { + color: var(--link-color-hover); + text-decoration: underline; +} +code { + font-family: 'Courier New', Courier, monospace; + background-color: var(--input-background-color); +} +label { + cursor: pointer; +} + + +/* Text styles */ +.light { + color: var(--text-color-light); +} +.warning-text { + color: var(--warning-color); +} +.danger-text { + color: var(--danger-color); +} + + +/* Headings */ +h1 { + font-size: 2em; + line-height: 1.5em; + margin: 0; + padding: 0.25em 0 0; + font-weight: normal; + box-sizing: border-box; + border-bottom: var(--thin-border-size) solid var(--separator-color1); +} +h2 { + font-size: 1.125em; + font-weight: normal; + line-height: 1.5; + margin: 1.75em 0 0.9em; +} +h3 { + font-size: 1em; + font-weight: bold; + line-height: 1.5; + margin: 1.5em 0 0.85em; +} +.heading-container { + display: flex; + flex-flow: row nowrap; + width: 100%; + align-items: baseline; +} +.heading-container-left { + flex: 1 1 auto; +} +.heading-container-right { + flex: 0 0 auto; +} +.heading-sub-text { + font-size: 0.88888888em; + color: var(--text-color-light); +} +.heading-link-light { + color: var(--text-color-light); +} +.heading-description, +.heading-description.more { + padding: 0; + margin: 0 0 1.0125em; +} + + +/* Content layout */ +.content-outer { + display: flex; + flex-flow: column nowrap; + width: 100%; + height: 100%; +} +.content { + flex: 1 0 auto; + width: 100%; + height: 100%; + display: flex; + overflow-x: auto; + overflow-y: scroll; + position: relative; + align-items: stretch; +} +.content-left { + flex: 1 1 0; + position: sticky; + top: 0; + z-index: 5; +} +.content-center { + flex: 1 1 auto; + width: var(--main-content-size); + padding: 0 var(--main-content-padding); + max-width: var(--main-content-size); + box-sizing: border-box; +} +.content-right { + flex: 1 1 0; + position: sticky; + top: 0; + z-index: 2; +} +#content-scroll-focus { + opacity: 0; + margin: 0; + padding: 0; + background-color: transparent; + display: inline; +} +.content-dimmer { + display: block; + visibility: hidden; + position: fixed; + left: 0; + top: 0; + bottom: 0; + right: 0; + z-index: 3; + opacity: 0; + background-color: var(--content-dimmer-color); + pointer-events: none; + transition: opacity var(--animation-duration) ease-in-out, visibility var(--animation-duration) ease-in-out; +} + + +/* More details toggle */ +.more-toggle { + cursor: pointer; +} +.more-toggle.more-only[data-expanded=true], +.more-toggle.no-more-only:not([data-expanded=true]) { + display: none; +} +.more { + margin-top: 0.85em; +} + + +/* Footer */ +.footer-padding { + height: 4.5em; +} + + +/* Left sidebar */ +.sidebar { + position: absolute; + left: 0; + top: 0; + bottom: 0; + width: var(--sidebar-size); + max-width: 100%; + background-color: var(--background-color); + transition: max-width var(--animation-duration) ease-in; +} +.sidebar:hover { + max-width: var(--sidebar-size); + transition: max-width var(--animation-duration) ease-out 0.5s, + box-shadow var(--animation-duration) ease-out; +} +.sidebar-inner { + width: 100%; + height: 100%; + display: flex; + justify-content: space-between; + flex-flow: column nowrap; + overflow-x: hidden; + overflow-y: auto; + overscroll-behavior: contain; + transition: box-shadow var(--animation-duration) ease-out; +} +.sidebar-top { + position: sticky; + top: 0; + height: 2em; + z-index: 1; +} +.sidebar-top-link { + display: block; + background-color: var(--background-color); + height: 100%; + line-height: 2em; + padding: 0 1.5em; + opacity: 1; + visibility: visible; + transition: opacity var(--animation-duration2) ease-in-out, visibility var(--animation-duration2); +} +.sidebar-top-link[hidden] { + display: block; + opacity: 0; + visibility: hidden; +} +.sidebar-top-link:not(:hover) { + color: var(--text-color-default); +} +.sidebar-top-icon { + display: inline-block; + background-repeat: no-repeat; + background-size: 12px 12px; + width: 12px; + height: 12px; + background-image: url(/mixed/img/up-arrow.svg); + margin-right: calc(var(--padding) * 0.5); +} +.sidebar-body { + padding: 0 0 2em; +} +.sidebar-bottom { + padding-bottom: 2em; +} +.outline-item { + display: block; + height: var(--outline-item-height); + line-height: var(--outline-item-height); + padding: 0 1.5em; + cursor: pointer; + background-color: var(--outline-item-background-color); + transition: background-color var(--animation-duration) ease-in-out; +} +.outline-item, +.outline-item:hover { + text-decoration: none; + color: var(--text-color-default); +} +.outline-item:hover { + background-color: var(--outline-item-background-color-hover); +} +.outline-item-inner { + display: flex; + align-items: center; +} +.outline-item-left { + display: inline-block; + width: var(--outline-item-icon-size); + height: var(--outline-item-icon-size); + min-width: var(--outline-item-icon-size); + min-height: var(--outline-item-icon-size); + position: relative; +} +.outline-item-left-warning-badge { + position: absolute; + right: calc(var(--outline-item-icon-size) * -0.125); + top: calc(var(--outline-item-icon-size) * -0.125); + width: calc(var(--outline-item-icon-size) * 0.5); + height: calc(var(--outline-item-icon-size) * 0.5); + margin: 0; + padding: 0; + background-color: var(--warning-color-light); + border-radius: calc(var(--outline-item-icon-size) * 0.5); + box-shadow: var(--shadow-vertical); +} +.outline-item-left-warning-badge:not([hidden]) { + display: block; +} +.outline-item-left-warning-badge[data-icon]::after { + content: ""; + display: block; + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + background-color: var(--warning-color); + mask-repeat: no-repeat; + mask-position: center center; + mask-mode: alpha; + -webkit-mask-repeat: no-repeat; + -webkit-mask-position: center center; + -webkit-mask-mode: alpha; +} +.outline-item-left-warning-badge[data-icon=exclamation-point-short]::after { + mask-image: url(/mixed/img/exclamation-point-short.svg); + -webkit-mask-image: url(/mixed/img/exclamation-point-short.svg); + mask-size: 100% 100%; + -webkit-mask-size: 100% 100%; +} +.outline-item-label { + white-space: nowrap; + padding-left: var(--padding); +} +.outline-item-icon { + background-size: contain; + background-color: transparent; + background-repeat: no-repeat; +} +.outline-item-icon[data-icon=profile] { background-image: url(/mixed/img/profile.svg); } +.outline-item-icon[data-icon=general] { background-image: url(/mixed/img/cog.svg); } +.outline-item-icon[data-icon=appearance] { background-image: url(/mixed/img/palette.svg); } +.outline-item-icon[data-icon=popup] { background-image: url(/mixed/img/popup.svg); } +.outline-item-icon[data-icon=audio] { background-image: url(/mixed/img/speaker.svg); } +.outline-item-icon[data-icon=scanning] { background-image: url(/mixed/img/scanning.svg); } +.outline-item-icon[data-icon=text-parsing] { background-image: url(/mixed/img/text-parsing.svg); } +.outline-item-icon[data-icon=translation] { background-image: url(/mixed/img/translation.svg); } +.outline-item-icon[data-icon=dictionaries] { background-image: url(/mixed/img/book.svg); } +.outline-item-icon[data-icon=anki] { background-image: url(/mixed/img/note-card.svg); } +.outline-item-icon[data-icon=shortcuts] { background-image: url(/mixed/img/keyboard.svg); } +.outline-item-icon[data-icon=backup] { background-image: url(/mixed/img/backup.svg); } +.outline-item-icon[data-icon=security] { background-image: url(/mixed/img/lock.svg); } +.outline-item-icon[data-icon=about] { background-image: url(/mixed/img/question-mark.svg); } +.outline-item-icon[data-icon=popup-size] { background-image: url(/mixed/img/popup-size.svg); } + + +/* Preview sidebar */ +.preview-sidebar { + display: flex; + flex-flow: column nowrap; + align-content: center; + justify-content: center; + position: absolute; + right: 0; + top: 0; + bottom: 0; + width: 100%; + min-width: 100%; + max-width: 100%; + transition: width var(--animation-duration) ease-in-out, + max-width var(--animation-duration) ease-in-out, + box-shadow var(--animation-duration) ease-in-out; +} +.preview-sidebar-inner { + width: 100%; + height: 100%; + display: flex; + flex-flow: column nowrap; + align-content: center; + justify-content: center; + overflow: hidden; + background-color: var(--background-color); +} +.preview-sidebar-setting { + text-align: center; + flex: 0 0 auto; +} +.preview-frame-container { + position: relative; + align-self: stretch; + flex: 0 1 auto; + visibility: hidden; +} +.preview-frame-container.preview-frame-container-visible { + flex-grow: 1; + visibility: visible; +} +.preview-frame { + border: none; + margin: 0; + padding: 0; + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; +} +.show-preview-switch { + display: inline-block; + height: var(--show-preview-label-height); + margin: 0 auto; + line-height: var(--show-preview-label-height); + padding: 0 1.5em; + cursor: pointer; + text-align: left; + color: var(--text-color-lighter); +} +.show-preview-switch-inner { + display: flex; + align-items: center; +} +.show-preview-switch-label { + white-space: nowrap; + padding-left: var(--padding); +} + + +/* Settings styles */ +.settings-group { + margin: 0 var(--settings-group-horizontal-margin); + padding: 0; + box-sizing: border-box; + background-color: var(--background-color-light); + box-shadow: var(--shadow-vertical); + border-radius: var(--settings-group-border-radius); + overflow-x: hidden; +} +.settings-group.settings-group-top-margin { + margin-top: 1.0125em; +} +.settings-item-button { + cursor: pointer; +} +.settings-item-outer { + display: block; + width: 100%; +} +.settings-item-inner { + margin-top: var(--settings-group-inner-vertical-margin); + display: flex; + flex-flow: row nowrap; + justify-content: space-between; + align-content: stretch; + width: 100%; +} +.settings-item-inner.settings-item-inner-wrappable { + flex-wrap: var(--settings-group-wrap); +} +.settings-item-left { + margin-top: calc(var(--settings-group-inner-vertical-margin) * -1); + padding: var(--settings-group-inner-vertical-padding) var(--settings-group-inner-horizontal-padding-half) var(--settings-group-inner-vertical-padding) var(--settings-group-inner-horizontal-padding); + flex: 1 1 auto; + align-self: center; +} +.settings-item-right { + margin-top: calc(var(--settings-group-inner-vertical-margin) * -1); + padding: var(--settings-group-inner-vertical-padding) var(--settings-group-inner-horizontal-padding) var(--settings-group-inner-vertical-padding) var(--settings-group-inner-horizontal-padding-half); + flex: 0 1 auto; + align-self: stretch; + max-height: var(--settings-group-right-max-height); + display: flex; + flex-flow: row nowrap; + align-items: center; + align-content: center; + justify-content: flex-end; +} +.settings-item-inner.settings-item-inner-wrappable>.settings-item-left { + padding-right: var(--settings-group-inner-horizontal-padding-half-wrappable); +} +.settings-item-inner.settings-item-inner-wrappable>.settings-item-right { + padding-left: var(--settings-group-inner-horizontal-padding-half-wrappable); +} +.settings-item-center { + padding: var(--settings-group-inner-vertical-padding) var(--settings-group-inner-horizontal-padding) var(--settings-group-inner-vertical-padding) var(--settings-group-inner-horizontal-padding); + flex: 0 1 100%; + align-self: flex-start; + text-align: center; +} +.settings-item+.settings-item { + border-top: var(--thin-border-size) solid var(--separator-color2); +} +.settings-item-description { + color: var(--text-color-light); +} +.settings-item-right.open-panel-button-container { + padding: 0.25em 1em 0.25em 0.75em; + max-height: calc(var(--settings-group-right-max-height) + var(--settings-group-inner-vertical-padding) * 2); +} +.settings-item-children { + padding: 0em var(--settings-group-inner-horizontal-padding-half) var(--settings-group-inner-vertical-padding) var(--settings-group-inner-horizontal-padding); + margin-top: 0; +} +.settings-item-children.settings-item-children-group { + padding: 0 0 0 calc(var(--settings-group-inner-horizontal-padding) + var(--settings-group-inner-horizontal-padding)); +} +.settings-item-children.settings-item-children-group .settings-item { + border-top: var(--thin-border-size) solid var(--separator-color2); +} +.settings-item-children.settings-item-children-group .settings-item-left { + padding-left: 0; +} +.settings-item-children.settings-item-children-group .settings-item-children { + padding-left: 0; +} +:root:not([data-advanced=true]) .advanced-only { + display: none; +} + + +/* Settings item groups */ +.settings-item-group { + margin-right: var(--padding-negative); + display: flex; + flex-flow: row nowrap; + align-items: center; + align-content: center; + justify-content: flex-end; +} +.settings-item-group.settings-item-group-wrap { + flex-wrap: wrap; +} +.settings-item-group-item { + flex: 0 1 auto; + padding-right: var(--padding); +} +.settings-item-group-item-label { + font-size: var(--font-size-small); + line-height: 1; +} +input[type=text].short-width, +input[type=number].short-width, +select.short-width { + width: var(--input-short); +} +input[type=text].half-width, +input[type=number].half-width, +select.short-width { + width: var(--input-half-width); +} +input[type=text].short-height, +input[type=number].short-height, +select.short-height { + height: var(--input-height-short); + margin-top: calc(var(--settings-group-right-max-height) - var(--input-height-short) - var(--font-size-small)); + line-height: var(--input-height-short); +} +.settings-item-button-group-container { + max-height: none; + width: 100%; +} +.settings-item-button-group { + display: flex; + width: 100%; + flex-flow: row wrap; + max-height: none; + justify-content: flex-start; + margin-top: var(--padding-negative); + margin-right: var(--padding-negative); +} +.settings-item-button-group-item { + flex: 0 1 auto; + padding-top: var(--padding); + padding-right: var(--padding); +} + + +/* Material design checkbox */ +label.checkbox { + cursor: default; +} +.checkbox { + font-size: var(--checkbox-size); + display: inline-block; +} +.checkbox>input[type=checkbox] { + opacity: 0; + width: 0; + height: 0; + display: block; + margin: 0; + padding: 0; + border: none; + appearance: none; + -moz-appearance: none; + -webkit-appearance: none; +} +.checkbox-body { + display: block; + cursor: pointer; + width: 1em; + height: 1em; + position: relative; + cursor: pointer; +} +.checkbox>input[type=checkbox]:disabled+.checkbox-body { + cursor: default; +} +.checkbox-fill, +.checkbox-border, +.checkbox-check { + display: block; + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + mask-repeat: no-repeat; + mask-position: center center; + mask-mode: alpha; + mask-size: contain; + -webkit-mask-repeat: no-repeat; + -webkit-mask-position: center center; + -webkit-mask-mode: alpha; + -webkit-mask-size: contain; + transition: opacity var(--animation-duration) linear, background-color var(--animation-duration) linear; +} +.checkbox-fill { + mask-image: url(/mixed/img/checkbox-fill.svg); + -webkit-mask-image: url(/mixed/img/checkbox-fill.svg); + background-color: var(--checkbox-unchecked); + opacity: 0; +} +.checkbox-border { + mask-image: url(/mixed/img/checkbox-border.svg); + -webkit-mask-image: url(/mixed/img/checkbox-border.svg); + background-color: var(--checkbox-unchecked); + opacity: 1; +} +.checkbox-check { + mask-image: url(/mixed/img/checkbox-check.svg); + -webkit-mask-image: url(/mixed/img/checkbox-check.svg); + background-color: var(--checkbox-check-color); + opacity: 0; +} +.checkbox>input[type=checkbox]:checked+.checkbox-body>.checkbox-fill { + background-color: var(--checkbox-checked); + opacity: 1; +} +.checkbox>input[type=checkbox]:checked+.checkbox-body>.checkbox-border { + background-color: var(--checkbox-checked); + opacity: 1; +} +.checkbox>input[type=checkbox]:checked+.checkbox-body>.checkbox-check { + background-color: var(--checkbox-check-color); + opacity: 1; +} +.checkbox>input[type=checkbox]:disabled+.checkbox-body>.checkbox-fill { + opacity: 0; +} +.checkbox>input[type=checkbox]:disabled+.checkbox-body>.checkbox-border { + background-color: var(--checkbox-disabled); + opacity: 1; +} +.checkbox>input[type=checkbox]:disabled+.checkbox-body>.checkbox-check { + background-color: var(--checkbox-disabled); +} + + +/* Material design toggle switch */ +label.toggle { + cursor: default; +} +.toggle { + font-size: var(--toggle-size); + display: inline-block; +} +.toggle>input[type=checkbox] { + opacity: 0; + width: 0; + height: 0; + display: block; + margin: 0; + padding: 0; + border: none; + appearance: none; + -moz-appearance: none; + -webkit-appearance: none; +} +.toggle-body { + display: block; + cursor: pointer; + width: 2em; + height: 1em; + position: relative; +} +.toggle-track { + display: block; + position: absolute; + left: 0.125em; + right: 0.125em; + top: 0.125em; + bottom: 0.125em; + background-color: var(--toggle-track-color); + border-radius: 0.4375em; + transition: background-color var(--animation-duration) ease-in-out; +} +.toggle-knob { + display: block; + position: absolute; + left: 0; + top: 0; + width: 1em; + height: 1em; + background-color: var(--toggle-knob-color); + border-radius: 0.5em; + box-shadow: var(--shadow-vertical); + transition: transform var(--animation-duration) ease-in-out, + background-color var(--animation-duration) ease-in-out; +} +.toggle-body>.toggle-knob::after { + position: absolute; + display: block; + content: ""; + left: -0.75em; + top: -0.75em; + right: -0.75em; + bottom: -0.75em; + border-radius: 2.5em; + background-color: var(--selectable-indicator-color); + pointer-events: none; + transform: scale(0); + opacity: 0; + visibility: hidden; + transition: transform 0s ease-in-out var(--animation-duration2), + background-color var(--animation-duration2) ease-in-out, + opacity var(--animation-duration2) ease-in-out, + visibility 0s ease-in-out var(--animation-duration2); +} +.toggle>input[type=checkbox]:focus:not(:disabled)+.toggle-body>.toggle-knob::after, +.toggle:active>input[type=checkbox]:not(:disabled)+.toggle-body>.toggle-knob::after { + transform: scale(1); + opacity: 1; + visibility: visible; + transition: transform var(--animation-duration2) ease-in-out, + background-color var(--animation-duration2) ease-in-out, + opacity var(--animation-duration2) ease-in-out, + visibility var(--animation-duration2) ease-in-out; +} +.toggle>input[type=checkbox]:focus+.toggle-body>.toggle-knob::after { + opacity: 0.5; +} +.toggle:active>input[type=checkbox]:focus+.toggle-body>.toggle-knob::after { + opacity: 1; +} +.toggle>input[type=checkbox]:checked+.toggle-body>.toggle-knob { + transform: translateX(1em); +} +.toggle>input[type=checkbox]:checked:not(:disabled)+.toggle-body>.toggle-track { + background-color: var(--accent-color-lighter); +} +.toggle>input[type=checkbox]:checked:not(:disabled)+.toggle-body>.toggle-knob { + background-color: var(--accent-color); +} +.toggle>input[type=checkbox]:focus:checked:not(:disabled)+.toggle-body>.toggle-knob::after, +.toggle:active>input[type=checkbox]:checked:not(:disabled)+.toggle-body>.toggle-knob::after { + background-color: var(--accent-color-transparent25); +} +.toggle>input[type=checkbox]:disabled+.toggle-body { + cursor: default; +} +.toggle>input[type=checkbox]:disabled+.toggle-body>.toggle-track { + background-color: var(--disabled-color-light); +} +.toggle>input[type=checkbox]:disabled+.toggle-body>.toggle-knob { + background-color: var(--disabled-color-lighter); +} + + +/* Radio button */ +label.radio { + cursor: default; +} +.radio { + display: inline-block; + vertical-align: middle; +} +.radio>input[type=radio] { + opacity: 0; + width: 0; + height: 0; + display: block; + margin: 0; + padding: 0; + border: none; + cursor: default; + appearance: none; + -moz-appearance: none; + -webkit-appearance: none; +} +.radio>input[type=radio]:not(:disabled)+.radio-body { + cursor: pointer; +} +.radio-body { + display: block; + position: relative; + width: var(--radio-size); + height: var(--radio-size); +} +.radio-border, +.radio-dot { + display: block; + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + background-color: var(--accent-color); + mask-repeat: no-repeat; + mask-position: center center; + mask-mode: alpha; + mask-size: var(--radio-size) var(--radio-size); + -webkit-mask-repeat: no-repeat; + -webkit-mask-position: center center; + -webkit-mask-mode: alpha; + -webkit-mask-size: var(--radio-size) var(--radio-size); +} +.radio-border { + mask-image: url(/mixed/img/radio-button.svg); + -webkit-mask-image: url(/mixed/img/radio-button.svg); +} +.radio-dot { + mask-image: url(/mixed/img/radio-button-dot.svg); + -webkit-mask-image: url(/mixed/img/radio-button-dot.svg); + opacity: 1; + transform: none; + transition: transform var(--animation-duration2) ease-in-out, + opacity var(--animation-duration2) ease-in-out, + visibility var(--animation-duration2) ease-in-out; +} +.radio>input[type=radio]:disabled+.radio-body>.radio-border, +.radio>input[type=radio]:disabled+.radio-body>.radio-dot { + background-color: var(--disabled-color); +} +.radio>input[type=radio]:not(:checked)+.radio-body>.radio-dot { + opacity: 0; + transform: scale(0); + transition: transform 0s ease-in-out var(--animation-duration2), + opacity var(--animation-duration2) ease-in-out, + visibility 0s ease-in-out var(--animation-duration2); +} +.radio-body::after { + position: absolute; + display: block; + content: ""; + left: -0.75em; + top: -0.75em; + right: -0.75em; + bottom: -0.75em; + border-radius: 2.5em; + background-color: var(--selectable-indicator-color); + pointer-events: none; + transform: scale(0); + opacity: 0; + visibility: hidden; + transition: transform 0s ease-in-out var(--animation-duration2), + background-color var(--animation-duration2) ease-in-out, + opacity var(--animation-duration2) ease-in-out, + visibility 0s ease-in-out var(--animation-duration2); +} +.radio>input[type=radio]:focus:not(:disabled)+.radio-body::after, +.radio:active>input[type=radio]:not(:disabled)+.radio-body::after { + transform: scale(1); + opacity: 1; + visibility: visible; + transition: transform var(--animation-duration2) ease-in-out, + background-color var(--animation-duration2) ease-in-out, + opacity var(--animation-duration2) ease-in-out, + visibility var(--animation-duration2) ease-in-out; +} +.radio>input[type=radio]:focus+.radio-body::after { + opacity: 0.5; +} +.radio:active>input[type=radio]:focus+.radio-body::after { + opacity: 1; +} +.radio-label { + cursor: pointer; + white-space: nowrap; +} +.radio-label>.radio { + vertical-align: middle; +} +.radio-label>.radio-label-text { + display: inline-block; + margin-left: 0.5em; + vertical-align: middle; + white-space: normal; +} + + +/* Material design select */ +select { + width: var(--input-width-large); + height: var(--input-height); + line-height: var(--input-height); + border: 0; + border-radius: 0.25em; + box-sizing: border-box; + padding: 0 0.5em; + appearance: none; + -moz-appearance: none; + -webkit-appearance: none; + background-image: url(/mixed/img/material-down-arrow.svg); + background-repeat: no-repeat; + background-position: right var(--padding) center; + background-color: var(--input-background-color); + background-size: var(--material-arrow-dimension2) var(--material-arrow-dimension1); + cursor: pointer; +} +select::-ms-expand { + display: none; +} + + +/* Material design inputs */ +input[type=text], +input[type=number] { + width: var(--input-width); + height: var(--input-height); + line-height: var(--input-height); + background-color: var(--input-background-color); + border: none; + border-radius: var(--text-input-border-radius); + box-sizing: border-box; + padding: 0 0.5em; + appearance: textfield; + -moz-appearance: textfield; + -webkit-appearance: textfield; +} +input[type=number]::-webkit-inner-spin-button, +input[type=number]::-webkit-outer-spin-button { + appearance: none; + -moz-appearance: none; + -webkit-appearance: none; + margin: 0; +} +input[type=text] { + width: var(--input-width-large); +} +input[type=text].input-with-suffix-button, +input[type=number].input-with-suffix-button { + flex: 1 1 auto; + border-top-right-radius: 0; + border-bottom-right-radius: 0; + z-index: 1; +} +textarea { + box-sizing: border-box; + padding: var(--textarea-padding); + font-family: 'Courier New', Courier, monospace; + background-color: var(--input-background-color); + border-radius: var(--text-input-border-radius); + line-height: var(--textarea-line-height); + border: 1px solid var(--input-background-color); +} +input[type=text].is-invalid, +input[type=number].is-invalid, +textarea.is-invalid { + border-color: var(--danger-color); +} +select, +textarea, +input[type=text], +input[type=number] { + box-shadow: none; + transition: box-shadow var(--animation-duration-half) linear; +} +select:focus, +textarea:focus, +input[type=text]:focus, +input[type=number]:focus { + box-shadow: 0 0 0 2px var(--input-outline-color); + outline: none; +} + + +/* Material design button */ +button { + border: var(--thin-border-size) solid transparent; + border-radius: 0.3em; + padding: 0.5em 1em; + font-weight: bold; + font-size: inherit; + font-family: inherit; + cursor: pointer; + background-color: transparent; + box-shadow: var(--button-shadow-params) var(--shadow-color-off); + transition: background-color var(--animation-duration) ease-in, box-shadow var(--animation-duration) ease-in, border-color var(--animation-duration) ease-in; + -webkit-tap-highlight-color: transparent; +} +button:focus { + outline: none; +} +button:hover { + transition: background-color var(--animation-duration) ease-out, box-shadow var(--animation-duration) ease-out, border-color var(--animation-duration) ease-out; +} +button:hover:not(:disabled) { + box-shadow: var(--button-shadow-params) var(--shadow-color-light); +} +button:active:not(:disabled) { + box-shadow: var(--button-shadow-params) var(--shadow-color); +} + +/* Standard button */ +button:not(:disabled) { + color: var(--button-text-color); + border-color: var(--accent-color); + background-color: var(--accent-color); +} +button:hover:not(:disabled) { + background-color: var(--accent-color-light); + border-color: var(--accent-color-light); +} +button:focus:not(:disabled) { + background-color: var(--accent-color-light); +} +button:active:not(:disabled) { + border-color: var(--accent-color-lighter); + background-color: var(--accent-color-lighter); +} + +/* Standard danger button */ +button.danger:not(:disabled) { + color: var(--button-text-color); + border-color: var(--danger-color); + background-color: var(--danger-color); +} +button.danger:hover:not(:disabled) { + background-color: var(--danger-color-light); + border-color: var(--danger-color-light); +} +button.danger:focus:not(:disabled) { + background-color: var(--danger-color-light); +} +button.danger:active:not(:disabled) { + border-color: var(--danger-color-lighter); + background-color: var(--danger-color-lighter); +} + +/* Low emphasis button */ +button.low-emphasis:not(:disabled) { + color: var(--accent-color); + border-color: var(--button-border-color); + background-color: var(--accent-color-transparent0); +} +button.low-emphasis:hover:not(:disabled) { + background-color: var(--accent-color-transparent5); + border-color: var(--accent-color-light); +} +button.low-emphasis:focus:not(:disabled) { + border-color: var(--accent-color); +} +button.low-emphasis:active:not(:disabled) { + border-color: var(--accent-color); + background-color: var(--accent-color-transparent25); +} + +/* Low emphasis danger button */ +button.low-emphasis.danger:not(:disabled) { + color: var(--danger-color); + border-color: var(--button-border-color); + background-color: var(--danger-color-transparent0); +} +button.low-emphasis.danger:hover:not(:disabled) { + border-color: var(--danger-color-light); + background-color: var(--danger-color-transparent5); +} +button.low-emphasis.danger:focus:not(:disabled) { + border-color: var(--danger-color); +} +button.low-emphasis.danger:active:not(:disabled) { + border-color: var(--danger-color); + background-color: var(--danger-color-transparent25); +} + +/* Disabled buttons */ +button:disabled { + color: var(--button-text-color); + border-color: var(--disabled-color); + background-color: var(--disabled-color); + cursor: default; +} +button.low-emphasis:disabled { + color: var(--disabled-color); + border-color: var(--disabled-color); + background-color: transparent; +} + +/* Input suffix button */ +button.input-suffix-button { + border-top-left-radius: 0; + border-bottom-left-radius: 0; + border: none; + height: var(--input-height); + line-height: var(--input-height); + background-color: var(--input-background-color); + box-sizing: border-box; + padding: 0 0.5em; +} +button.input-suffix-button.input-suffix-icon-button { + width: 2.125em; + position: relative; +} +button.input-suffix-button.input-suffix-icon-button:hover, +button.input-suffix-button.input-suffix-icon-button:focus { + background-color: var(--input-background-color-dark); +} +button.input-suffix-button.input-suffix-icon-button:active { + background-color: var(--input-background-color-darker); +} + +/* Material design icon button */ +button.icon-button { + display: inline-block; + vertical-align: middle; + border: none; + margin: 0; + padding: 0; + box-sizing: content-box; + font-size: inherit; + cursor: pointer; + background-color: transparent; +} +button.icon-button>.icon-button-inner { + display: block; + width: var(--icon-button-size); + height: var(--icon-button-size); + position: relative; +} +button.icon-button:focus { + outline: none; +} +button.icon-button, +button.icon-button:hover, +button.icon-button:focus, +button.icon-button:active { + background-color: transparent; + box-shadow: none; +} +.icon-button>.icon-button-inner::after { + position: absolute; + display: block; + content: ""; + left: 0; + top: 0; + right: 0; + bottom: 0; + border-radius: 50%; + background-color: var(--selectable-indicator-color); + pointer-events: none; + transform: scale(0); + opacity: 0; + visibility: hidden; + transition: transform 0s ease-in-out var(--animation-duration2), + background-color var(--animation-duration2) ease-in-out, + opacity var(--animation-duration2) ease-in-out, + visibility 0s ease-in-out var(--animation-duration2); +} +.icon-button:focus>.icon-button-inner::after { + transform: scale(1); + opacity: 1; + visibility: visible; + transition: transform var(--animation-duration2) ease-in-out, + background-color var(--animation-duration2) ease-in-out, + opacity var(--animation-duration2) ease-in-out, + visibility var(--animation-duration2) ease-in-out; +} +.icon-button-icon { + display: block; + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + background-color: var(--button-icon-color); + mask-repeat: no-repeat; + mask-position: center center; + mask-mode: alpha; + -webkit-mask-repeat: no-repeat; + -webkit-mask-position: center center; + -webkit-mask-mode: alpha; +} +.icon-button-icon.icon-button-icon-light { + background-color: var(--button-icon-color-light); +} +.icon-button-icon[data-icon=right-arrow] { + mask-image: url(/mixed/img/material-right-arrow.svg); + -webkit-mask-image: url(/mixed/img/material-right-arrow.svg); + mask-size: var(--material-arrow-dimension1) var(--material-arrow-dimension2); + -webkit-mask-size: var(--material-arrow-dimension1) var(--material-arrow-dimension2); +} +.icon-button-icon[data-icon=hamburger-menu] { + mask-image: url(/mixed/img/hamburger-menu.svg); + -webkit-mask-image: url(/mixed/img/hamburger-menu.svg); + mask-size: 16px 16px; + -webkit-mask-size: 16px 16px; +} +.icon-button-icon[data-icon=kebab-menu] { + mask-image: url(/mixed/img/kebab-menu.svg); + -webkit-mask-image: url(/mixed/img/kebab-menu.svg); + mask-size: 16px 16px; + -webkit-mask-size: 16px 16px; +} +.icon-button-icon[data-icon=popup] { + mask-image: url(/mixed/img/popup.svg); + -webkit-mask-image: url(/mixed/img/popup.svg); + mask-size: 16px 16px; + -webkit-mask-size: 16px 16px; +} +.icon-button-icon[data-icon=mouse] { + mask-image: url(/mixed/img/mouse.svg); + -webkit-mask-image: url(/mixed/img/mouse.svg); + mask-size: 16px 16px; + -webkit-mask-size: 16px 16px; +} +.icon-button-icon[data-icon=material-down-arrow] { + mask-image: url(/mixed/img/material-down-arrow.svg); + -webkit-mask-image: url(/mixed/img/material-down-arrow.svg); + mask-size: var(--material-arrow-dimension2) var(--material-arrow-dimension1); + -webkit-mask-size: var(--material-arrow-dimension2) var(--material-arrow-dimension1); +} + +.input-height-icon-button-container { + height: var(--input-height); + box-sizing: border-box; +} +.input-height-icon-button-container>.icon-button { + position: relative; + top: calc((var(--input-height) - var(--icon-button-size)) * 0.5); +} + + +/* Modal */ +.modal-container { + position: fixed; + left: 0; + top: 0; + bottom: 0; + right: 0; + display: flex; + flex-flow: row nowrap; + justify-content: center; + align-items: center; + overscroll-behavior: contain; + background-color: var(--dim-background-color); + outline: none; + z-index: 100; + opacity: 0; + visibility: hidden; + transition: opacity var(--animation-duration2) ease-in, visibility 0s linear var(--animation-duration2); +} +.modal-container:not(.modal-container-open):not(.modal-container-opening):not(.modal-container-closing) { + display: none; +} +.modal-container.modal-container-open { + opacity: 1; + visibility: visible; + transition: opacity var(--animation-duration2) ease-out, visibility 0s linear; +} +.modal-content { + max-width: 100%; + max-height: 100%; + width: var(--modal-width); + height: var(--modal-height); + background-color: var(--background-color-light); + flex: 0 1 auto; + border-radius: 0.5em; + transform: translate(0, var(--modal-transition-offset)); + transition: transform 0s linear var(--animation-duration2); + box-shadow: var(--shadow-vertical); + display: flex; + flex-flow: column nowrap; + overflow: hidden; +} +.modal-container:not(.modal-container-open) .modal-content { + pointer-events: none; +} +.modal-content.modal-content-small { + width: var(--modal-width-small); + min-height: var(--modal-height-small); + height: auto; + max-height: 100%; +} +.modal-content.modal-content-full { + max-width: var(--main-content-size); + width: 100%; + height: 100%; + transform: translate(0, 0); + border-radius: 0; +} +.modal-container.modal-container-open .modal-content { + transform: translate(0, 0); + transition: transform var(--animation-duration2) ease-out; +} +.modal-header { + flex: 0 0 auto; + padding: var(--modal-padding-vertical) var(--modal-padding-horizontal) var(--modal-padding-vertical-half); +} +.modal-title { + font-size: 1.125em; +} +.modal-footer { + flex: 0 0 auto; + padding: var(--modal-padding-vertical-half) var(--modal-padding-horizontal) var(--modal-padding-vertical); + margin-right: calc(var(--modal-button-spacing) * -1); + margin-top: calc(var(--modal-button-spacing) * -1); + display: flex; + flex-flow: row wrap; + align-items: flex-end; + justify-items: flex-end; + justify-content: flex-end; +} +.modal-footer>* { + margin-right: var(--modal-button-spacing); + margin-top: var(--modal-button-spacing); +} +.modal-body { + flex: 1 1 auto; + overflow: auto; + padding: var(--modal-padding-vertical-half) var(--modal-padding-horizontal); +} +.modal-body-addon { + flex: 0 0 auto; + padding: var(--modal-padding-vertical-half) var(--modal-padding-horizontal); +} +.modal-body>.settings-item { + margin-left: calc(var(--modal-padding-horizontal) * -1); +} +.modal-body .settings-item { + margin-right: calc(var(--modal-padding-horizontal) * -1); +} +.modal-body .settings-item+.settings-item { + border-top: none +} +.modal-body .settings-item-left { + padding-left: var(--modal-padding-horizontal); + padding-top: var(--settings-group-inner-horizontal-padding-fourth); + padding-bottom: var(--settings-group-inner-horizontal-padding-fourth); +} +.modal-body .settings-item-right { + padding-right: var(--modal-padding-horizontal); + padding-top: var(--settings-group-inner-horizontal-padding-fourth); + padding-bottom: var(--settings-group-inner-horizontal-padding-fourth); +} +.modal-body .settings-item-children { + padding-left: var(--modal-padding-horizontal); + padding-right: var(--modal-padding-horizontal); + padding-bottom: var(--settings-group-inner-horizontal-padding-fourth); +} + +.modal-container.modal-container-left { + display: flex; + flex-flow: row nowrap; + width: 100%; + height: 100%; + background-color: transparent; + pointer-events: none; +} +.modal-container.modal-container-left::after { + content: ''; + display: block; + overflow-y: scroll; + overflow-x: hidden; + visibility: hidden; +} +.modal-content-container1 { + flex: 1 1 auto; + width: 100%; + height: 100%; + display: grid; + grid-template-columns: 1fr minmax(auto, var(--main-content-size)) 1fr; + grid-template-rows: auto; + align-items: stretch; +} +.modal-content-container2 { + grid-area: 1/1/2/3; + background-color: var(--dim-background-color); + pointer-events: auto; + width: 100%; + height: 100%; + display: flex; + flex-flow: row nowrap; + justify-content: center; + align-items: center; +} +.modal-content-container1-fade { + display: block; + position: relative; + grid-area: 1/3/2/4; +} +.modal-content-container1-fade::after { + content: ''; + display: block; + position: absolute; + left: 0; + top: 0; + bottom: 0; + width: 64px; + background: transparent linear-gradient(to right, var(--dim-background-color), transparent) repeat-y; +} + + +/* Popup menu */ +.popup-menu-container { + position: fixed; + left: 0; + top: 0; + right: 0; + bottom: 0; + z-index: 101; + outline: none; + overflow: hidden; +} +.popup-menu { + position: absolute; + left: 0; + top: 0; + max-width: 100%; + max-height: 100%; + box-sizing: border-box; + box-shadow: var(--shadow-vertical-strong); + border-radius: var(--menu-border-radius); + background-color: var(--background-color-light); + padding: 0.5em 0; + display: flex; + flex-flow: column nowrap; + align-items: stretch; + min-width: 8em; + overflow: auto; + white-space: nowrap; +} +button.popup-menu-item { + padding: 0.625em 1.5em; + border-radius: 0; + background-color: transparent; + color: var(--text-color-default); + border: none; + width: 100%; + text-align: left; + font-weight: normal; + font-family: inherit; +} +button.popup-menu-item:hover:not(:disabled), +button.popup-menu-item:focus:not(:disabled) { + background-color: var(--menu-item-hover-color); +} +button.popup-menu-item:active:not(:disabled) { + background-color: var(--menu-item-active-color); +} +button.popup-menu-item:disabled { + color: var(--text-color-light); +} + + +/* Status footer */ +.status-footer-container { + position: fixed; + left: 0; + top: 0; + right: 0; + bottom: 0; + display: flex; + flex-flow: row nowrap; + justify-content: flex-end; + align-items: stretch; + pointer-events: none; + z-index: 2; +} +.status-footer-container2 { + display: flex; + flex-flow: column nowrap; + justify-content: flex-end; + align-items: center; + width: 100%; + height: 100%; + box-sizing: border-box; +} +.status-footer-container::after { + /* Used to add scrollbar width to get better alignment with the main content container */ + content: ''; + display: block; + flex: 0 0 auto; + overflow-y: scroll; + visibility: hidden; +} +.status-footer { + max-width: var(--main-content-size); + max-height: 100%; + width: 100%; + pointer-events: auto; + overflow: auto; + flex: 0 1 auto; + padding: 0.375em 0; + box-sizing: border-box; + box-shadow: var(--shadow-vertical-top); + background-color: var(--background-color-light); + border-radius: var(--settings-group-border-radius) var(--settings-group-border-radius) 0 0; + transform: none; + opacity: 1; + transition: transform var(--animation-duration) ease-out, opacity var(--animation-duration) ease-out; +} +.status-footer-container:not(.status-footer-container-open) .status-footer { + transform: translate(0, 100%); + opacity: 0; + transition: transform var(--animation-duration) ease-in, opacity var(--animation-duration) ease-in; +} +.status-footer-container:not(.status-footer-container-open):not(.status-footer-container-opening):not(.status-footer-container-closing) { + display: none; +} +.status-footer-header { + display: flex; + width: 100%; + flex-flow: row nowrap; + align-items: center; + padding: 0.375em 0.75em; + box-sizing: border-box; +} +.status-footer-header-label { + font-weight: bold; + flex: 1 1 auto; +} +.status-footer-item { + padding: 0.375em 0.75em; +} + + +/* Floating action button container */ +.fab-container { + display: flex; + visibility: hidden; + align-items: stretch; + position: fixed; + left: 0; + bottom: 0; + top: 0; + right: 0; + pointer-events: none; + z-index: 10; +} +.fab-container::after { + content: ''; + display: block; + overflow-y: scroll; + overflow-x: hidden; + visibility: hidden; +} +.fab-container-left { + flex: 1 1 0; +} +.fab-container-center { + flex: 1 1 auto; + width: var(--main-content-size); + padding: 0 var(--main-content-padding); + max-width: var(--main-content-size); + box-sizing: border-box; + display: flex; + justify-content: flex-end; +} +.fab-container-right { + flex: 1 1 0; + position: relative; +} +.fab-container-right-inner1 { + position: absolute; + right: 0; + top: 0; + bottom: 0; + width: 100%; + min-width: 100%; + max-width: 100%; + transition: width var(--animation-duration) ease-in-out, + max-width var(--animation-duration) ease-in-out; +} +.fab-container-right-inner2 { + display: flex; + flex-flow: column nowrap; + position: absolute; + right: 100%; + bottom: 0; + padding: 0 var(--fab-button-padding) 0 0; +} +.fab-container-item { + padding-bottom: var(--fab-button-padding); +} +button.fab-button { + display: block; + padding: 0; + margin: 0; + pointer-events: all; +} +button.fab-button>.icon-button-inner { + width: var(--fab-button-size); + height: var(--fab-button-size); +} +button.fab-button, +button.fab-button:hover, +button.fab-button:focus, +button.fab-button:active { + background-color: transparent; + box-shadow: none; +} +.fab-button-background { + position: absolute; + display: block; + content: ""; + left: 0; + top: 0; + right: 0; + bottom: 0; + border-radius: 50%; + background-color: var(--accent-color); + box-shadow: var(--shadow-vertical); +} +button.fab-button>.icon-button-inner>.icon-button-icon { + background-color: #ffffff; +} +.fab-container-item.fab-container-item-popup-preview { + display: none; +} + + +/* Progress */ +.progress-labels { + display: flex; + flex-flow: row nowrap; + width: 100%; +} +.progress-info { + flex: 1 0 auto; +} +.progress-status { + text-align: right; + flex: 1 0 auto; + white-space: nowrap; +} +.progress-bar-track { + width: 100%; + height: 4px; + background-color: var(--input-background-color); +} +.progress-bar { + width: 0; + height: 100%; + background-color: var(--accent-color); +} +.progress-bar.danger { + background-color: var(--danger-color); +} + + +/* Conditional styles */ +body.sidebar-visible .content-dimmer { + visibility: visible; + opacity: 1; +} +body.sidebar-visible .sidebar, +body.sidebar-visible .sidebar:hover { + max-width: var(--sidebar-size); + transition: max-width var(--animation-duration) ease-out; +} +body.sidebar-visible .sidebar-inner { + box-shadow: var(--shadow-right); +} +body.sidebar-visible .fab-container { + visibility: visible; +} +body.sidebar-visible .content-left { + z-index: 4; +} + +body.preview-sidebar-visible .content-dimmer { + visibility: visible; + opacity: 1; +} +body.preview-sidebar-visible .preview-sidebar { + width: 70vw; + max-width: var(--preview-sidebar-expanded-width); + box-shadow: var(--shadow-left); +} +body.preview-sidebar-visible .content-right { + z-index: 5; +} +body.preview-sidebar-visible .fab-container-right-inner1 { + width: 70vw; + max-width: var(--preview-sidebar-expanded-width); +} +body.preview-sidebar-visible .fab-container { + visibility: visible; +} +body.sidebar-visible .fab-container-item.fab-container-item-popup-preview, +body.preview-sidebar-visible .fab-container-item.fab-container-item-popup-preview { + display: block; +} + + +/* Specialized settings styles */ +#audio-source-list>div+div { + margin-top: 0.375em; +} +#audio-source-list .generic-list-index-prefix { + width: 2em; + text-align: center; +} +#audio-source-list-empty { + display: none; +} +#audio-source-list:empty+#audio-source-list-empty { + display: block; +} + +.dictionary-list>.settings-item, +.dictionary-list>.settings-item+.settings-item { + margin-left: calc(var(--modal-padding-horizontal) * -1); + margin-right: calc(var(--modal-padding-horizontal) * -1); + border-top: var(--thin-border-size) solid var(--separator-color2); +} +.dictionary-details-table { + display: table; + width: 100% +} +.dictionary-details-entry { + display: table-row; +} +.dictionary-details-entry+.dictionary-details-entry>* { + padding-top: 0.25em; +} +.dictionary-details-entry-label { + display: table-cell; + font-weight: bold; + white-space: nowrap; + padding-right: 0.5em; +} +.dictionary-details-entry-info { + display: table-cell; + white-space: pre-line; +} +.dictionary-counts { + width: 100%; + box-sizing: border-box; + font-size: inherit; + max-height: 10em; + line-height: 1.25; + font-family: 'Courier New', Courier, monospace; + white-space: pre; + overflow: auto; +} + +.profile-add-button-container { + display: flex; + flex-flow: row nowrap; + justify-content: flex-end; +} +.profile-entry-header { + display: flex; + flex-flow: row nowrap; + align-items: center; +} +.profile-entry-header-text { + font-size: var(--font-size-small); + line-height: 1; + text-align: left; +} +.profile-entry { + width: 100%; + display: flex; + flex-flow: row nowrap; + align-items: center; + margin-bottom: 0.25em; +} +.profile-entry-cell:nth-child(1) { + flex: 0 0 auto; + min-width: 2em; + text-align: center; +} +.profile-entry-cell:nth-child(2) { + flex: 0 0 auto; + text-align: center; + width: 3.5em; +} +.profile-entry-cell:nth-child(3) { + flex: 1 1 auto; +} +.profile-entry-cell:nth-child(4) { + flex: 0 0 auto; + min-width: 4em; + text-align: center; + align-self: stretch +} +.profile-entry-cell:nth-child(5) { + flex: 0 0 auto; + width: 2.75em; + text-align: right; +} +input[type=text].profile-entry-name-input { + width: 100%; +} +.profile-entry-condition-count-link { + display: flex; + flex-flow: row nowrap; + width: 100%; + height: 100%; + align-items: center; + justify-content: center; +} + +.profile-condition-groups { + margin-left: calc(var(--modal-padding-horizontal) * -1); + margin-right: calc(var(--modal-padding-horizontal) * -1); + padding-left: var(--modal-padding-horizontal); + padding-right: var(--modal-padding-horizontal); + border-top: var(--thin-border-size) solid var(--separator-color2); +} +.profile-condition-group-list-info { + display: flex; + flex-flow: row nowrap; + width: 100%; + align-items: center; + margin-top: 0.5em; +} +.profile-condition-group-list-info-space { + flex: 1 1 auto; +} +.profile-condition-groups-empty-info { + flex: 1 1 auto; +} +.profile-condition-groups:not(:empty)+.profile-condition-group-list-info>.profile-condition-groups-empty-info { + display: none; +} +.profile-condition-group { + margin-top: 0.5em; + margin-bottom: 0.5em; +} +.profile-condition-list-info { + width: 100%; + display: flex; + align-items: center; + margin-bottom: 1em; +} +.profile-condition-list-info-space { + flex: 1 1 auto; +} +.profile-condition-group-separator-label { + width: 2.5em; + text-align: center; + margin-right: 0.25em; +} +.profile-condition-group:last-child>.profile-condition-list-info>.profile-condition-group-separator-label { + display: none; +} + +.profile-condition { + display: flex; + width: 100%; + flex-flow: row nowrap; + align-items: flex-start; + margin-bottom: 0.25em; +} +.profile-condition-inner { + display: flex; + width: 100%; + flex-flow: row wrap; + align-items: center; + margin-top: -0.25em; + margin-left: -0.25em; +} +.profile-condition-inner>* { + margin-left: 0.25em; + margin-top: 0.25em; +} +.profile-condition-prefix { + width: 2.5em; + text-align: center; + flex: 0 0 auto; + height: var(--input-height); + display: flex; + align-items: center; + justify-content: center; + margin-right: 0.25em; +} +.profile-condition-prefix::after { + content: "if" +} +.profile-condition:nth-child(n+2)>.profile-condition-prefix::after { + content: "and" +} +select.profile-condition-type, +select.profile-condition-operator { + width: auto; + padding-left: 1em; + padding-right: 1em; + flex: 1 0 auto; +} +.profile-condition-input-container { + flex: 1000000 1 auto; + display: flex; + flex-flow: row nowrap; + align-items: center; +} +.profile-condition-input { + width: 100%; + flex: 1 1 auto; +} +.profile-condition-menu-button-container { + margin-left: 0.25em; +} + +.anki-card-fields { + display: grid; + grid-template-columns: auto 1fr; + grid-template-rows: auto; + align-items: center; + width: 100%; + margin-top: 0.5em; +} +.anki-card-field-name-header { + font-weight: bold; + margin-right: 1em; +} +.anki-card-field-input-header { + font-weight: bold; +} +.anki-card-field-name { + margin-right: 1em; + margin-top: 0.25em; +} +.anki-card-field-value-container { + display: flex; + flex-flow: row nowrap; + width: 100%; + align-items: stretch; + margin-top: 0.25em; +} +input.anki-card-field-value { + flex: 1 1 auto; + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} +button.anki-card-field-value-menu-button { + border-top-left-radius: 0; + border-bottom-left-radius: 0; + border: none; + height: var(--input-height); + line-height: var(--input-height); + background-color: var(--input-background-color); + box-sizing: border-box; + padding: 0 0.5em; +} +#anki-error-message-details-toggle { + display: inline-block; + margin-left: 0.5em; + cursor: pointer; + font-weight: bold; +} +#anki-error-message-details { + margin-top: 0.25em; + font-family: 'Courier New', Courier, monospace; + white-space: pre; + overflow-x: auto; +} + +.anki-field-marker-info-table { + width: 100%; + border-collapse: collapse; + border-spacing: 0; +} +.anki-field-marker-info-table>thead { + font-weight: bold; +} +code.anki-field-marker { + white-space: nowrap; + font-size: 0.85em; + font-weight: bold; +} +.anki-field-marker-info-table thead tr { + background-color: var(--input-background-color); +} +.anki-field-marker-info-table td { + vertical-align: top; + border: 1px solid var(--separator-color1); + margin: 0; + padding: 0.25em; +} +.anki-field-marker-info-table td:nth-child(n+2) { + border-left: none; +} +.anki-field-marker-info-table td:nth-last-child(n+2) { + border-right: none; +} + +.anki-card-templates-layout { + display: flex; + flex-flow: column nowrap; +} +.anki-card-templates-info { + flex: 0 1 auto; +} +.anki-card-templates-test-input-container { + display: flex; + flex-flow: row nowrap; + width: 100%; + align-items: stretch; +} +.anki-card-templates-test-container { + flex: 0 1 auto; +} +.anki-card-templates-test-table { + display: grid; + grid-template-columns: auto 1fr auto; + grid-template-rows: auto; + align-items: center; + width: 100%; + box-sizing: border-box; + column-gap: 0.85em; +} +.anki-card-templates-test-table-header { + font-size: var(--font-size-small); +} +#anki-card-templates-textarea { + flex: 1 1 auto; + width: 100%; + max-width: 100%; + box-sizing: border-box; + resize: none; + min-height: calc(var(--textarea-line-height) * 5 + var(--textarea-padding) * 2); +} +#anki-card-templates-render-result, +#anki-card-templates-compile-result { + flex: 0 0 auto; + width: 100%; + max-width: 100%; + min-height: calc(var(--textarea-line-height) + var(--textarea-padding) * 2); + box-sizing: border-box; + padding: var(--textarea-padding); + font-family: 'Courier New', Courier, monospace; + background-color: var(--input-background-color); + border: none; + border-radius: var(--text-input-border-radius); + line-height: var(--textarea-line-height); + overflow: auto; + white-space: pre; +} + +.custom-popup-css-container { + display: flex; + flex-flow: column nowrap; +} +.custom-popup-css-header { + font-size: var(--font-size-small); +} +#custom-popup-css, +#custom-popup-outer-css { + flex: 1 1 auto; + width: 100%; + max-width: 100%; + box-sizing: border-box; + resize: none; + min-height: calc(var(--textarea-line-height) * 5 + var(--textarea-padding) * 2); +} + +.scan-input-list { + margin: 0 calc(var(--modal-padding-horizontal) * -1); +} +.scan-input-list:not(:empty)+.scan-input-list-empty-info { + display: none; +} +.scan-input { + margin: 0.5em 0; +} +.scan-input+.scan-input { + border-top: var(--thin-border-size) solid var(--separator-color2); +} +.scan-input-grid { + display: grid; + grid-template-columns: auto auto 1fr auto; + grid-template-rows: auto; + width: 100%; + column-gap: 0.25em; + row-gap: 0.25em; + margin: 0.5em 0; + padding: 0 var(--modal-padding-horizontal); + box-sizing: border-box; +} +.scan-input-suffix-cell { + grid-area: 1/4/2/5; +} +.scan-input-index-cell { + grid-area: 1/1/2/2; + align-self: center; + width: 2em; + text-align: center; +} +.scan-input-prefix-cell { + align-self: center; + padding-right: 0.5em; + display: flex; + flex-flow: row nowrap; + align-items: center; + white-space: nowrap; +} +.scan-input-content-cell { + display: flex; + flex-flow: row nowrap; + width: 100%; + align-items: stretch; +} +.scan-input-prefix-cell[data-property=include] { + grid-area: 1/2/2/3; +} +.scan-input-prefix-cell[data-property=exclude] { + grid-area: 2/2/3/3; +} +.scan-input-prefix-cell[data-property=types] { + grid-area: 3/2/4/3; +} +.scan-input-prefix-cell[data-property=search-options] { + grid-area: 4/2/5/3; +} +.scan-input-prefix-cell[data-property=touch-pen-options] { + grid-area: 5/2/6/3; +} +.scan-input-content-cell[data-property=include] { + grid-area: 1/3/2/4; +} +.scan-input-content-cell[data-property=exclude] { + grid-area: 2/3/3/4; +} +.scan-input-content-cell[data-property=types] { + grid-area: 3/3/4/4; + display: flex; + flex-flow: row wrap; + align-items: center; +} +.scan-input-content-cell[data-property=search-options] { + grid-area: 4/3/5/4; + display: flex; + flex-flow: row wrap; + align-items: center; +} +.scan-input-content-cell[data-property=touch-pen-options] { + grid-area: 5/3/6/4; + display: flex; + flex-flow: column nowrap; + align-items: flex-start; +} +.scan-input-options-cell { + padding: 0.25em 0; + align-self: start; +} +.scan-input:not([data-show-advanced=true]) .scan-input-advanced-only { + display: none; +} +.scan-input-checkbox-item { + display: flex; + flex-flow: row nowrap; + align-items: center; + margin-right: 0.75em; + cursor: pointer; +} +.scan-input-checkbox-item>span { + padding-left: 0.375em; +} +.scan-input-option-heading { + font-weight: bold; +} +.scan-input-option-group { + display: flex; + flex-flow: column nowrap; + padding-left: 1.5em; + align-items: flex-start; +} + +#pitch-accents-preview-frame { + border: none; + margin: 0; + padding: 0; + width: 100%; + height: calc(0.425em * 4 + 1em * (20 / 14) * 3); +} + + +/* Generic layouts */ +.margin-above { + margin-top: 0.85em; +} +.margin-left { + margin-left: 0.85em; +} + +.horizontal-flex { + display: flex; + flex-flow: row wrap; + margin-left: -0.375em; + align-items: center; + align-content: flex-start; + justify-content: flex-start; +} +.horizontal-flex>* { + margin-left: 0.375em; +} +.horizontal-flex-fill { + flex-grow: 1; +} + +.generic-list { + counter-reset: generic-list-index; +} +.generic-list-index-prefix::after { + counter-increment: generic-list-index; + content: counter(generic-list-index); +} + +.flex-row-nowrap { + display: flex; + flex-flow: row nowrap; + align-items: center; + width: 100%; +} +.flex-row-nowrap.right { + justify-content: flex-end; +} +.flex-row-wrap { + display: flex; + flex-flow: row wrap; + align-items: center; +} + +.flex-column-nowrap { + display: flex; + flex-flow: column nowrap; + align-items: flex-start; + width: 100%; +} +.flex-column-nowrap-spaced>* { + margin-top: 0.25em; +} + +.flex-label { + display: flex; + flex-flow: row nowrap; + align-items: center; +} +.flex-label>span { + margin-left: 0.375em; +} +.flex-label.no-wrap>span { + white-space: nowrap; +} + +.no-wrap { + white-space: nowrap; +} + + +/* Environment-specific display */ +:root[data-browser=edge] [data-show-for-browser]:not([data-show-for-browser~=edge]), +:root[data-browser=edge-legacy] [data-show-for-browser]:not([data-show-for-browser~=edge-legacy]), +:root[data-browser=chrome] [data-show-for-browser]:not([data-show-for-browser~=chrome]), +:root[data-browser=firefox] [data-show-for-browser]:not([data-show-for-browser~=firefox]), +:root[data-browser=firefox-mobile] [data-show-for-browser]:not([data-show-for-browser~=firefox-mobile]), +:root[data-os=mac] [data-show-for-os]:not([data-show-for-os~=mac]), +:root[data-os=win] [data-show-for-os]:not([data-show-for-os~=win]), +:root[data-os=android] [data-show-for-os]:not([data-show-for-os~=android]), +:root[data-os=cros] [data-show-for-os]:not([data-show-for-os~=cros]), +:root[data-os=linux] [data-show-for-os]:not([data-show-for-os~=linux]), +:root[data-os=openbsd] [data-show-for-os]:not([data-show-for-os~=openbsd]), +:root[data-browser=edge] [data-hide-for-browser~=edge], +:root[data-browser=edge-legacy] [data-hide-for-browser~=edge-legacy], +:root[data-browser=chrome] [data-hide-for-browser~=chrome], +:root[data-browser=firefox] [data-hide-for-browser~=firefox], +:root[data-browser=firefox-mobile] [data-hide-for-browser~=firefox-mobile], +:root[data-os=mac] [data-hide-for-os~=mac], +:root[data-os=win] [data-hide-for-os~=win], +:root[data-os=android] [data-hide-for-os~=android], +:root[data-os=cros] [data-hide-for-os~=cros], +:root[data-os=linux] [data-hide-for-os~=linux], +:root[data-os=openbsd] [data-hide-for-os~=openbsd] { + display: none; +} + + +/* Media-specific styles */ +@media (max-width: 800px), (hover: none) and (max-width: 1100px) { + .fab-container { + visibility: visible; + } +} +@media (max-width: 700px) { + .sidebar-inner { + box-shadow: var(--shadow-right); + } +} diff --git a/ext/bg/js/settings2/nested-popups-controller.js b/ext/bg/js/settings2/nested-popups-controller.js new file mode 100644 index 00000000..41bf0e11 --- /dev/null +++ b/ext/bg/js/settings2/nested-popups-controller.js @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2020 Yomichan Authors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +/* global + * DOMDataBinder + */ + +class NestedPopupsController { + constructor(settingsController) { + this._settingsController = settingsController; + this._popupNestingMaxDepth = 0; + } + + async prepare() { + this._nestedPopupsEnabled = document.querySelector('#nested-popups-enabled'); + this._nestedPopupsCount = document.querySelector('#nested-popups-count'); + this._nestedPopupsEnabledMoreOptions = document.querySelector('#nested-popups-enabled-more-options'); + + const options = await this._settingsController.getOptions(); + + this._nestedPopupsEnabled.addEventListener('change', this._onNestedPopupsEnabledChange.bind(this), false); + this._nestedPopupsCount.addEventListener('change', this._onNestedPopupsCountChange.bind(this), false); + this._settingsController.on('optionsChanged', this._onOptionsChanged.bind(this)); + this._onOptionsChanged({options}); + } + + // Private + + _onOptionsChanged({options}) { + this._updatePopupNestingMaxDepth(options.scanning.popupNestingMaxDepth); + } + + _onNestedPopupsEnabledChange(e) { + const value = e.currentTarget.checked; + if (value && this._popupNestingMaxDepth > 0) { return; } + this._setPopupNestingMaxDepth(value ? 1 : 0); + } + + _onNestedPopupsCountChange(e) { + const node = e.currentTarget; + const value = Math.max(1, DOMDataBinder.convertToNumber(node.value, node)); + this._setPopupNestingMaxDepth(value); + } + + _updatePopupNestingMaxDepth(value) { + const enabled = (value > 0); + this._popupNestingMaxDepth = value; + this._nestedPopupsEnabled.checked = enabled; + this._nestedPopupsCount.value = `${value}`; + this._nestedPopupsEnabledMoreOptions.hidden = !enabled; + } + + async _setPopupNestingMaxDepth(value) { + this._updatePopupNestingMaxDepth(value); + await this._settingsController.setProfileSetting('scanning.popupNestingMaxDepth', value); + } +} diff --git a/ext/bg/js/settings2/secondary-search-dictionary-controller.js b/ext/bg/js/settings2/secondary-search-dictionary-controller.js new file mode 100644 index 00000000..d3820364 --- /dev/null +++ b/ext/bg/js/settings2/secondary-search-dictionary-controller.js @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2020 Yomichan Authors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +/* global + * ObjectPropertyAccessor + */ + +class SecondarySearchDictionaryController { + constructor(settingsController) { + this._settingsController = settingsController; + this._getDictionaryInfoToken = null; + this._container = null; + } + + async prepare() { + this._container = document.querySelector('#secondary-search-dictionary-list'); + + yomichan.on('databaseUpdated', this._onDatabaseUpdated.bind(this)); + + await this._onDatabaseUpdated(); + } + + // Private + + async _onDatabaseUpdated() { + const token = {}; + this._getDictionaryInfoToken = token; + const dictionaries = await this._settingsController.getDictionaryInfo(); + if (this._getDictionaryInfoToken !== token) { return; } + this._getDictionaryInfoToken = null; + + const fragment = document.createDocumentFragment(); + for (const {title} of dictionaries) { + const node = this._settingsController.instantiateTemplate('secondary-search-dictionary'); + fragment.appendChild(node); + + const nameNode = node.querySelector('.dictionary-name'); + nameNode.textContent = title; + + const toggle = node.querySelector('.dictionary-allow-secondary-searches'); + toggle.dataset.setting = ObjectPropertyAccessor.getPathString(['dictionaries', title, 'allowSecondarySearches']); + } + + this._container.textContent = ''; + this._container.appendChild(fragment); + } +}
\ No newline at end of file diff --git a/ext/bg/js/settings2/settings-display-controller.js b/ext/bg/js/settings2/settings-display-controller.js new file mode 100644 index 00000000..2be7bf92 --- /dev/null +++ b/ext/bg/js/settings2/settings-display-controller.js @@ -0,0 +1,348 @@ +/* + * Copyright (C) 2020 Yomichan Authors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +/* global + * PopupMenu + * SelectorObserver + */ + +class SettingsDisplayController { + constructor(settingsController, modalController) { + this._settingsController = settingsController; + this._modalController = modalController; + this._contentNode = null; + this._topLink = null; + this._menuContainer = null; + this._openPopupMenus = new Set(); + this._onMoreToggleClickBind = null; + this._onMenuButtonClickBind = null; + } + + prepare() { + this._contentNode = document.querySelector('.content'); + this._topLink = document.querySelector('.sidebar-top-link'); + this._menuContainer = document.querySelector('#popup-menus'); + + const onFabButtonClick = this._onFabButtonClick.bind(this); + for (const fabButton of document.querySelectorAll('.fab-button')) { + fabButton.addEventListener('click', onFabButtonClick, false); + } + + const onModalAction = this._onModalAction.bind(this); + for (const node of document.querySelectorAll('[data-modal-action]')) { + node.addEventListener('click', onModalAction, false); + } + + const onSelectOnClickElementClick = this._onSelectOnClickElementClick.bind(this); + for (const node of document.querySelectorAll('[data-select-on-click]')) { + node.addEventListener('click', onSelectOnClickElementClick, false); + } + + const onInputTabActionKeyDown = this._onInputTabActionKeyDown.bind(this); + for (const node of document.querySelectorAll('[data-tab-action]')) { + node.addEventListener('keydown', onInputTabActionKeyDown, false); + } + + this._onMoreToggleClickBind = this._onMoreToggleClick.bind(this); + const moreSelectorObserver = new SelectorObserver({ + selector: '.more-toggle', + onAdded: this._onMoreSetup.bind(this), + onRemoved: this._onMoreCleanup.bind(this) + }); + moreSelectorObserver.observe(document.documentElement, false); + + this._onMenuButtonClickBind = this._onMenuButtonClick.bind(this); + const menuSelectorObserver = new SelectorObserver({ + selector: '[data-menu]', + onAdded: this._onMenuSetup.bind(this), + onRemoved: this._onMenuCleanup.bind(this) + }); + menuSelectorObserver.observe(document.documentElement, false); + + this._contentNode.addEventListener('scroll', this._onScroll.bind(this), {passive: true}); + this._topLink.addEventListener('click', this._onTopLinkClick.bind(this), false); + + window.addEventListener('keydown', this._onKeyDown.bind(this), false); + window.addEventListener('popstate', this._onPopState.bind(this), false); + this._updateScrollTarget(); + } + + // Private + + _onMoreSetup(element) { + element.addEventListener('click', this._onMoreToggleClickBind, false); + return null; + } + + _onMoreCleanup(element) { + element.removeEventListener('click', this._onMoreToggleClickBind, false); + } + + _onMenuSetup(element) { + element.addEventListener('click', this._onMenuButtonClickBind, false); + return null; + } + + _onMenuCleanup(element) { + element.removeEventListener('click', this._onMenuButtonClickBind, false); + } + + _onMenuButtonClick(e) { + const element = e.currentTarget; + const {menu} = element.dataset; + this._showMenu(element, menu); + } + + _onScroll(e) { + const content = e.currentTarget; + const topLink = this._topLink; + const scrollTop = content.scrollTop; + topLink.hidden = (scrollTop < 100); + } + + _onFabButtonClick(e) { + const action = e.currentTarget.dataset.action; + switch (action) { + case 'toggle-sidebar': + document.body.classList.toggle('sidebar-visible'); + break; + case 'toggle-preview-sidebar': + document.body.classList.toggle('preview-sidebar-visible'); + break; + } + } + + _onMoreToggleClick(e) { + const container = this._getMoreContainer(e.currentTarget); + if (container === null) { return; } + + const more = container.querySelector('.more'); + if (more === null) { return; } + + const moreVisible = more.hidden; + more.hidden = !moreVisible; + for (const moreToggle of container.querySelectorAll('.more-toggle')) { + const container2 = this._getMoreContainer(moreToggle); + if (container2 === null) { continue; } + + const more2 = container2.querySelector('.more'); + if (more2 === null || more2 !== more) { continue; } + + moreToggle.dataset.expanded = `${moreVisible}`; + } + + e.preventDefault(); + return false; + } + + _onPopState() { + this._updateScrollTarget(); + } + + _onKeyDown(e) { + switch (e.code) { + case 'Escape': + if (!this._isElementAnInput(document.activeElement)) { + this._closeTopMenuOrModal(); + e.preventDefault(); + } + break; + } + } + + _onModalAction(e) { + const node = e.currentTarget; + const {modalAction} = node.dataset; + if (typeof modalAction !== 'string') { return; } + + let [action, target] = modalAction.split(','); + if (typeof target === 'undefined') { + const currentModal = node.closest('.modal-container'); + if (currentModal === null) { return; } + target = currentModal.id; + } + + const modal = this._modalController.getModal(target); + if (typeof modal === 'undefined') { return; } + + switch (action) { + case 'show': + modal.setVisible(true); + break; + case 'hide': + modal.setVisible(false); + break; + case 'toggle': + modal.setVisible(!modal.isVisible()); + break; + } + + e.preventDefault(); + } + + _onSelectOnClickElementClick(e) { + if (e.button !== 0) { return; } + + const node = e.currentTarget; + const range = document.createRange(); + range.selectNode(node); + + const selection = window.getSelection(); + selection.removeAllRanges(); + selection.addRange(range); + + e.preventDefault(); + e.stopPropagation(); + return false; + } + + _onTopLinkClick(e) { + if (window.location.hash.length > 0) { + const {pathname, search} = window.location; + const url = `${pathname}${search}`; + history.pushState(null, '', url); + } + + const content = this._contentNode; + content.scrollTop = 0; + + e.preventDefault(); + e.stopPropagation(); + return false; + } + + _onClosePopupMenu({popupMenu, onClose}) { + this._openPopupMenus.delete(popupMenu); + popupMenu.off('closed', onClose); + } + + _onInputTabActionKeyDown(e) { + if (e.key !== 'Tab' || e.ctrlKey) { return; } + + const node = e.currentTarget; + const {tabAction} = node.dataset; + if (typeof tabAction !== 'string') { return; } + + const args = tabAction.split(','); + switch (args[0]) { + case 'ignore': + e.preventDefault(); + break; + case 'indent': + e.preventDefault(); + this._indentInput(e, node, args); + break; + } + } + + _updateScrollTarget() { + const hash = window.location.hash; + if (!hash.startsWith('#!')) { return; } + + const content = this._contentNode; + const target = document.getElementById(hash.substring(2)); + if (content === null || target === null) { return; } + + const rect1 = content.getBoundingClientRect(); + const rect2 = target.getBoundingClientRect(); + content.scrollTop += rect2.top - rect1.top; + this._onScroll({currentTarget: content}); + } + + _getMoreContainer(link) { + const v = link.dataset.parentDistance; + const distance = v ? parseInt(v, 10) : 1; + if (Number.isNaN(distance)) { return null; } + + for (let i = 0; i < distance; ++i) { + link = link.parentNode; + if (link === null) { break; } + } + return link; + } + + _closeTopMenuOrModal() { + for (const popupMenu of this._openPopupMenus) { + popupMenu.close(); + return; + } + + const modal = this._modalController.getTopVisibleModal(); + if (modal !== null) { + modal.setVisible(false); + } + } + + _showMenu(element, menuName) { + const menu = this._settingsController.instantiateTemplate(menuName); + if (menu === null) { return; } + + this._menuContainer.appendChild(menu); + + const popupMenu = new PopupMenu(element, menu); + this._openPopupMenus.add(popupMenu); + + const data = {popupMenu, onClose: null}; + data.onClose = this._onClosePopupMenu.bind(this, data); + + popupMenu.on('closed', data.onClose); + popupMenu.prepare(); + } + + _indentInput(e, node, args) { + let indent = '\t'; + if (args.length > 1) { + const count = parseInt(args[1], 10); + indent = (Number.isFinite(count) && count >= 0 ? ' '.repeat(count) : args[1]); + } + + const {selectionStart: start, selectionEnd: end, value} = node; + const lineStart = value.substring(0, start).lastIndexOf('\n') + 1; + const lineWhitespace = /^[ \t]*/.exec(value.substring(lineStart))[0]; + + if (e.shiftKey) { + const whitespaceLength = Math.max(0, Math.floor((lineWhitespace.length - 1) / 4) * 4); + const selectionStartNew = lineStart + whitespaceLength; + const selectionEndNew = lineStart + lineWhitespace.length; + const removeCount = selectionEndNew - selectionStartNew; + if (removeCount > 0) { + node.selectionStart = selectionStartNew; + node.selectionEnd = selectionEndNew; + document.execCommand('delete', false); + node.selectionStart = Math.max(lineStart, start - removeCount); + node.selectionEnd = Math.max(lineStart, end - removeCount); + } + } else { + if (indent.length > 0) { + const indentLength = (Math.ceil((start - lineStart + 1) / indent.length) * indent.length - (start - lineStart)); + document.execCommand('insertText', false, indent.substring(0, indentLength)); + } + } + } + + _isElementAnInput(element) { + const type = element !== null ? element.nodeName.toUpperCase() : null; + switch (type) { + case 'INPUT': + case 'TEXTAREA': + case 'SELECT': + return true; + default: + return false; + } + } +} diff --git a/ext/bg/js/settings2/settings-main.js b/ext/bg/js/settings2/settings-main.js new file mode 100644 index 00000000..da2d1c2d --- /dev/null +++ b/ext/bg/js/settings2/settings-main.js @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2020 Yomichan Authors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +/* global + * AnkiController + * AnkiTemplatesController + * AudioController + * BackupController + * ClipboardPopupsController + * DictionaryController + * DictionaryImportController + * GenericSettingController + * ModalController + * NestedPopupsController + * PopupPreviewController + * ProfileController + * ScanInputsController + * ScanInputsSimpleController + * SecondarySearchDictionaryController + * SettingsController + * SettingsDisplayController + * StatusFooter + * StorageController + * api + */ + +async function setupEnvironmentInfo() { + const {browser, platform} = await api.getEnvironmentInfo(); + document.documentElement.dataset.browser = browser; + document.documentElement.dataset.os = platform.os; +} + +async function setupGenericSettingsController(genericSettingController) { + await genericSettingController.prepare(); + await genericSettingController.refresh(); +} + +(async () => { + try { + document.querySelector('#content-scroll-focus').focus(); + + const statusFooter = new StatusFooter(document.querySelector('.status-footer-container')); + statusFooter.prepare(); + + api.forwardLogsToBackend(); + await yomichan.prepare(); + + setupEnvironmentInfo(); + + const optionsFull = await api.optionsGetFull(); + + const preparePromises = []; + + const modalController = new ModalController(); + modalController.prepare(); + + const settingsController = new SettingsController(optionsFull.profileCurrent); + settingsController.prepare(); + + const storageController = new StorageController(); + storageController.prepare(); + + const dictionaryController = new DictionaryController(settingsController, modalController, statusFooter); + dictionaryController.prepare(); + + const dictionaryImportController = new DictionaryImportController(settingsController, modalController, storageController, statusFooter); + dictionaryImportController.prepare(); + + const genericSettingController = new GenericSettingController(settingsController); + preparePromises.push(setupGenericSettingsController(genericSettingController)); + + const audioController = new AudioController(settingsController); + audioController.prepare(); + + const profileController = new ProfileController(settingsController, modalController); + profileController.prepare(); + + const settingsBackup = new BackupController(settingsController, modalController); + settingsBackup.prepare(); + + const ankiController = new AnkiController(settingsController); + ankiController.prepare(); + + const ankiTemplatesController = new AnkiTemplatesController(settingsController, modalController, ankiController); + ankiTemplatesController.prepare(); + + const popupPreviewController = new PopupPreviewController(settingsController); + popupPreviewController.prepare(); + + const scanInputsController = new ScanInputsController(settingsController); + scanInputsController.prepare(); + + const simpleScanningInputController = new ScanInputsSimpleController(settingsController); + simpleScanningInputController.prepare(); + + const nestedPopupsController = new NestedPopupsController(settingsController); + nestedPopupsController.prepare(); + + const clipboardPopupsController = new ClipboardPopupsController(settingsController); + clipboardPopupsController.prepare(); + + const secondarySearchDictionaryController = new SecondarySearchDictionaryController(settingsController); + secondarySearchDictionaryController.prepare(); + + await Promise.all(preparePromises); + + document.documentElement.dataset.loaded = 'true'; + + const settingsDisplayController = new SettingsDisplayController(settingsController, modalController); + settingsDisplayController.prepare(); + } catch (e) { + yomichan.logError(e); + } +})(); diff --git a/ext/bg/settings2.html b/ext/bg/settings2.html new file mode 100644 index 00000000..dcf99bbb --- /dev/null +++ b/ext/bg/settings2.html @@ -0,0 +1,2411 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width,initial-scale=1"> + <title>Yomichan Settings v2</title> + <link rel="icon" type="image/png" href="/mixed/img/icon16.png" sizes="16x16"> + <link rel="icon" type="image/png" href="/mixed/img/icon19.png" sizes="19x19"> + <link rel="icon" type="image/png" href="/mixed/img/icon32.png" sizes="32x32"> + <link rel="icon" type="image/png" href="/mixed/img/icon38.png" sizes="38x38"> + <link rel="icon" type="image/png" href="/mixed/img/icon48.png" sizes="48x48"> + <link rel="icon" type="image/png" href="/mixed/img/icon64.png" sizes="64x64"> + <link rel="icon" type="image/png" href="/mixed/img/icon128.png" sizes="128x128"> + <link rel="stylesheet" type="text/css" href="/bg/css/settings2.css"> +</head> +<body> + +<!-- Main content --> +<div class="content-outer"><div class="content"> +<div class="content-left"> + <div class="sidebar"><div class="sidebar-inner"> + <div class="sidebar-body"> + <div class="sidebar-top"><a href="" class="sidebar-top-link" hidden><span class="sidebar-top-icon"></span>Top</a></div> + <a href="#!profile" class="outline-item"><span class="outline-item-inner"><span class="outline-item-left outline-item-icon" data-icon="profile"></span><span class="outline-item-label">Profile</span></span></a> + <a href="#!dictionaries" class="outline-item"><span class="outline-item-inner"><span class="outline-item-left outline-item-icon" data-icon="dictionaries"><span class="outline-item-left-warning-badge no-dictionaries-installed-warning" data-icon="exclamation-point-short" hidden></span></span><span class="outline-item-label">Dictionaries</span></span></a> + <a href="#!general" class="outline-item"><span class="outline-item-inner"><span class="outline-item-left outline-item-icon" data-icon="general"></span><span class="outline-item-label">General</span></span></a> + <a href="#!popup" class="outline-item"><span class="outline-item-inner"><span class="outline-item-left outline-item-icon" data-icon="popup"></span><span class="outline-item-label">Popup</span></span></a> + <a href="#!popup-appearance" class="outline-item"><span class="outline-item-inner"><span class="outline-item-left outline-item-icon" data-icon="appearance"></span><span class="outline-item-label">Appearance</span></span></a> + <a href="#!popup-size" class="outline-item"><span class="outline-item-inner"><span class="outline-item-left outline-item-icon" data-icon="popup-size"></span><span class="outline-item-label">Position & Size</span></span></a> + <a href="#!audio" class="outline-item"><span class="outline-item-inner"><span class="outline-item-left outline-item-icon" data-icon="audio"></span><span class="outline-item-label">Audio</span></span></a> + <a href="#!scanning" class="outline-item"><span class="outline-item-inner"><span class="outline-item-left outline-item-icon" data-icon="scanning"></span><span class="outline-item-label">Scanning</span></span></a> + <a href="#!text-parsing" class="outline-item"><span class="outline-item-inner"><span class="outline-item-left outline-item-icon" data-icon="text-parsing"></span><span class="outline-item-label">Text Parsing</span></span></a> + <a href="#!translation" class="outline-item"><span class="outline-item-inner"><span class="outline-item-left outline-item-icon" data-icon="translation"></span><span class="outline-item-label">Translation</span></span></a> + <a href="#!anki" class="outline-item"><span class="outline-item-inner"><span class="outline-item-left outline-item-icon" data-icon="anki"></span><span class="outline-item-label">Anki</span></span></a> + <a href="#!shortcuts" class="outline-item"><span class="outline-item-inner"><span class="outline-item-left outline-item-icon" data-icon="shortcuts"></span><span class="outline-item-label">Shortcuts</span></span></a> + <a href="#!backup" class="outline-item"><span class="outline-item-inner"><span class="outline-item-left outline-item-icon" data-icon="backup"></span><span class="outline-item-label">Backup</span></span></a> + <a href="#!security" class="outline-item advanced-only"><span class="outline-item-inner"><span class="outline-item-left outline-item-icon" data-icon="security"></span><span class="outline-item-label">Security</span></span></a> + </div> + <div class="sidebar-bottom"> + <label class="outline-item"><span class="outline-item-inner"><span class="outline-item-left"> + <label class="toggle"><input id="advanced-checkbox" type="checkbox" data-setting="general.showAdvanced" data-transform="setDocumentAttribute" data-document-attribute="data-advanced"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </span><span class="outline-item-label">Advanced</span></span></label> + <a class="outline-item"><span class="outline-item-inner"><span class="outline-item-left outline-item-icon" data-icon="about"></span><span class="outline-item-label">About Yomichan</span></span></a> + </div> + </div></div> +</div> +<div class="content-center"> + + <span tabindex="-1" id="content-scroll-focus"></span> + + <h1>Yomichan Settings</h1> + + <h2 id="profile">Profile</h2> + <div class="settings-group"> + <div class="settings-item"><div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label">Default profile</div> + <div class="settings-item-description">Switch the primary profile that is used for scanning.</div> + </div> + <div class="settings-item-right"> + <select id="profile-active-select"></select> + </div> + </div></div> + <div class="settings-item"><div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label">Editing profile</div> + <div class="settings-item-description">Change which profile is being modified on this page.</div> + </div> + <div class="settings-item-right"> + <select id="profile-target-select"></select> + </div> + </div></div> + <div class="settings-item settings-item-button" data-modal-action="show,profiles"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Adjust profiles</div> + </div> + <div class="settings-item-right open-panel-button-container"> + <button class="icon-button"><span class="icon-button-inner"><span class="icon-button-icon" data-icon="right-arrow"></span></span></button> + </div> + </div></div> + </div> + + <h2 id="dictionaries">Dictionaries <span class="heading-sub-text no-wrap" data-modal-action="show,dictionaries">(<span id="dictionary-install-count">#</span> installed)</span></h2> + <div class="settings-group"> + <div class="settings-item settings-item-button" data-modal-action="show,dictionaries"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Configure installed and enabled dictionaries</div> + </div> + <div class="settings-item-right open-panel-button-container"> + <button class="icon-button"><span class="icon-button-inner"><span class="icon-button-icon" data-icon="right-arrow"></span></span></button> + </div> + </div></div> + <div class="settings-item"> + <div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Storage</div> + <div class="settings-item-description"> + <span class="storage-use-invalid"> + Yomichan is using an indeterminate amount of storage. + </span> + <span class="storage-use-finite" hidden> + Yomichan is using approximately <span class="storage-usage">?</span> of <span class="storage-quota">?</span>. + </span> + <span class="storage-use-infinite" hidden> + Yomichan is permitted unlimited storage. + </span> + </div> + </div> + <div class="settings-item-right"> + <button id="storage-refresh" class="low-emphasis">Refresh</button> + </div> + </div> + </div> + <div class="settings-item"> + <div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Persistent storage</div> + <div class="settings-item-description"> + Enable to help prevent the browser from unexpectedly clearing the database. + <a class="more-toggle more-only" data-parent-distance="4">More…</a> + </div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" id="storage-persistent-checkbox"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + Web browsers will sometimes clear stored data if the device is running low on storage space. + This can result in the imported dictionaries being deleted unexpectedly, causing Yomichan to stop functioning. + Enabling persistent storage tells the browser that the data should not be deleted in those circumstances. + </p> + <p data-show-for-browser="firefox firefox-mobile" class="storage-use-invalid" hidden> + On Firefox and Firefox for Android, the storage information feature may be hidden behind a browser flag. + + To enable this flag, open <a href="about:config" target="_blank" rel="noopener">about:config</a> and search for + <strong>dom.storageManager.enabled</strong>. + + Setting its value to <strong>true</strong> should allow storage information to be calculated. + </p> + <p data-show-for-browser="firefox-mobile"> + It may not be possible to enable Persistent Storage on Firefox for Android. + </p> + <p data-show-for-browser="chrome edge"> + Chromium-based browsers should not need to enable this setting since the Yomichan extension has + the <code>unlimitedStorage</code> permission, which should prevent data deletion.<sup><a href="https://bugs.chromium.org/p/chromium/issues/detail?id=680392#c15" target="_blank" rel="noopener">[1]</a></sup> + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + </div> + + <h2 id="general">General</h2> + <div class="settings-group"> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Enable content scanning</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="general.enable"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div></div> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Show the <a href="guide.html" target="_blank" rel="noopener">welcome guide</a> on browser startup</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="general.showGuide"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div></div> + <div class="settings-item"> + <div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label">Result grouping mode</div> + <div class="settings-item-description"> + Change how related results are grouped. + <a class="more-toggle more-only" data-parent-distance="4">More...</a> + </div> + </div> + <div class="settings-item-right"> + <select data-setting="general.resultOutputMode" data-transform="setVisibility" data-ancestor-distance="-1" data-relative-selector="#main-dictionary-container" data-visbility-condition='{"op":"===","value":"merge"}'> + <option value="split">No grouping</option> + <option value="group">Group term-reading pairs</option> + <option value="merge">Group related terms</option> + </select> + </div> + </div> + <div class="settings-item-children more" hidden> + <ul> + <li> + <strong>No grouping</strong> - + Every definition will be listed as a separate entry. + </li> + <li> + <strong>Group term-reading pairs</strong> - + Definitions for the same term with the same reading will be grouped together. + </li> + <li> + <p> + <strong>Group related terms</strong> - + Related terms that share the same definitions will be grouped together. + </p> + <p> + The <em>Primary dictionary</em> option should be assigned to a dictionary which contains related term information, + and configuring the <em>Secondary dictionaries</em> will allow definitions for the related terms to be + included from other dictionaries. + </p> + <p class="warning-text"> + Not all dictionaries are able to be selected as the <em>Primary dictionary</em>. + </p> + </li> + </ul> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + <div class="settings-item-children settings-item-children-group" id="main-dictionary-container" hidden> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Primary dictionary</div> + </div> + <div class="settings-item-right"> + <select data-setting="general.mainDictionary"></select> + </div> + </div></div> + <div class="settings-item settings-item-button" data-modal-action="show,secondary-search-dictionaries"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Secondary dictionaries</div> + </div> + <div class="settings-item-right open-panel-button-container"> + <button class="icon-button"><span class="icon-button-inner"><span class="icon-button-icon" data-icon="right-arrow"></span></span></button> + </div> + </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">Maximum number of results</div> + <div class="settings-item-description">Adjust the maximum number of results shown for lookups.</div> + </div> + <div class="settings-item-right"> + <input type="number" min="1" data-setting="general.maxResults"> + </div> + </div></div> + </div> + + <h2 id="popup">Popup</h2> + <div class="settings-group"> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Allow scanning search page content</div> + <div class="settings-item-description">Text on the search page can be scanned for definitions, which will open a popup.</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="scanning.enableOnSearchPage"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div></div> + <div class="settings-item"> + <div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Allow scanning popup content</div> + <div class="settings-item-description">Text inside of popups can be scanned for definitions, which will open a new popup.</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" id="nested-popups-enabled"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div> + <div class="settings-item-children settings-item-children-group" id="nested-popups-enabled-more-options" hidden> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Maximum number of child popups</div> + <div class="settings-item-description">Change the limit on the number of popups that may be generated.</div> + </div> + <div class="settings-item-right"> + <input type="number" min="0" step="1" id="nested-popups-count"> + </div> + </div></div> + <div class="settings-item advanced-only"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Allow scanning popup source terms</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="scanning.enableOnPopupExpressions"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div></div> + </div> + </div> + <div class="settings-item advanced-only"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Search terms when clicking text from the results list</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div></div> + <div class="settings-item advanced-only"> + <div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label"> + Show iframe popups in the root frame + <a class="more-toggle more-only" data-parent-distance="4">(?)</a> + </div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="general.showIframePopupsInRootFrame"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + By default, scanning text inside of an embeded <code><iframe></code> element will open + a new popup inside of that frame, which can sometimes be limiting due to the frame's size. + When this option is enabled, the popup will be created in the root of the page, if possible. + </p> + <p> + Note that when this option is enabled, there is a possibility that the extension can interfere with the underlying webpage, + since it must send messages to the webpage in order to determine the correct position of the popup. + This typically does not cause issues, but if anything unexpected happens, this option could be the cause. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + <div class="settings-item advanced-only"> + <div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label"> + Use a native browser window instead of an embedded popup + <a class="more-toggle more-only" data-parent-distance="4">(?)</a> + </div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="general.usePopupWindow"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + Instead of showing definitions in a popup embedded into the webpage, + a native browser window containing the popup content will be opened instead. + This window will be shared across all tabs. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + <div class="settings-item advanced-only"> + <div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label"> + Open a native browser window when copying Japanese text + <a class="more-toggle more-only" data-parent-distance="4">(?)</a> + </div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" id="enable-clipboard-popups"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + When Japanese text is copied to the clipboard, a browser window popup searching for the clipboard + text will be opened. + This can be useful for using Yomichan to scan text from external applications. + </p> + <p> + This feature requires Yomichan to have clipboard reading permissions, and when this option is enabled, + the clipboard will be frequently polled for new text. + </p> + <p> + Alternatively, this feature can be enabled only on the search page, and clipboard contents polling will + only be performed when the search page is already open. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + </div> + + <h2 id="popup-appearance">Popup Appearance</h2> + <div class="settings-group"> + <div class="settings-item"><div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label">Theme</div> + <div class="settings-item-description">Adjust the style of the popup.</div> + </div> + <div class="settings-item-right"> + <div class="settings-item-group"> + <div class="settings-item-group-item"> + <div class="settings-item-group-item-label">Body</div> + <select data-setting="general.popupTheme" class="short-width short-height"> + <option value="default">Light</option> + <option value="dark">Dark</option> + </select> + </div> + <div class="settings-item-group-item"> + <div class="settings-item-group-item-label">Shadow</div> + <select data-setting="general.popupOuterTheme" class="short-width short-height"> + <option value="auto">Auto-detect</option> + <option value="default">Light</option> + <option value="dark">Dark</option> + </select> + </div> + </div> + </div> + </div></div> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Glossary layout</div> + <div class="settings-item-description">Configure how term glossaries are displayed.</div> + </div> + <div class="settings-item-right"> + <select data-setting="general.glossaryLayoutMode"> + <option value="default">Default</option> + <option value="compact">Compact</option> + </select> + </div> + </div></div> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Compact tags</div> + <div class="settings-item-description">Show fewer repeated tags for term glossaries.</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="general.compactTags"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div></div> + <div class="settings-item advanced-only"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Show tags for expressions and their readings</div> + <div class="settings-item-description">These tags can be scanned if the options for popup content scanning are enabled.</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="scanning.enableSearchTags"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div></div> + <div class="settings-item advanced-only"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Show debug information</div> + <div class="settings-item-description">A link to log debugging information will be shown in the search results.</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="general.debugInfo"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div></div> + <div class="settings-item advanced-only"> + <div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label"> + Pitch accent display styles + <a class="more-toggle more-only" data-parent-distance="4">(?)</a> + </div> + </div> + <div class="settings-item-right flex-row-wrap"> + <div class="settings-item-group settings-item-group-wrap"> + <label class="settings-item-group-item flex-label no-wrap"> + <label class="checkbox"><input type="checkbox" data-setting="general.showPitchAccentDownstepNotation"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Downstep notation</span> + </label> + <label class="settings-item-group-item flex-label no-wrap"> + <label class="checkbox"><input type="checkbox" data-setting="general.showPitchAccentPositionNotation"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Downstep position</span> + </label> + <label class="settings-item-group-item flex-label no-wrap"> + <label class="checkbox"><input type="checkbox" data-setting="general.showPitchAccentGraph"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Graph</span> + </label> + </div> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + Pitch accents for terms and expressions can be shown if a dictionary supporting pitch accents is installed. + There are currently three different ways that pitch accents can be presented: + </p> + <iframe src="/bg/pitch-accents-preview.html" id="pitch-accents-preview-frame"></iframe> + <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,custom-css"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Custom CSS</div> + </div> + <div class="settings-item-right open-panel-button-container"> + <button class="icon-button"><span class="icon-button-inner"><span class="icon-button-icon" data-icon="right-arrow"></span></span></button> + </div> + </div></div> + </div> + + <h2 id="popup-size">Popup Position & Size</h2> + <div class="settings-group"> + <div class="settings-item"> + <div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label">Display mode</div> + <div class="settings-item-description"> + Change the layout of the popup. + <a class="more-toggle more-only" data-parent-distance="4">More…</a> + </div> + </div> + <div class="settings-item-right"> + <select data-setting="general.popupDisplayMode"> + <option value="default">Default</option> + <option value="full-width">Full width</option> + </select> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + The <em>Default</em> mode will position the popup relative to the scanned text. + The <em>Full Width</em> mode will anchor the popup to the top or bottom of the screen and take up + the full width of the screen, which can be useful on devices with touch screens. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + <div class="settings-item"> + <div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label">Scale</div> + <div class="settings-item-description">Control the scaling factor of the popup.</div> + </div> + <div class="settings-item-right"> + <select data-setting="general.popupScalingFactor" data-transform-pre="toNumber" data-transform-post="toString" data-min="0.25"> + <option value="0.25">25%</option> + <option value="0.33">33%</option> + <option value="0.5">50%</option> + <option value="0.67">67%</option> + <option value="0.75">75%</option> + <option value="0.8">80%</option> + <option value="0.9">90%</option> + <option value="1">100%</option> + <option value="1.1">110%</option> + <option value="1.25">125%</option> + <option value="1.5">150%</option> + <option value="1.75">175%</option> + <option value="2">200%</option> + <option value="2.5">250%</option> + <option value="3">300%</option> + <option value="4">400%</option> + <option value="5">500%</option> + </select> + </div> + </div> + <div class="settings-item-children settings-item-children-group advanced-only"> + <div class="settings-item"> + <div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label"> + Auto-scale + <a class="more-toggle more-only" data-parent-distance="4">(?)</a> + </div> + </div> + <div class="settings-item-right flex-row-wrap"> + <div class="settings-item-group settings-item-group-wrap"> + <label class="settings-item-group-item flex-label no-wrap"> + <label class="checkbox"><input type="checkbox" data-setting="general.popupScaleRelativeToPageZoom"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Zoom level</span> + </label> + <label class="settings-item-group-item flex-label no-wrap"> + <label class="checkbox"><input type="checkbox" data-setting="general.popupScaleRelativeToVisualViewport"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Viewport</span> + </label> + </div> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + Auto-scaling will scale the popup automatically based on the browser's zoom levels + in order to keep the popup at a constant physical size, regardless of the zoom level. + <em>Zoom level</em> uses the zoom level that is typically used on desktop browsers, + and <em>Viewport</em> uses the zoom level that is typically used on mobile browsers. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + </div> + </div> + <div class="settings-item"><div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label">Size</div> + <div class="settings-item-description">Control the size of the popup, in pixels.</div> + </div> + <div class="settings-item-right"> + <div class="settings-item-group"> + <div class="settings-item-group-item"> + <div class="settings-item-group-item-label">Width</div> + <input type="number" class="short-width short-height" min="1" data-setting="general.popupWidth"> + </div> + <div class="settings-item-group-item"> + <div class="settings-item-group-item-label">Height</div> + <input type="number" class="short-width short-height" min="1" data-setting="general.popupHeight"> + </div> + </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">Horizontal text positioning</div> + <div class="settings-item-description">Change where the popup is positioned relative to horizontal text.</div> + </div> + <div class="settings-item-right"> + <select data-setting="general.popupHorizontalTextPosition"> + <option value="below">Below text</option> + <option value="above">Above text</option> + </select> + </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">Vertical text positioning</div> + <div class="settings-item-description">Change where the popup is positioned relative to vertical text.</div> + </div> + <div class="settings-item-right"> + <select data-setting="general.popupVerticalTextPosition"> + <option value="default">Same as for horizontal text</option> + <option value="before">Before text reading direction</option> + <option value="after">After text reading direction</option> + <option value="left">Left of text</option> + <option value="right">Right of text</option> + </select> + </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">Horizontal text offset</div> + <div class="settings-item-description">Change the distance the popup is placed relative to horizontal text.</div> + </div> + <div class="settings-item-right"> + <div class="settings-item-group"> + <div class="settings-item-group-item"> + <div class="settings-item-group-item-label">x</div> + <input type="number" class="short-width short-height" data-setting="general.popupHorizontalOffset"> + </div> + <div class="settings-item-group-item"> + <div class="settings-item-group-item-label">y</div> + <input type="number" class="short-width short-height" data-setting="general.popupVerticalOffset"> + </div> + </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">Vertical text offset</div> + <div class="settings-item-description">Change the distance the popup is placed relative to vertical text.</div> + </div> + <div class="settings-item-right"> + <div class="settings-item-group"> + <div class="settings-item-group-item"> + <div class="settings-item-group-item-label">x</div> + <input type="number" class="short-width short-height" data-setting="general.popupHorizontalOffset2"> + </div> + <div class="settings-item-group-item"> + <div class="settings-item-group-item-label">y</div> + <input type="number" class="short-width short-height" data-setting="general.popupVerticalOffset2"> + </div> + </div> + </div> + </div></div> + </div> + + <h2 id="audio">Audio</h2> + <div class="settings-group"> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Enable audio playback for terms</div> + <div class="settings-item-description">Show a clickable speaker icon next to search results.</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="audio.enabled"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div></div> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Auto-play search result audio</div> + <div class="settings-item-description">The audio for the first result will be played automatically.</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="audio.autoPlay"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div></div> + <div class="settings-item"><div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label">Audio volume</div> + <div class="settings-item-description">Adjust the volume audio is played at, in percent.</div> + </div> + <div class="settings-item-right"> + <input type="number" data-setting="audio.volume" min="0" max="100"> + </div> + </div></div> + <div class="settings-item settings-item-button" data-modal-action="show,audio-sources"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Audio playback sources</div> + </div> + <div class="settings-item-right open-panel-button-container"> + <button class="icon-button"><span class="icon-button-inner"><span class="icon-button-icon" data-icon="right-arrow"></span></span></button> + </div> + </div></div> + </div> + + <h2 id="scanning">Scanning</h2> + <div class="settings-group"> + <div class="settings-item"> + <div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label">Scan modifier key</div> + <div class="settings-item-description"> + Hold a key while moving the cursor to scan text. + <a class="more-toggle more-only" data-parent-distance="4">More…</a> + </div> + </div> + <div class="settings-item-right"> + <select id="main-scan-modifier-key"></select> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + A keyboard modifier key can be used to activate text scanning when the cursor is moved. + Alternatively, the <em>None</em> option can be used to scan text whenever the cursor is moved. + </p> + <p> + More advanced scanning input customization can be set up by enabling the <em>Advanced</em> option + and clicking <em data-modal-action="show,scanning-inputs">Configure advanced scanning inputs</em>. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Scan using middle mouse button</div> + <div class="settings-item-description">Hold the middle mouse button while moving the cursor to scan text.</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" id="middle-mouse-button-scan"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div></div> + <div class="settings-item settings-item-button advanced-only" data-modal-action="show,scanning-inputs"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Configure advanced scanning inputs <span class="light no-wrap">(<span class="scanning-input-count">#</span> defined)</span></div> + </div> + <div class="settings-item-right open-panel-button-container"> + <button class="icon-button"><span class="icon-button-inner"><span class="icon-button-icon" data-icon="right-arrow"></span></span></button> + </div> + </div></div> + <div class="settings-item"> + <div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label"> + Support inputs for devices with touch screens + <a class="more-toggle more-only" data-parent-distance="4">(?)</a> + </div> + </div> + <div class="settings-item-right flex-row-wrap"> + <div class="settings-item-group settings-item-group-wrap"> + <label class="settings-item-group-item flex-label no-wrap"> + <label class="checkbox"><input type="checkbox" data-setting="scanning.touchInputEnabled"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Touch inputs</span> + </label> + <label class="settings-item-group-item flex-label no-wrap advanced-only"> + <label class="checkbox"><input type="checkbox" data-setting="scanning.pointerEventsEnabled"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Pointer inputs</span> + </label> + </div> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + To enable text scanning when using devices with a touch screen, either the <em>Touch inputs</em> or the <em>Pointer inputs</em> option must be enabled. + <em>Touch inputs</em> supports generic touches on a touch screen device, but do not distinguish between touch and pen inputs. + <em>Pointer inputs</em> supports supports the detection pen devices, but may not work on all devices. + If both options are enabled, <em>Pointer inputs</em> takes precedence. + </p> + <p> + The <em>Pointer inputs</em> option is only visible when the <em>Advanced</em> option is enabled. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + <div class="settings-item"> + <div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Auto-hide search popup</div> + <div class="settings-item-description">When no key or button is required for scanning, the popup will hide automatically.</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="scanning.autoHideResults" data-transform="setVisibility" data-ancestor-distance="-1" data-relative-selector="#auto-hide-search-popup-options" data-visbility-condition='{"op":"===","value":true}'><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div> + <div class="settings-item-children settings-item-children-group" id="auto-hide-search-popup-options" hidden> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Auto-hide delay <span class="light">(in milliseconds)</span></div> + </div> + <div class="settings-item-right"> + <input type="number" data-setting="scanning.hideDelay" min="0"> + </div> + </div></div> + </div> + </div> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Scan delay <span class="light">(in milliseconds)</span></div> + <div class="settings-item-description">When no key or button is required for scanning, the delay before scanning occurs.</div> + </div> + <div class="settings-item-right"> + <input type="number" data-setting="scanning.delay" min="0"> + </div> + </div></div> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Select matched text</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="scanning.selectText"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div></div> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Search text with non-Japanese characters</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="scanning.alphanumeric"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div></div> + <div class="settings-item advanced-only"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Layout-aware scanning</div> + <div class="settings-item-description">Use webpage styling information to determine where line breaks are likely to be.</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="scanning.layoutAwareScan"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div></div> + <div class="settings-item advanced-only"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Deep content scanning</div> + <div class="settings-item-description">Enable scanning text that is covered by other layers.</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="scanning.deepDomScan"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </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">Text scan length</div> + <div class="settings-item-description">Change how many characters are read when scanning for terms.</div> + </div> + <div class="settings-item-right"> + <input type="number" data-setting="scanning.length" min="1" step="1"> + </div> + </div></div> + <div class="settings-item settings-item-button advanced-only" data-modal-action="show,input-action-prevention"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Configure input action prevention</div> + </div> + <div class="settings-item-right open-panel-button-container"> + <button class="icon-button"><span class="icon-button-inner"><span class="icon-button-icon" data-icon="right-arrow"></span></span></button> + </div> + </div></div> + </div> + + <div> + <div class="heading-container"> + <div class="heading-container-left"><h2 id="text-parsing">Text Parsing</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 attempt to parse entire sentences or longer text blocks on the search page, + adding furigana above words and optional space between words. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + <div class="settings-group"> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Parse text using installed dictionaries</div> + <div class="settings-item-description">Words are scanned by automatically advancing in the sentence after a matching word.</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="parsing.enableScanningParser"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div></div> + <div class="settings-item advanced-only"> + <div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Parse text using <a href="https://en.wikipedia.org/wiki/MeCab" target="_blank" rel="noopener noreferrer">MeCab</a></div> + <div class="settings-item-description"> + Requires a native component to be installed that Yomichan will connect to. + <a class="more-toggle more-only" data-parent-distance="4">More…</a> + </div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="parsing.enableMecabParser"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + MeCab is a third-party program which uses its own dictionaries and parsing algorithm to decompose sentences into individual words. + In order for Yomichan to use it, both MeCab and a native messaging component must be installed. + A setup guide can be found <a href="https://github.com/siikamiika/yomichan-mecab-installer/blob/master/README.md" target="_blank" rel="noopener noreferrer">here</a>. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Show space between parsed words</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="parsing.termSpacing"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div></div> + <div class="settings-item"><div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label">Reading mode</div> + <div class="settings-item-description">Change what type of furigana is displayed for parsed text.</div> + </div> + <div class="settings-item-right"> + <select data-setting="parsing.readingMode"> + <option value="hiragana">ひらがな</option> + <option value="katakana">カタカナ</option> + <option value="romaji">Romaji</option> + <option value="none">Disabled</option> + </select> + </div> + </div></div> + </div> + + <div> + <div class="heading-container"> + <div class="heading-container-left"><h2 id="translation">Translation</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> + The following options are used during the translation process to create alternate versions of the input text to search for. + This can be helpful when the input text doesn't exactly match the term or expression found in the database. + </p> + <p> + The conversion options below are listed in the order that the conversions are applied to the input text. + Most of the conversions have three possible values: + </p> + <ul> + <li> + <strong>Disabled</strong> - + This conversion will never be applied to the input text. + </li> + <li> + <strong>Enabled</strong> - + This conversion will always be applied to the input text. + </li> + <li> + <strong>Use both variants</strong> - + The translator will check the database for two variations: the raw input text and the converted input text. + When multiple options use variants, the translator will search for combinations of the converted text. + </li> + </ul> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + <div class="settings-group"> + <div class="settings-item"><div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label">Convert half width characters to full width</div> + <div class="settings-item-description">ヨミチャン → ヨミチャン</div> + </div> + <div class="settings-item-right"> + <select data-setting="translation.convertHalfWidthCharacters"> + <option value="false">Disabled</option> + <option value="true">Enabled</option> + <option value="variant">Use both variants</option> + </select> + </div> + </div></div> + <div class="settings-item"><div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label">Convert numeric characters to full width</div> + <div class="settings-item-description">1234 → 1234</div> + </div> + <div class="settings-item-right"> + <select data-setting="translation.convertNumericCharacters"> + <option value="false">Disabled</option> + <option value="true">Enabled</option> + <option value="variant">Use both variants</option> + </select> + </div> + </div></div> + <div class="settings-item"><div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label">Convert alphabetic characters to hiragana</div> + <div class="settings-item-description">yomichan → よみちゃん</div> + </div> + <div class="settings-item-right"> + <select data-setting="translation.convertAlphabeticCharacters"> + <option value="false">Disabled</option> + <option value="true">Enabled</option> + <option value="variant">Use both variants</option> + </select> + </div> + </div></div> + <div class="settings-item"><div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label">Convert hiragana to katakana</div> + <div class="settings-item-description">よみちゃん → ヨミチャン</div> + </div> + <div class="settings-item-right"> + <select data-setting="translation.convertHiraganaToKatakana"> + <option value="false">Disabled</option> + <option value="true">Enabled</option> + <option value="variant">Use both variants</option> + </select> + </div> + </div></div> + <div class="settings-item"><div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label">Convert katakana to hiragana</div> + <div class="settings-item-description">ヨミチャン → よみちゃん</div> + </div> + <div class="settings-item-right"> + <select data-setting="translation.convertKatakanaToHiragana"> + <option value="false">Disabled</option> + <option value="true">Enabled</option> + <option value="variant">Use both variants</option> + </select> + </div> + </div></div> + <div class="settings-item"><div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label">Collapse emphatic character sequences</div> + <div class="settings-item-description">すっっごーーい → すっごーい / すごい</div> + </div> + <div class="settings-item-right"> + <select data-setting="translation.collapseEmphaticSequences"> + <option value="false">Disabled</option> + <option value="true">Collapse into single character</option> + <option value="full">Remove all characters</option> + </select> + </div> + </div></div> + </div> + + <div> + <div class="heading-container"> + <div class="heading-container-left"><h2 id="anki">Anki</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 supports automatic flashcard creation for <a href="https://apps.ankiweb.net/" target="_blank" rel="noopener noreferrer">Anki</a>, + a free application designed to assist in remembering information. + This feature requires installation of the <a href="https://foosoft.net/projects/anki-connect/" target="_blank" rel="noopener noreferrer">AnkiConnect</a> plugin. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + <div class="settings-group"> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Enable Anki integration</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="anki.enable"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div></div> + <div class="settings-item"> + <div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label">AnkiConnect server address</div> + <div class="settings-item-description"> + Change the URL of the AnkiConnect server. + <a class="more-toggle more-only" data-parent-distance="4">More…</a> + </div> + </div> + <div class="settings-item-right"> + <input type="text" placeholder="http://127.0.0.1:8765" spellcheck="false" autocomplete="off" data-setting="anki.server"> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + The default address for a server on the same device is <a href="http://127.0.0.1:8765" target="_blank" rel="noopener noreferrer">http://127.0.0.1:8765</a>. + If Anki is running and AnkiConnect is installed, clicking this URL should open a page showing the current version of AnkiConnect. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + <div class="settings-item"><div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label">Card tags</div> + <div class="settings-item-description">List of space or comma separated tags to add to the card.</div> + </div> + <div class="settings-item-right"> + <input type="text" spellcheck="false" autocomplete="off" data-setting="anki.tags" data-transform-pre="splitTags" data-transform-post="joinTags"> + </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">Check for card duplicates</div> + <div class="settings-item-description">When a card is detected as a duplicate, the add buttons will be disabled.</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="anki.checkForDuplicates" data-transform="setVisibility" data-ancestor-distance="-1" data-relative-selector="#anki-card-duplicate-options" data-visbility-condition='{"op":"===","value":true}'><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div> + <div class="settings-item-children settings-item-children-group" id="anki-card-duplicate-options" hidden> + <div class="settings-item"> + <div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label"> + Duplicate card scope + <a class="more-toggle more-only" data-parent-distance="4">(?)</a> + </div> + </div> + <div class="settings-item-right"> + <select data-setting="anki.duplicateScope"> + <option value="collection">Collection</option> + <option value="deck">Deck</option> + <option value="deck-root">Deck root</option> + </select> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + A card is considered a duplicate if the value of the first field matches that of any other card. + By default, this check will include cards across all decks in a collection, but this constraint can be relaxed + by using either the <em>Deck</em> or <em>Deck root</em> option. + </p> + <p> + The <em>Deck</em> option will only check for duplicates in the target deck. + The <em>Deck root</em> option will additionally check for duplicates in all child decks of the root deck. + This allows adding cards that are unique for decks including a subdeck structure. + For decks which don't have any parent-child hierarchy, both options function the same. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </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">Screenshot format</div> + <div class="settings-item-description">Adjust the format and quality of screenshots created for cards.</div> + </div> + <div class="settings-item-right"> + <div class="settings-item-group"> + <div class="settings-item-group-item" id="anki-screenshot-quality" hidden> + <div class="settings-item-group-item-label">Quality (%)</div> + <input type="number" class="short-width short-height" data-setting="anki.screenshot.quality" min="0" max="100" step="1"> + </div> + <div class="settings-item-group-item"> + <div class="settings-item-group-item-label">Format</div> + <select class="short-width short-height" data-setting="anki.screenshot.format" + data-transform="setVisibility" + data-ancestor-distance="-1" + data-relative-selector="#anki-screenshot-quality" + data-visbility-condition='{"op":"===","value":"jpeg"}' + > + <option value="png">PNG</option> + <option value="jpeg">JPEG</option> + </select> + </div> + </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> + </div> + <div class="settings-item-right open-panel-button-container"> + <button class="icon-button"><span class="icon-button-inner"><span class="icon-button-icon" data-icon="right-arrow"></span></span></button> + </div> + </div></div> + <div class="settings-item settings-item-button advanced-only" data-modal-action="show,anki-card-templates"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Configure Anki card templates</div> + </div> + <div class="settings-item-right open-panel-button-container"> + <button class="icon-button"><span class="icon-button-inner"><span class="icon-button-icon" data-icon="right-arrow"></span></span></button> + </div> + </div></div> + </div> + + <h2 id="shortcuts">Shortcuts</h2> + <div class="settings-group"> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label"> + <p> + Yomichan includes keyboard shortcuts for some common actions that can be configured + using the web browser's settings. + Instructions on how to access this settings page are listed below for a few browsers. + </p> + + <h3>Chrome</h3> + <ul> + <li>Open the settings page (<a href="chrome://settings/">chrome://settings/</a>)</li> + <li>Click the "Extensions" link in the left sidebar (<a href="chrome://extensions/">chrome://extensions/</a>)</li> + <li>Open the left side panel using the hamburger (<strong>≡</strong>) menu button, then click "Keyboard shortcuts"</li> + </ul> + + <h3>Firefox</h3> + <ul> + <li>Open the extensions page (<a href="about:addons">about:addons</a>)</li> + <li>Click the button on the right with the gear icon, then click "Manage Extension Shortcuts"</li> + </ul> + </div> + </div> + </div></div> + </div> + + <h2 id="backup">Backup</h2> + <div class="settings-group"> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label"> + Yomichan can import and export settings files which can be used to restore settings, share settings across devices, and to help to debug problems. + These files will only contain settings and will not contain dictionaries. + Dictionaries must be imported separately. + </div> + </div> + </div></div> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-right settings-item-button-group-container"> + <div class="settings-item-button-group"> + <div class="settings-item-button-group-item"> + <button class="low-emphasis" id="settings-import-button">Import Settings</button> + <div hidden><input type="file" id="settings-import-file" accept=".json,application/json"></div> + </div> + <div class="settings-item-button-group-item"> + <button class="low-emphasis" id="settings-export-button">Export Settings</button> + </div> + <div class="settings-item-button-group-item"> + <button class="low-emphasis danger" id="settings-reset-button">Reset Settings</button> + </div> + </div> + </div> + </div></div> + </div> + + <h2 id="security" class="advanced-only">Security</h2> + <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"> + Use a secure container around popups + <a class="more-toggle more-only" data-parent-distance="4">(?)</a> + </div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="general.usePopupShadowDom"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + On <a href="https://caniuse.com/shadowdomv1" target="_blank" rel="noopener noreferrer">supported browsers</a>, + a popup's <code>iframe</code> element will be embeded inside of a container with a closed <a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM" target="_blank" rel="noopener noreferrer">shadow DOM</a>. + This container prevents scripts running on the underlying web page from being able to discover the <code>iframe</code>, + which helps avoid situations where the web page might try to modify or use the Yomichan popup for an unintended purpose. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + <div class="settings-item"> + <div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label"> + Use secure popup frame URL + <a class="more-toggle more-only" data-parent-distance="4">(?)</a> + </div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="general.useSecurePopupFrameUrl"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + When this option is enabled, the URL of the <code>iframe</code> element will be assigned by + directly changing the location of the <code>iframe</code>'s internal document, rather than using + the <code>iframe</code>'s <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-src" target="_blank" rel="noopener noreferrer"><code>src</code></a> + attribute. This results in the extension URL not being exposed to the underling web page, and thus making it harder + to detect the presence of Yomichan. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + </div> + + <div class="footer-padding"></div> + +</div> +<div class="content-right"> + <div class="preview-sidebar"><div class="preview-sidebar-inner"> + <div class="preview-sidebar-setting"> + <label class="show-preview-switch"><span class="show-preview-switch-inner"> + <label class="toggle"><input type="checkbox" id="show-preview-checkbox"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + <span class="show-preview-switch-label">Show popup preview</span> + </span></label> + </div> + <div class="preview-frame-container"> + <iframe src="/bg/popup-preview.html" class="preview-frame" id="popup-preview-frame"></iframe> + </div> + </div></div> +</div> +</div></div> + + +<!-- Auxiliary content --> +<div class="content-dimmer"></div> + +<div class="fab-container"> + <div class="fab-container-left"></div> + <div class="fab-container-center"></div> + <div class="fab-container-right"> + <div class="fab-container-right-inner1"><div class="fab-container-right-inner2"> + <div class="fab-container-item fab-container-item-popup-preview"> + <button class="fab-button icon-button" data-action="toggle-preview-sidebar"><span class="icon-button-inner"><span class="fab-button-background"></span><span class="icon-button-icon" data-icon="popup"></span></span></button> + </div> + <div class="fab-container-item"> + <button class="fab-button icon-button" data-action="toggle-sidebar"><span class="icon-button-inner"><span class="fab-button-background"></span><span class="icon-button-icon" data-icon="hamburger-menu"></span></span></button> + </div> + </div></div> + </div> +</div> + +<div class="status-footer-container"><div class="status-footer-container2"> + <div class="status-footer"> + <div class="status-footer-header"><div class="status-footer-header-label">Tasks in progress:</div><a class="status-footer-header-close">Close</a></div> + <div class="status-footer-item dictionary-delete-progress" hidden> + <div class="progress-labels"><div class="progress-info"></div><div class="progress-status"></div></div> + <div class="progress-bar-track"><div class="progress-bar danger"></div></div> + </div> + <div class="status-footer-item dictionary-import-progress" hidden> + <div class="progress-labels"><div class="progress-info"></div><div class="progress-status"></div></div> + <div class="progress-bar-track"><div class="progress-bar"></div></div> + </div> + </div> +</div></div> + +<div id="popup-menus"></div> + + +<!-- Profile modals --> +<div id="profiles" class="modal-container" tabindex="-1" role="dialog"><div class="modal-content"> + <div class="modal-header"><div class="modal-title">Profiles</div></div> + <div class="modal-body"> + <div class="profile-entry-header"> + <div class="profile-entry-cell"></div> + <div class="profile-entry-cell"><span class="profile-entry-header-text">Default</span></div> + <div class="profile-entry-cell"><span class="profile-entry-header-text">Name</span></div> + <div class="profile-entry-cell"><span class="profile-entry-header-text">Conditions</span></div> + <div class="profile-entry-cell"></div> + </div> + <div class="profile-entry-list generic-list" id="profile-entry-list"></div> + <div class="profile-add-button-container"> + <button class="low-emphasis" id="profile-add-button">Add</button> + </div> + </div> + <div class="modal-footer"> + <button data-modal-action="hide">Close</button> + </div> +</div></div> + +<div id="profile-conditions" class="modal-container" tabindex="-1" role="dialog"><div class="modal-content"> + <div class="modal-header"><div class="modal-title">Profile Conditions</div></div> + <div class="modal-body"> + <div class="settings-item"> + <div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label"> + Conditions for profile <em id="profile-conditions-profile-name"></em>: + </div> + </div> + <div class="settings-item-right"> + <a class="more-toggle more-only" data-parent-distance="3">Info…</a> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + Profile usage conditions are used to automatically select certain profiles based on context. + For example, different profiles can be used depending on the nested level of the popup, or based on the website's URL. + </p> + <p> + Conditions are organized into groups corresponding to the order in which they are checked. + If all of the conditions in any group of a profile are met, then that profile will be used for that context. + </p> + <p> + If no conditions are specified, the profile will only be used if it is selected as the default profile. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Hide…</a> + </p> + </div> + </div> + <div class="profile-condition-groups" id="profile-condition-groups"></div> + <div class="profile-condition-group-list-info"> + <div class="profile-condition-groups-empty-info"><em>No conditions set up.</em></div> + <div class="profile-condition-group-list-info-space"></div> + <button class="low-emphasis" id="profile-add-condition-group">Add Group</button> + </div> + </div> + <div class="modal-footer"> + <button data-modal-action="hide">Close</button> + </div> +</div></div> + +<div id="profile-copy" class="modal-container" tabindex="-1" role="dialog"><div class="modal-content modal-content-small"> + <div class="modal-header"><div class="modal-title">Copy Profile</div></div> + <div class="modal-body"> + <p>Select which profile to copy options from:</p> + <select class="form-control" id="profile-copy-source-select"></select> + </div> + <div class="modal-footer"> + <button class="low-emphasis" data-modal-action="hide">Cancel</button> + <button id="profile-copy-confirm-button">Copy Profile</button> + </div> +</div></div> + +<div id="profile-remove" class="modal-container" tabindex="-1" role="dialog"><div class="modal-content modal-content-small"> + <div class="modal-header"><div class="modal-title">Confirm Profile Deletion</div></div> + <div class="modal-body"> + <p> + Are you sure you want to delete the profile <em id="profile-remove-name"></em>? + </p> + </div> + <div class="modal-footer"> + <button class="low-emphasis" data-modal-action="hide">Cancel</button> + <button class="danger" id="profile-remove-confirm-button">Remove Profile</button> + </div> +</div></div> + + +<!-- Dictionary modals --> +<div id="dictionaries" class="modal-container" tabindex="-1" role="dialog"><div class="modal-content modal-content-full"> + <div class="modal-header"><div class="modal-title">Dictionaries</div></div> + <div class="modal-body"> + <div class="settings-item"> + <div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label"> + Enable support for prefix wildcard searches + <a class="more-toggle more-only" data-parent-distance="4">(?)</a> + </div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" data-setting="global.database.prefixWildcardsSupported" data-scope="global"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + In order for dictionaries to support searches using prefix wildcards on the search page, + some additional data must be stored in the database. + Enabling this option will include this extra data for any new dictionaries that are imported. + </p> + <p class="warning-text"> + This option will not change any dictionaries that are already imported; + they must be re-imported for the option to take effect. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Hide…</a> + </p> + </div> + </div> + + <div class="warning-text margin-above no-dictionaries-installed-warning" hidden> + No dictionaries have been installed yet. + Visit the <a href="https://foosoft.net/projects/yomichan/#dictionaries" target="_blank" rel="noopener noreferrer">Yomichan homepage</a> + for a list free dictionaries or click the <em>Import</em> button below to select a dictionary file to import. + </div> + <div id="dictionary-error" class="danger-text margin-above" hidden></div> + <div id="dictionary-list" class="dictionary-list"></div> + <div id="dictionary-list-extra" class="dictionary-list"></div> + + <div hidden><input type="file" id="dictionary-import-file-input" accept=".zip,application/zip" multiple></div> + </div> + <div class="modal-body-addon dictionary-delete-progress" hidden> + <div class="progress-labels"><div class="progress-info"></div><div class="progress-status"></div></div> + <div class="progress-bar-track"><div class="progress-bar danger"></div></div> + </div> + <div class="modal-body-addon dictionary-import-progress" hidden> + <div class="progress-labels"><div class="progress-info"></div><div class="progress-status"></div></div> + <div class="progress-bar-track"><div class="progress-bar"></div></div> + </div> + <div class="modal-footer"> + <button class="low-emphasis danger dictionary-database-mutating-input" id="dictionary-delete-all-button">Delete All</button> + <button class="low-emphasis dictionary-database-mutating-input" id="dictionary-check-integrity">Check Integrity</button> + <button class="low-emphasis dictionary-database-mutating-input" id="dictionary-import-file-button">Import</button> + <button data-modal-action="hide">Close</button> + </div> +</div></div> + +<div id="dictionary-confirm-delete" class="modal-container" tabindex="-1" role="dialog"><div class="modal-content modal-content-small"> + <div class="modal-header"><div class="modal-title">Confirm Dictionary Deletion</div></div> + <div class="modal-body"> + <p>Are you sure you want to delete the dictionary:</p> + <p><strong id="dictionary-confirm-delete-name"></strong>?</p> + <p class="danger-text">This action cannot be undone.</p> + </div> + <div class="modal-footer"> + <button class="low-emphasis" data-modal-action="hide">Cancel</button> + <button class="danger" data-modal-action="hide" id="dictionary-confirm-delete-button">Delete</button> + </div> +</div></div> + +<div id="dictionary-confirm-delete-all" class="modal-container" tabindex="-1" role="dialog"><div class="modal-content modal-content-small"> + <div class="modal-header"><div class="modal-title">Confirm Dictionary Deletion</div></div> + <div class="modal-body"> + <p>Are you sure you want to delete <strong>all dictionaries</strong>?</p> + <p class="danger-text">This action cannot be undone.</p> + </div> + <div class="modal-footer"> + <button class="low-emphasis" data-modal-action="hide">Cancel</button> + <button class="danger" data-modal-action="hide" id="dictionary-confirm-delete-all-button">Delete</button> + </div> +</div></div> + +<div id="secondary-search-dictionaries" class="modal-container" tabindex="-1" role="dialog"><div class="modal-content"> + <div class="modal-header"><div class="modal-title">Secondary Search Dictionaries</div></div> + <div class="modal-body"> + <p> + These dictionaries will be used to search for definitions of the related terms when the grouping mode is + <em>Group related terms</em>. + </p> + <div id="secondary-search-dictionary-list" class="dictionary-list margin-above"></div> + </div> + <div class="modal-footer"> + <button data-modal-action="hide">Close</button> + </div> +</div></div> + + +<!-- Custom CSS modal --> +<div id="custom-css" class="modal-container modal-container-left" tabindex="-1" role="dialog"><div class="modal-content-container1"> + <div class="modal-content-container2 modal-content-dimmer"><div class="modal-content"> + <div class="modal-header"><div class="modal-title">Custom CSS</div></div> + <div class="modal-body custom-popup-css-container"> + <div class="custom-popup-css-header">Popup CSS</div> + <textarea autocomplete="off" spellcheck="false" wrap="off" id="custom-popup-css" data-setting="general.customPopupCss" data-tab-action="indent,4"></textarea> + <div class="custom-popup-css-header margin-above">Popup outer CSS</div> + <textarea autocomplete="off" spellcheck="false" wrap="off" id="custom-popup-outer-css" data-setting="general.customPopupOuterCss" data-tab-action="indent,4"></textarea> + </div> + <div class="modal-footer"> + <button data-modal-action="hide">Close</button> + </div> + </div></div> + <div class="modal-content-container1-fade"></div> +</div></div> + + +<!-- Audio sources modal --> +<div id="audio-sources" class="modal-container" tabindex="-1" role="dialog"><div class="modal-content"> + <div class="modal-header"><div class="modal-title">Audio Sources</div></div> + <div class="modal-body"> + <div class="settings-item"> + <div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label"> + Text-to-speech voice + <a class="more-toggle more-only" data-parent-distance="4">(?)</a> + </div> + </div> + <div class="settings-item-right"> + <select data-setting="audio.textToSpeechVoice" id="text-to-speech-voice"></select> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + Change which voice is used for text-to-speech audio playback. + </p> + <div class="horizontal-flex"> + <input type="text" value="よみちゃん" id="text-to-speech-voice-test-text" autocomplete="off"> + <button id="text-to-speech-voice-test">Test</button> + <a class="more-toggle" data-parent-distance="3">Hide…</a> + </div> + </div> + </div> + <div class="settings-item"> + <div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label"> + Custom audio source + <a class="more-toggle more-only" data-parent-distance="4">(?)</a> + </div> + </div> + <div class="settings-item-right"> + <input type="text" spellcheck="false" autocomplete="off" data-setting="audio.customSourceUrl" placeholder="None"> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + URL format used for fetching audio clips in <em>Custom</em> mode. + The replacement tags <code data-select-on-click="">{expression}</code> and <code data-select-on-click="">{reading}</code> can be used to specify which + expression and reading is being looked up.<br> + Example: <a data-select-on-click="">http://localhost/audio.mp3?expression={expression}&reading={reading}</a> + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + </div> + <div class="settings-item"> + <div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label"> + Audio sources + <a class="more-toggle more-only" data-parent-distance="4">(?)</a> + </div> + </div> + <div class="settings-item-right"> + <button id="audio-source-add" class="low-emphasis">Add</button> + </div> + </div> + <div class="settings-item-children more" hidden> + <p> + When searching for audio, the sources are checked in order until the first + valid source is found. This allows for selecting a fallback source if the + first choice is not available. + </p> + <p> + <a class="more-toggle" data-parent-distance="3">Less…</a> + </p> + </div> + <div class="settings-item-children"> + <div id="audio-source-list" class="generic-list"></div> + <div id="audio-source-list-empty"> + No audio sources enabled + </div> + </div> + </div> + </div> + <div class="modal-footer"> + <button data-modal-action="hide">Close</button> + </div> +</div></div> + + +<!-- Scanning inputs modal --> +<div id="scanning-inputs" class="modal-container" tabindex="-1" role="dialog"><div class="modal-content modal-content-full"> + <div class="modal-header"><div class="modal-title">Scanning Inputs</div></div> + <div class="modal-body"> + <div> + <p> + Scanning inputs are used to define when text scanning should occur. + <a class="more-toggle more-only" data-parent-distance="2">More…</a> + </p> + <div class="margin-above more" hidden> + <p> + Text scanning is performed when a pointer is moved and certain inputs are either pressed or not pressed. + The <em>Required inputs</em> field is used to define which inputs <em>must</em> be pressed, and + the <em>Excluded inputs</em> field is used to define which inputs <em>must not</em> be pressed. + If the <em>Required inputs</em> field is empty, text will be scanned whenever the pointer is moved. + </p> + <p> + The <em>Input types</em> group is used to define which types of pointer input that the + keyboard and button inputs are applied to. + Supported pointer types include the mouse cursor, touchscreen touches, and pen devices. + When using the <em>Pen</em> option, the defined inputs will correspond to buttons on the pen device. + </p> + <p> + Some additional scanning and search options can be configured by clicking the menu button and selecting + <em>Show advanced options</em>. + </p> + <ul> + <li>To assign keyboard keys, select the input field and press modifier keys on the keyboard.</li> + <li>To assign mouse or pen buttons, click on the button with the mouse icon using the desired button.</li> + <li> + To clear inputs, select the input field and press the <em>Escape</em> button, + or use the <em>Clear inputs</em> menu option. + </li> + </ul> + <p><a class="more-toggle" data-parent-distance="3">Less…</a></p> + </div> + </div> + <div class="scan-input-list generic-list margin-above" id="scan-input-list"></div> + <div class="scan-input-list-empty-info warning-text margin-above"> + No scanning inputs have been defined yet. + Click the <em>Add</em> button to add a new input. + </div> + <div class="flex-row-nowrap right"><button class="low-emphasis" id="scan-input-add">Add</button></div> + </div> + <div class="modal-footer"> + <button data-modal-action="hide">Close</button> + </div> +</div></div> + + +<!-- Input action prevention modal --> +<div id="input-action-prevention" class="modal-container" tabindex="-1" role="dialog"><div class="modal-content modal-content-small"> + <div class="modal-header"><div class="modal-title">Input Action Prevention</div></div> + <div class="modal-body"> + <strong>Prevent middle mouse button actions on:</strong> + <div class="flex-column-nowrap flex-column-nowrap-spaced margin-left"> + <label class="flex-label"> + <label class="checkbox"><input type="checkbox" data-setting="scanning.preventMiddleMouse.onWebPages"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Webpages</span> + </label> + <label class="flex-label"> + <label class="checkbox"><input type="checkbox" data-setting="scanning.preventMiddleMouse.onPopupPages"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Popups</span> + </label> + <label class="flex-label"> + <label class="checkbox"><input type="checkbox" data-setting="scanning.preventMiddleMouse.onSearchPages"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Search page</span> + </label> + <label class="flex-label"> + <label class="checkbox"><input type="checkbox" data-setting="scanning.preventMiddleMouse.onSearchQuery"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Search query</span> + </label> + </div> + </div> + <div class="modal-footer"> + <button data-modal-action="hide">Close</button> + </div> +</div></div> + + +<!-- Anki cards modal --> +<div id="anki-cards" class="modal-container" tabindex="-1" role="dialog"><div class="modal-content modal-content-full"> + <div class="modal-header"><div class="modal-title">Anki Cards</div></div> + <div class="modal-body anki-card" id="anki-card-primary" data-anki-card-type="terms" data-anki-card-menu="anki-card-terms-field-menu"> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Card type</div> + </div> + <div class="settings-item-right"> + <select id="anki-card-primary-type"> + <option value="terms" data-anki-card-menu="anki-card-terms-field-menu" selected>Terms</option> + <option value="kanji" data-anki-card-menu="anki-card-kanji-field-menu">Kanji</option> + </select> + </div> + </div></div> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Deck</div> + </div> + <div class="settings-item-right"> + <select class="anki-card-deck"></select> + </div> + </div></div> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Model</div> + </div> + <div class="settings-item-right"> + <select class="anki-card-model"></select> + </div> + </div></div> + <div class="anki-card-fields"> + <div class="anki-card-field-name-header" data-persistent="true">Field</div> + <div class="anki-card-field-input-header" data-persistent="true">Value</div> + </div> + </div> + <div class="modal-body-addon" id="anki-error" hidden> + <p class="danger-text"> + <strong>Anki connection error:</strong> + <span id="anki-error-message"></span><a id="anki-error-message-details-toggle">…</a> + </p> + <p class="danger-text" id="anki-error-invalid-response-info" hidden> + Attempting to connect to Anki can sometimes return an error message which includes "Invalid response", + which may indicate that the value of the <em>AnkiConnect server address</em> option is incorrect. + Resetting it to the default value may fix issues that are occurring. + </p> + <div class="danger-text" id="anki-error-message-details" hidden></div> + </div> + <div class="modal-footer"> + <button class="low-emphasis" data-modal-action="show,anki-cards-info">Help</button> + <button data-modal-action="hide">Close</button> + </div> +</div></div> + +<div id="anki-cards-info" class="modal-container" tabindex="-1" role="dialog"><div class="modal-content modal-content-full"> + <div class="modal-header"><div class="modal-title">Anki Card Information</div></div> + <div class="modal-body"> + <p> + Anki card fields can be populated with information about a term or kanji character by using field markers. + When a card is being generated, field markers are replaced with information about the term or kanji by using the installed dictionaries. + Several preset markers are available, which are described below. + Markers can be customized by adjusting the <a data-modal-action="show,anki-card-templates">Anki card templates</a>. + </p> + <p> + Anki requires the first field in a model to be unique for a card; + therefore, it is recommended to use <code class="anki-field-marker">{expression}</code> as the marker for the first field of term cards, + or <code class="anki-field-marker">{character}</code> for kanji cards. + </p> + <table class="anki-field-marker-info-table margin-above"> + <thead> + <tr> + <td>Marker (for terms)</td> + <td>Description</td> + </tr> + </thead> + <tbody> + <tr> + <td><code class="anki-field-marker">{audio}</code></td> + <td>Audio sample of a native speaker's pronunciation in MP3 format, if available.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{conjugation}</code></td> + <td>Conjugation path from the raw inflected term to the source term.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{expression}</code></td> + <td>Term expressed using kanji. If kanji expression is not available, kana is used.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{furigana}</code></td> + <td> + Term expressed as kanji with furigana displayed above it. + Example: <ruby>日本語<rt>にほんご</rt></ruby>. + </td> + </tr> + <tr> + <td><code class="anki-field-marker">{furigana-plain}</code></td> + <td> + Term expressed as kanji with furigana displayed next to it in brackets. + Example: 日本語[にほんご]. + </td> + </tr> + <tr> + <td><code class="anki-field-marker">{glossary}</code></td> + <td>List of definitions for the term.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{glossary-brief}</code></td> + <td>List of definitions for the term in a more compact format.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{pitch-accents}</code></td> + <td>List of pitch accent downstep notations for the term.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{pitch-accent-graphs}</code></td> + <td>List of pitch accent graphs for the term.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{pitch-accent-positions}</code></td> + <td>List of accent downstep positions for the term as a number.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{reading}</code></td> + <td>Kana reading for the term, or empty for terms where the expression is the reading.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{tags}</code></td> + <td>Grammar and usage tags providing information about the term.</td> + </tr> + </tbody> + <thead> + <tr> + <td>Marker (for kanji)</td> + <td>Description</td> + </tr> + </thead> + <tbody> + <tr> + <td><code class="anki-field-marker">{character}</code></td> + <td>Unicode glyph representing the current kanji.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{glossary}</code></td> + <td>List of definitions for the kanji.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{kunyomi}</code></td> + <td>Kunyomi (Japanese reading) for the kanji, expressed as katakana.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{onyomi}</code></td> + <td>Onyomi (Chinese reading) for the kanji, expressed as hiragana.</td> + </tr> + </tbody> + <thead> + <tr> + <td>Marker (for both)</td> + <td>Description</td> + </tr> + </thead> + <tbody> + <tr> + <td><code class="anki-field-marker">{clipboard-image}</code></td> + <td>An image which is stored in the system clipboard, if available.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{clipboard-text}</code></td> + <td>Text which is stored in the system clipboard, if available.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{cloze-body}</code></td> + <td>Original inflected term as it appeared before being reduced to dictionary form by Yomichan.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{cloze-prefix}</code></td> + <td>Fragment of the containing <code class="anki-field-marker">{sentence}</code> starting at the beginning of <code class="anki-field-marker">{sentence}</code> until the beginning of <code class="anki-field-marker">{cloze-body}</code>.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{cloze-suffix}</code></td> + <td>Fragment of the containing <code class="anki-field-marker">{sentence}</code> starting at the end of <code class="anki-field-marker">{cloze-body}</code> until the end of <code class="anki-field-marker">{sentence}</code>.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{dictionary}</code></td> + <td>Name of the dictionary from which the card is being created.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{document-title}</code></td> + <td>Title of the web page that the term or kanji appeared in.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{screenshot}</code></td> + <td>Screenshot of the web page taken at the time the term or kanji was added.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{sentence}</code></td> + <td>Sentence, quote, or phrase that the term or kanji appears in from the source content.</td> + </tr> + <tr> + <td><code class="anki-field-marker">{url}</code></td> + <td>Address of the web page in which the term or kanji appeared in.</td> + </tr> + </tbody> + </table> + </div> + <div class="modal-footer"> + <button data-modal-action="hide">Close</button> + </div> +</div></div> + + +<!-- Anki field template modals --> +<div id="anki-card-templates" class="modal-container" tabindex="-1" role="dialog"><div class="modal-content modal-content-full"> + <div class="modal-header"><div class="modal-title">Anki Card Templates</div></div> + <div class="modal-body anki-card-templates-layout"> + <div class="anki-card-templates-info"> + <p> + Anki card fields are formatted using the <a href="https://handlebarsjs.com/" target="_blank" rel="noopener noreferrer">Handlebars.js</a> + template rendering engine. + Advanced users can modify these templates for full control over what information is included in Anki cards. + </p> + <p> + Consider copy-pasting the source into a code editor that supports syntax highlighting for easier editing. + </p> + </div> + <textarea autocomplete="off" spellcheck="false" wrap="off" id="anki-card-templates-textarea" class="margin-above" data-tab-action="indent,4"></textarea> + <div id="anki-card-templates-compile-result" class="danger-text margin-above" hidden></div> + <div class="anki-card-templates-test-container margin-above"> + <p> + Card templates can be tested using the inputs below. + </p> + <div class="anki-card-templates-test-table margin-above"> + <div class="anki-card-templates-test-table-header">Scanned text</div> + <div class="anki-card-templates-test-table-header">Card field</div> + <div></div> + <input type="text" id="anki-card-templates-test-text-input" class="form-control" value="読め" placeholder="Preview text" autocomplete="off"> + <div class="anki-card-templates-test-input-container"> + <input type="text" class="input-with-suffix-button" id="anki-card-templates-test-field-input" value="{expression}" placeholder="{marker}" autocomplete="off" spellcheck="false"> + <button class="input-suffix-button input-suffix-icon-button" id="anki-card-templates-test-field-menu-button" data-menu="anki-card-all-field-menu" data-menu-position="below,left"><span class="icon-button-icon icon-button-icon-light" data-icon="material-down-arrow"></span></button> + </div> + <button id="anki-card-templates-test-render-button">Test</button> + </div> + </div> + <div class="margin-above" id="anki-card-templates-render-result"><em>Card render result</em></div> + </div> + <div class="modal-footer"> + <button class="danger" id="anki-card-templates-reset-button">Reset Templates</button> + <button data-modal-action="hide">Close</button> + </div> +</div></div> + +<div id="anki-card-templates-reset" class="modal-container" tabindex="-1" role="dialog"><div class="modal-content modal-content-small"> + <div class="modal-header"><div class="modal-title">Reset Anki Card Templates</div></div> + <div class="modal-body"> + <p class="danger-text"> + Are you sure you want to reset the card templates to their default value? + Any changes you made will be lost. + </p> + </div> + <div class="modal-footer"> + <button class="low-emphasis" data-modal-action="hide">Cancel</button> + <button class="danger" id="anki-card-templates-reset-button-confirm">Reset Templates</button> + </div> +</div></div> + + +<!-- Import/export modals --> +<div id="settings-import-error" class="modal-container" tabindex="-1" role="dialog"><div class="modal-content modal-content-small"> + <div class="modal-header"><div class="modal-title">Import Error</div></div> + <div class="modal-body"> + <p>An error occurred while trying to import the settings file:</p> + <p class="danger-text" id="settings-import-error-message"></p> + <p>Additional info can be found in the developer console.</p> + </div> + <div class="modal-footer"> + <button class="low-emphasis" data-modal-action="hide">Close</button> + </div> +</div></div> + +<div id="settings-import-warning" class="modal-container" tabindex="-1" role="dialog"><div class="modal-content modal-content-small"> + <div class="modal-header"><div class="modal-title">Import Security Warning</div></div> + <div class="modal-body"> + <p> + Settings file contains settings which may pose a security risk. + Only import settings from sources you trust. + </p> + <ul class="danger-text" id="settings-import-warning-message"></ul> + </div> + <div class="modal-footer"> + <button class="low-emphasis" data-modal-action="hide">Cancel</button> + <button class="danger settings-import-warning-import-button">Import</button> + <button class="settings-import-warning-import-button" data-import-sanitize="true">Sanitize and Import</button> + </div> +</div></div> + +<div id="settings-reset" class="modal-container" tabindex="-1" role="dialog"><div class="modal-content modal-content-small"> + <div class="modal-header"><div class="modal-title">Reset Settings</div></div> + <div class="modal-body"> + <p class="danger-text"> + You are about to reset all Yomichan settings back to their default values. + This will delete all custom profiles you may have created. + <strong>This action cannot be undone.</strong> + </p> + <p> + Consider making a backup using the <em>Export Settings</em> button before resetting + if you want to be able to revert. + </p> + <p> + Dictionary data will not be deleted, but any installed dictionaries + will need to be re-enabled. + </p> + </div> + <div class="modal-footer"> + <button class="low-emphasis" data-modal-action="hide">Cancel</button> + <button class="danger" id="settings-reset-confirm-button">Reset All Settings</button> + </div> +</div></div> + + +<!-- Profile templates --> +<template id="profile-entry-template"><div class="profile-entry generic-list-entry"> + <div class="profile-entry-cell generic-list-index-prefix"></div> + <div class="profile-entry-cell"><label class="radio"><input type="radio" class="profile-entry-is-default-radio" name="profile-entry-default-radio"><span class="radio-body"><span class="radio-border"></span><span class="radio-dot"></span></span></label></div> + <div class="profile-entry-cell"><input class="profile-entry-name-input" type="text" autocomplete="off" placeholder="Profile name"></div> + <div class="profile-entry-cell"><a class="profile-entry-condition-count-link"><span class="profile-entry-condition-count">0</span></a></div> + <div class="profile-entry-cell input-height-icon-button-container"><button class="icon-button profile-entry-menu-button" data-menu="profile-menu" data-menu-position="below,left"><span class="icon-button-inner"><span class="icon-button-icon" data-icon="kebab-menu"></span></span></button></div> +</div></template> + +<template id="profile-condition-group-template"><div class="profile-condition-group"> + <div class="profile-condition-list"></div> + <div class="profile-condition-list-info"> + <div class="profile-condition-group-separator-label">or</div> + <div class="profile-condition-list-info-space"></div> + <button class="profile-condition-add-button low-emphasis">Add</button> + </div> +</div></template> + +<template id="profile-condition-template"><div class="profile-condition"> + <div class="profile-condition-prefix"></div> + <div class="profile-condition-inner"> + <select class="profile-condition-type"><optgroup label="Type"></optgroup></select> + <select class="profile-condition-operator"><optgroup label="Operator"></optgroup></select> + <div class="profile-condition-input-container"> + <input type="text" class="profile-condition-input" autocomplete="off" spellcheck="false"> + <div class="input-height-icon-button-container mouse-button-container" hidden> + <button class="icon-button profile-condition-mouse-button mouse-button"><span class="icon-button-inner"><span class="icon-button-icon" data-icon="mouse"></span></span></button> + </div> + </div> + </div> + <div class="profile-condition-menu-button-container input-height-icon-button-container"> + <button class="icon-button profile-condition-menu-button" data-menu="profile-condition-menu" data-menu-position="below,left"><span class="icon-button-inner"><span class="icon-button-icon" data-icon="kebab-menu"></span></span></button> + </div> +</div></template> + +<template id="profile-menu-template"><div class="popup-menu-container" tabindex="-1" role="dialog"><div class="popup-menu"> + <button class="popup-menu-item" data-menu-action="moveUp">Move up</button> + <button class="popup-menu-item" data-menu-action="moveDown">Move down</button> + <button class="popup-menu-item" data-menu-action="copyFrom">Copy from...</button> + <button class="popup-menu-item" data-menu-action="editConditions">Edit conditions...</button> + <button class="popup-menu-item" data-menu-action="duplicate">Duplicate</button> + <button class="popup-menu-item" data-menu-action="delete">Delete</button> +</div></div></template> + +<template id="profile-condition-menu-template"><div class="popup-menu-container" tabindex="-1" role="dialog"><div class="popup-menu"> + <button class="popup-menu-item" data-menu-action="delete">Delete</button> +</div></div></template> + + +<!-- Dictionary templates --> +<template id="dictionary-template"><div class="settings-item"> + <div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label"><strong class="dictionary-title"></strong> <span class="light dictionary-version"></span></div> + </div> + <div class="settings-item-right"> + <button class="icon-button dictionary-menu-button" data-menu="dictionary-menu" data-menu-position="below,left"><span class="icon-button-inner"><span class="icon-button-icon" data-icon="kebab-menu"></span></span></button> + </div> + </div> + <div class="settings-item-children"> + + <div class="settings-item dictionary-outdated-notification" hidden><div class="settings-item-children danger-text"> + This dictionary is outdated and may not support new extension features. + Re-import the dictionary to enable support for the latest features. + </div></div> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Enabled</div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" class="dictionary-enabled"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div></div> + <div class="settings-item"> + <div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label"> + Prefix wildcard searches supported + <a class="more-toggle more-only" data-parent-distance="4">(?)</a> + </div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" class="dictionary-prefix-wildcard-searches-supported" disabled readonly><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div> + <div class="settings-item-children more" hidden> + <p class="warning-text"> + Changing this value requires the dictionary to be re-imported. + </p> + <p><a class="more-toggle" data-parent-distance="3">Hide…</a></p> + </div> + </div> + <div class="settings-item"><div class="settings-item-inner settings-item-inner-wrappable"> + <div class="settings-item-left"> + <div class="settings-item-label">Priority</div> + </div> + <div class="settings-item-right"> + <input type="number" step="1" class="short-height dictionary-priority"> + </div> + </div></div> + <div class="settings-item dictionary-details" hidden><div class="settings-item-children"> + <div class="dictionary-details-table"></div> + <div class="dictionary-counts"></div> + </div></div> + + </div> +</div></template> + +<template id="dictionary-details-entry-template"><div class="dictionary-details-entry"> + <span class="dictionary-details-entry-label"></span> + <span class="dictionary-details-entry-info"></span> +</div></template> + +<template id="dictionary-extra-template"><div class="settings-item"> + <div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label"><strong class="dictionary-title">Unassociated Data</strong> <span class="light dictionary-total-count"></span></div> + </div> + </div> + <div class="settings-item-children"> + <p class="warning-text"> + The database contains extra data which is not associated with any installed dictionary. + Purging the database can fix this issue. + </p> + <div class="dictionary-counts"></div> + </div> +</div></template> + +<template id="dictionary-menu-template"><div class="popup-menu-container" tabindex="-1" role="dialog"><div class="popup-menu"> + <button class="popup-menu-item" data-menu-action="showDetails">Show details</button> + <button class="popup-menu-item" data-menu-action="hideDetails" hidden>Hide details</button> + <button class="popup-menu-item" data-menu-action="delete">Delete</button> +</div></div></template> + +<template id="secondary-search-dictionary-template"><div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label dictionary-name"></div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" class="dictionary-allow-secondary-searches"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> +</div></div></template> + + +<!-- Audio templates --> +<template id="audio-source-template"><div class="audio-source horizontal-flex"> + <div class="generic-list-index-prefix"></div> + <select class="audio-source-select"> + <option value="jpod101">JapanesePod101</option> + <option value="jpod101-alternate">JapanesePod101 (Alternate)</option> + <option value="jisho">Jisho.org</option> + <option value="text-to-speech">Text-to-speech</option> + <option value="text-to-speech-reading">Text-to-speech (Kana reading)</option> + <option value="custom">Custom</option> + </select> + <div class="horizontal-flex-fill"></div> + <button class="icon-button audio-source-menu-button" data-menu="audio-source-menu" data-menu-position="below,left"><span class="icon-button-inner"><span class="icon-button-icon" data-icon="kebab-menu"></span></span></button> +</div></template> + +<template id="audio-source-menu-template"><div class="popup-menu-container" tabindex="-1" role="dialog"><div class="popup-menu"> + <button class="popup-menu-item" data-menu-action="remove">Remove</button> +</div></div></template> + + +<!-- Scanning inputs templates --> +<template id="scan-input-template"><div class="scan-input" data-show-advanced="false"> + <div class="scan-input-grid"> + <div class="scan-input-index-cell generic-list-index-prefix"></div> + <div class="scan-input-suffix-cell"> + <div class="input-height-icon-button-container"> + <button class="icon-button scanning-input-menu-button" data-menu="scanning-inputs-menu" data-menu-position="below,left"><span class="icon-button-inner"><span class="icon-button-icon" data-icon="kebab-menu"></span></span></button> + </div> + </div> + + <div class="scan-input-prefix-cell" data-property="include"><span>Required inputs:</span></div> + <div class="scan-input-content-cell" data-property="include"> + <input type="text" class="input-with-suffix-button scan-input-field" autocomplete="off" spellcheck="false" placeholder="No inputs" data-property="include"> + <button class="input-suffix-button input-suffix-icon-button mouse-button" data-property="include"><span class="icon-button-icon icon-button-icon-light" data-icon="mouse"></span></button> + </div> + + <div class="scan-input-prefix-cell" data-property="exclude"><span>Excluded inputs:</span></div> + <div class="scan-input-content-cell" data-property="exclude"> + <input type="text" class="input-with-suffix-button scan-input-field" autocomplete="off" spellcheck="false" placeholder="No inputs" data-property="exclude"> + <button class="input-suffix-button input-suffix-icon-button mouse-button" data-property="exclude"><span class="icon-button-icon icon-button-icon-light" data-icon="mouse"></span></button> + </div> + + <div class="scan-input-prefix-cell scan-input-options-cell" data-property="types"><span>Input types:</span></div> + <div class="scan-input-content-cell scan-input-options-cell" data-property="types"> + <label class="scan-input-checkbox-item"> + <label class="checkbox"><input type="checkbox" class="scan-input-settings-checkbox" data-property="types.mouse"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Mouse</span> + </label> + <label class="scan-input-checkbox-item"> + <label class="checkbox"><input type="checkbox" class="scan-input-settings-checkbox" data-property="types.touch"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Touch</span> + </label> + <label class="scan-input-checkbox-item"> + <label class="checkbox"><input type="checkbox" class="scan-input-settings-checkbox" data-property="types.pen"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Pen</span> + </label> + </div> + + <div class="scan-input-prefix-cell scan-input-options-cell scan-input-advanced-only" data-property="search-options"><span>Search types:</span></div> + <div class="scan-input-content-cell scan-input-options-cell scan-input-advanced-only" data-property="search-options"> + <label class="scan-input-checkbox-item"> + <label class="checkbox"><input type="checkbox" class="scan-input-settings-checkbox" data-property="options.searchTerms"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Search for terms</span> + </label> + <label class="scan-input-checkbox-item"> + <label class="checkbox"><input type="checkbox" class="scan-input-settings-checkbox" data-property="options.searchKanji"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Search for kanji</span> + </label> + </div> + + <div class="scan-input-prefix-cell scan-input-options-cell scan-input-advanced-only" data-property="touch-pen-options"><span>Touch & pen:</span></div> + <div class="scan-input-content-cell scan-input-options-cell scan-input-advanced-only" data-property="touch-pen-options"> + <label class="scan-input-checkbox-item"> + <label class="checkbox"><input type="checkbox" class="scan-input-settings-checkbox" data-property="options.scanOnTouchMove"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Scan on touch move</span> + </label> + <label class="scan-input-checkbox-item"> + <label class="checkbox"><input type="checkbox" class="scan-input-settings-checkbox" data-property="options.scanOnPenHover"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Scan on pen hover</span> + </label> + <label class="scan-input-checkbox-item"> + <label class="checkbox"><input type="checkbox" class="scan-input-settings-checkbox" data-property="options.scanOnPenPress"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Scan on pen press</span> + </label> + <label class="scan-input-checkbox-item"> + <label class="checkbox"><input type="checkbox" class="scan-input-settings-checkbox" data-property="options.scanOnPenRelease"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Scan on pen release</span> + </label> + <label class="scan-input-checkbox-item"> + <label class="checkbox"><input type="checkbox" class="scan-input-settings-checkbox" data-property="options.preventTouchScrolling"><span class="checkbox-body"><span class="checkbox-fill"></span><span class="checkbox-border"></span><span class="checkbox-check"></span></span></label> + <span>Prevent touch/pen scrolling</span> + </label> + </div> + </div> +</div></template> + +<template id="scanning-inputs-menu-template"><div class="popup-menu-container" tabindex="-1" role="dialog"><div class="popup-menu"> + <button class="popup-menu-item" data-menu-action="showAdvanced">Show advanced options</button> + <button class="popup-menu-item" data-menu-action="hideAdvanced">Hide advanced options</button> + <button class="popup-menu-item" data-menu-action="clearInputs">Clear inputs</button> + <button class="popup-menu-item" data-menu-action="remove">Remove</button> +</div></div></template> + + +<!-- Anki templates --> +<template id="anki-card-field-template"><div class="anki-card-field-name"></div> +<div class="anki-card-field-value-container"> + <input type="text" class="anki-card-field-value input-with-suffix-button" autocomplete="off"> + <button class="anki-card-field-value-menu-button input-suffix-button input-suffix-icon-button" data-menu-position="below,left"><span class="icon-button-icon icon-button-icon-light" data-icon="material-down-arrow"></span></button> +</div></template> + +<template id="anki-card-terms-field-menu-template"><div class="popup-menu-container" tabindex="-1" role="dialog"><div class="popup-menu"></div></div></template> + +<template id="anki-card-kanji-field-menu-template"><div class="popup-menu-container" tabindex="-1" role="dialog"><div class="popup-menu"></div></div></template> + +<template id="anki-card-all-field-menu-template"><div class="popup-menu-container" tabindex="-1" role="dialog"><div class="popup-menu"></div></div></template> + + +<!-- Scripts --> +<script src="/mixed/lib/jszip.min.js"></script> +<script src="/mixed/lib/wanakana.min.js"></script> + +<script src="/mixed/js/core.js"></script> +<script src="/mixed/js/yomichan.js"></script> +<script src="/mixed/js/comm.js"></script> +<script src="/mixed/js/environment.js"></script> +<script src="/mixed/js/api.js"></script> +<script src="/mixed/js/japanese.js"></script> + +<script src="/mixed/js/audio-system.js"></script> +<script src="/mixed/js/cache-map.js"></script> +<script src="/mixed/js/dictionary-data-util.js"></script> +<script src="/mixed/js/document-util.js"></script> +<script src="/mixed/js/dom-data-binder.js"></script> +<script src="/mixed/js/html-template-collection.js"></script> +<script src="/mixed/js/object-property-accessor.js"></script> +<script src="/mixed/js/selector-observer.js"></script> +<script src="/mixed/js/task-accumulator.js"></script> +<script src="/mixed/js/text-to-speech-audio.js"></script> + +<script src="/bg/js/anki.js"></script> +<script src="/bg/js/anki-note-builder.js"></script> +<script src="/bg/js/options.js"></script> +<script src="/bg/js/database.js"></script> +<script src="/bg/js/dictionary-database.js"></script> +<script src="/bg/js/dictionary-importer.js"></script> +<script src="/bg/js/json-schema.js"></script> +<script src="/bg/js/media-utility.js"></script> +<script src="/bg/js/template-renderer-proxy.js"></script> + +<script src="/bg/js/settings/keyboard-mouse-input-field.js"></script> +<script src="/bg/js/settings/popup-elements.js"></script> +<script src="/bg/js/settings/profile-conditions-ui.js"></script> + +<script src="/bg/js/settings/anki-controller.js"></script> +<script src="/bg/js/settings/anki-templates-controller.js"></script> +<script src="/bg/js/settings/audio-controller.js"></script> +<script src="/bg/js/settings/backup-controller.js"></script> +<script src="/bg/js/settings/clipboard-popups-controller.js"></script> +<script src="/bg/js/settings/dictionary-controller.js"></script> +<script src="/bg/js/settings/dictionary-import-controller.js"></script> +<script src="/bg/js/settings/generic-setting-controller.js"></script> +<script src="/bg/js/settings/modal-controller.js"></script> +<script src="/bg/js/settings/popup-menu.js"></script> +<script src="/bg/js/settings/popup-preview-controller.js"></script> +<script src="/bg/js/settings/profile-controller.js"></script> +<script src="/bg/js/settings/scan-inputs-controller.js"></script> +<script src="/bg/js/settings/scan-inputs-simple-controller.js"></script> +<script src="/bg/js/settings/settings-controller.js"></script> +<script src="/bg/js/settings/storage-controller.js"></script> + +<script src="/bg/js/settings2/nested-popups-controller.js"></script> +<script src="/bg/js/settings2/secondary-search-dictionary-controller.js"></script> +<script src="/bg/js/settings2/settings-display-controller.js"></script> + +<script src="/bg/js/settings2/settings-main.js"></script> + +</body> +</html> |