diff --git a/README.en.md b/README.en.md index 6e12edd..625c3fa 100644 --- a/README.en.md +++ b/README.en.md @@ -15,8 +15,7 @@ A simple, open source [bilingual translation extension & Greasemonkey script](ht - [x] Firefox - [x] Kiwi (Android) - [x] Orion (iOS) - - [ ] Safari - - [x] Safari (Mac) + - [x] Safari - [x] Thunderbird - [x] Supports multiple translation services - [x] Google/Microsoft @@ -59,8 +58,9 @@ A simple, open source [bilingual translation extension & Greasemonkey script](ht - [x] Orion (iOS) - [x] Edge [Installation address](https://microsoftedge.microsoft.com/addons/detail/%E7%AE%80%E7%BA%A6%E7%BF%BB%E8%AF%91/jemckldkclkinpjighnoilpbldbdmmlh?hl=zh-CN) - [x] Firefox [Installation address](https://addons.mozilla.org/zh-CN/firefox/addon/kiss-translator/) - - [ ] Safari - - [x] Safari (Mac) Compiled by a third party, not verified, obtained by yourself: https://www.nodeloc.com/t/topic/54245 + - [x] Safari + - [x] Safari (Mac) + - [x] Safari (iOS) - [x] Thunderbird [Download address](https://github.com/fishjar/kiss-translator/releases) - [x] GreaseMonkey Script - [x] Chrome/Edge/Firefox ([Tampermonkey](https://www.tampermonkey.net/)/[Violentmonkey](https://violentmonkey.github.io/)) [Installation link](https://fishjar.github.io/kiss-translator/kiss-translator.user.js) diff --git a/README.md b/README.md index f9af8da..f2d8b1e 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,7 @@ - [x] Firefox - [x] Kiwi (Android) - [x] Orion (iOS) - - [ ] Safari - - [x] Safari (Mac) + - [x] Safari - [x] Thunderbird - [x] 支持多种翻译服务 - [x] Google/Microsoft @@ -59,8 +58,9 @@ - [x] Orion (iOS) - [x] Edge [安装地址](https://microsoftedge.microsoft.com/addons/detail/%E7%AE%80%E7%BA%A6%E7%BF%BB%E8%AF%91/jemckldkclkinpjighnoilpbldbdmmlh?hl=zh-CN) - [x] Firefox [安装地址](https://addons.mozilla.org/zh-CN/firefox/addon/kiss-translator/) - - [ ] Safari - - [x] Safari (Mac) 第三方编译,未作验证,自行获取: https://www.nodeloc.com/t/topic/54245 + - [x] Safari + - [x] Safari (Mac) + - [x] Safari (iOS) - [x] Thunderbird [下载地址](https://github.com/fishjar/kiss-translator/releases) - [x] 油猴脚本 - [x] Chrome/Edge/Firefox ([Tampermonkey](https://www.tampermonkey.net/)/[Violentmonkey](https://violentmonkey.github.io/)) [安装链接](https://fishjar.github.io/kiss-translator/kiss-translator.user.js) diff --git a/src/config/i18n.js b/src/config/i18n.js index 62f1e5e..04826c6 100644 --- a/src/config/i18n.js +++ b/src/config/i18n.js @@ -862,7 +862,21 @@ export const I18N = { en: `Hide Fab Button`, zh_TW: `隱藏懸浮按鈕`, }, - + fab_click_action: { + zh: `单击悬浮按钮动作`, + en: `Single Click Fab Action`, + zh_TW: `單擊懸浮按钮動作`, + }, + fab_click_menu: { + zh: `弹出菜单`, + en: `Popup Menu`, + zh_TW: `彈出選單`, + }, + fab_click_translate: { + zh: `直接翻译`, + en: `Translate`, + zh_TW: `直接翻譯`, + }, hide_tran_button: { zh: `隐藏翻译按钮`, en: `Hide Translate Button`, diff --git a/src/config/setting.js b/src/config/setting.js index 698e71c..94f97d0 100644 --- a/src/config/setting.js +++ b/src/config/setting.js @@ -33,6 +33,7 @@ export const DEFAULT_CSPLIST = ["https://github.com"]; // 禁用CSP名单 // 同步设置 export const OPT_SYNCTYPE_WORKER = "KISS-Worker"; export const OPT_SYNCTYPE_WEBDAV = "WebDAV"; +export const OPT_SYNCTOKEN_PERFIX = "kt_"; export const OPT_SYNCTYPE_ALL = [OPT_SYNCTYPE_WORKER, OPT_SYNCTYPE_WEBDAV]; export const DEFAULT_SYNC = { syncType: OPT_SYNCTYPE_WORKER, // 同步方式 @@ -125,6 +126,7 @@ export const DEFAULT_SETTING = { httpTimeout: DEFAULT_HTTP_TIMEOUT, clearCache: false, // 是否在浏览器下次启动时清除缓存 injectRules: true, // 是否注入订阅规则 + fabClickAction: 0, // 悬浮按钮点击行为 // injectWebfix: true, // 是否注入修复补丁(作废) // detectRemote: false, // 是否使用远程语言检测(移至rule,作废) // contextMenus: true, // 是否添加右键菜单(作废) diff --git a/src/views/Action/index.js b/src/views/Action/index.js index 5746daf..118080c 100644 --- a/src/views/Action/index.js +++ b/src/views/Action/index.js @@ -33,6 +33,8 @@ export default function Action({ translator, fab }) { }); const [moved, setMoved] = useState(false); + const { fabClickAction = 0 } = fab || {}; + const handleWindowResize = useMemo( () => debounce(() => { @@ -215,7 +217,14 @@ export default function Action({ translator, fab }) { color="primary" onClick={(e) => { if (!moved) { - setShowPopup((pre) => !pre); + if (fabClickAction === 1) { + translator.toggle(); + sendIframeMsg(MSG_TRANS_TOGGLE); + setShowPopup(false); + } + else { + setShowPopup((pre) => !pre); + } } }} > diff --git a/src/views/Options/Setting.js b/src/views/Options/Setting.js index 3c52061..6cfff4b 100644 --- a/src/views/Options/Setting.js +++ b/src/views/Options/Setting.js @@ -122,7 +122,7 @@ export default function Settings() { transInterval = 200, langDetector = OPT_TRANS_MICROSOFT, } = setting; - const { isHide = false } = fab || {}; + const { isHide = false, fabClickAction = 0 } = fab || {}; return ( @@ -232,6 +232,19 @@ export default function Settings() { + + {i18n("fab_click_action")} + + + {i18n("context_menus")}