From 77630a4dd02a06b0d875192898e6c4b981038204 Mon Sep 17 00:00:00 2001 From: sienori Date: Tue, 26 Sep 2017 17:14:15 +0900 Subject: [PATCH] Update simple-translate.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit コンテキストメニュー>選択テキストを翻訳で,翻訳先言語と同じ言語のテキストを選択した時に表示位置がずれる問題を修正 --- simple-translate/simple-translate.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/simple-translate/simple-translate.js b/simple-translate/simple-translate.js index 30fb59f..5227056 100644 --- a/simple-translate/simple-translate.js +++ b/simple-translate/simple-translate.js @@ -28,13 +28,7 @@ function Select(e) { setTimeout(function () { //誤動作防止の為ディレイを設ける selectionWord = String(window.getSelection()); if ((selectionWord.length !== 0) && (e.button == 0) && (e.target.id !== "simple-translate-panel") && (e.target.parentElement.id !== "simple-translate-panel")) { //選択範囲が存在かつ左クリックかつパネル以外のとき - if (ifCheckLang) { - checkLang().then(function (results) { - if (results) popupButton(e); - }); - } else { popupButton(e); - } } }, 200); } @@ -57,7 +51,13 @@ function popupButton(e) { button.style.left = e.clientX + 10 + 'px'; button.style.top = e.clientY + 5 + 'px'; if (ifShowButton) { - button.style.display = 'block'; + if (ifCheckLang) { + checkLang().then(function (results) { + if (results) button.style.display = 'block'; + }); + } else { + button.style.display = 'block'; + } } }