From a388f5dcfa6da84d5425fd6c0d9a01a8e9b7f852 Mon Sep 17 00:00:00 2001 From: sienori Date: Tue, 6 Feb 2018 21:40:57 +0900 Subject: [PATCH] Make the option of behavior when text is selected a radio button --- simple-translate/_locales/en/messages.json | 17 ++++-- simple-translate/_locales/ja_JP/messages.json | 6 -- simple-translate/options/options.css | 51 ++++++++++++++++ simple-translate/options/options.html | 58 ++++++++++++------- simple-translate/simple-translate.js | 26 +++++---- 5 files changed, 118 insertions(+), 40 deletions(-) diff --git a/simple-translate/_locales/en/messages.json b/simple-translate/_locales/en/messages.json index c2e8652..ff2c0ef 100644 --- a/simple-translate/_locales/en/messages.json +++ b/simple-translate/_locales/en/messages.json @@ -35,17 +35,26 @@ "ifShowCandidateCaptionLabel": { "message": "Show multiple translation candidates when a single word is translated." }, - "ifAutoTranslate": { - "message": "Automatically display translation panel" + "whenSelectTextLabel": { + "message": "Behavior when selecting text" }, "ifAutoTranslateLabel": { + "message": "Display translation panel" + }, + "ifAutoTranslateCaptionLabel": { "message": "Directly display the translation panel without displaying the button." }, "ifShowButtonLabel": { - "message": "Display the button when text is selected" + "message": "Display translation button" }, "ifShowButtonCaptionLabel": { - "message": "Display the translation button when text is selected on the web page." + "message": "Display the translation button to open the panel when clicked." + }, + "dontshowbuttonlabel": { + "message": "Don't display button or panel" + }, + "dontshowbuttonCaptionlabel": { + "message": "Don't display the translation button or the translation panel." }, "ifCheckLangLabel": { "message": "Do not display the button if translation is not required" diff --git a/simple-translate/_locales/ja_JP/messages.json b/simple-translate/_locales/ja_JP/messages.json index 5568c2d..a38d160 100644 --- a/simple-translate/_locales/ja_JP/messages.json +++ b/simple-translate/_locales/ja_JP/messages.json @@ -47,12 +47,6 @@ "ifCheckLangCaptionLabel": { "message": "選択したテキストの言語を検出し,翻訳先言語と同じ場合はボタンを表示しません。" }, - "ifAutoTranslate": { - "message": "自動的に翻訳パネルを表示する" - }, - "ifAutoTranslateLabel": { - "message": "ボタンを表示せずに直接翻訳パネルを表示します。" - }, "ifShowMenuLabel": { "message": "コンテキストメニューを表示する" }, diff --git a/simple-translate/options/options.css b/simple-translate/options/options.css index ae12d9e..9787bc4 100644 --- a/simple-translate/options/options.css +++ b/simple-translate/options/options.css @@ -141,6 +141,10 @@ hr { padding: 10px 0px 10px 0px; } +.optionContainer.reverse { + flex-direction: row-reverse; +} + .buttonsContainer { justify-content: flex-start; } @@ -166,6 +170,11 @@ hr { justify-content: flex-end; } +.reverse .optionForm { + flex-basis: 40px; + justify-content: flex-start; +} + #importClear { position: relative; left: 10px; @@ -315,6 +324,48 @@ input[type="checkbox"]:checked + .checkbox::after { border-right: 3px solid var(--highlight); } +input[type="radio"] { + display: none; +} + +.radio { + padding-left: 20px; + position: relative; + cursor: pointer; +} + +.radio::before { + content: ""; + display: block; + position: absolute; + top: 0; + left: -2px; + width: 20px; + height: 20px; + border: 1px solid var(--button); + border-radius: 50%; +} + +.radio:hover::before { + border-color: var(--highlight); +} + +input[type="radio"]:checked + .radio { + color: var(--highlight); +} + +input[type="radio"]:checked + .radio::after { + content: ""; + display: block; + position: absolute; + top: 6px; + left: 4px; + width: 10px; + height: 10px; + border-radius: 50%; + background-color: var(--highlight); +} + select { -moz-appearance: none; text-overflow: ellipsis; diff --git a/simple-translate/options/options.html b/simple-translate/options/options.html index 2d0164f..1df3a9d 100644 --- a/simple-translate/options/options.html +++ b/simple-translate/options/options.html @@ -79,18 +79,48 @@