Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6db5ab0ece | ||
|
|
5aca06fb9c | ||
|
|
d735ee977c | ||
|
|
48c7bcf126 |
@@ -47,3 +47,7 @@ yarn dist
|
|||||||
### Data Sync
|
### Data Sync
|
||||||
|
|
||||||
Goto: [https://github.com/fishjar/kiss-worker](https://github.com/fishjar/kiss-worker)
|
Goto: [https://github.com/fishjar/kiss-worker](https://github.com/fishjar/kiss-worker)
|
||||||
|
|
||||||
|
### Discussion
|
||||||
|
|
||||||
|
- Join [Telegram Group](https://t.me/+RRCu_4oNwrM2NmFl)
|
||||||
|
|||||||
@@ -47,3 +47,7 @@ yarn dist
|
|||||||
### 数据同步
|
### 数据同步
|
||||||
|
|
||||||
移步: [https://github.com/fishjar/kiss-worker](https://github.com/fishjar/kiss-worker)
|
移步: [https://github.com/fishjar/kiss-worker](https://github.com/fishjar/kiss-worker)
|
||||||
|
|
||||||
|
### 交流
|
||||||
|
|
||||||
|
- 加入 [Telegram 群](https://t.me/+RRCu_4oNwrM2NmFl)
|
||||||
|
|||||||
2
dist/chrome/manifest.json
vendored
2
dist/chrome/manifest.json
vendored
@@ -2,7 +2,7 @@
|
|||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "__MSG_app_name__",
|
"name": "__MSG_app_name__",
|
||||||
"description": "__MSG_app_description__",
|
"description": "__MSG_app_description__",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"default_locale": "zh",
|
"default_locale": "zh",
|
||||||
"author": "Gabe<yugang2002@gmail.com>",
|
"author": "Gabe<yugang2002@gmail.com>",
|
||||||
"homepage_url": "https://github.com/fishjar/kiss-translator",
|
"homepage_url": "https://github.com/fishjar/kiss-translator",
|
||||||
|
|||||||
2
dist/chrome/static/js/content.js
vendored
2
dist/chrome/static/js/content.js
vendored
File diff suppressed because one or more lines are too long
2
dist/edge/manifest.json
vendored
2
dist/edge/manifest.json
vendored
@@ -2,7 +2,7 @@
|
|||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "__MSG_app_name__",
|
"name": "__MSG_app_name__",
|
||||||
"description": "__MSG_app_description__",
|
"description": "__MSG_app_description__",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"default_locale": "zh",
|
"default_locale": "zh",
|
||||||
"author": "Gabe<yugang2002@gmail.com>",
|
"author": "Gabe<yugang2002@gmail.com>",
|
||||||
"homepage_url": "https://github.com/fishjar/kiss-translator",
|
"homepage_url": "https://github.com/fishjar/kiss-translator",
|
||||||
|
|||||||
2
dist/edge/static/js/content.js
vendored
2
dist/edge/static/js/content.js
vendored
File diff suppressed because one or more lines are too long
2
dist/firefox/manifest.json
vendored
2
dist/firefox/manifest.json
vendored
@@ -2,7 +2,7 @@
|
|||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "__MSG_app_name__",
|
"name": "__MSG_app_name__",
|
||||||
"description": "__MSG_app_description__",
|
"description": "__MSG_app_description__",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"default_locale": "zh",
|
"default_locale": "zh",
|
||||||
"author": "Gabe<yugang2002@gmail.com>",
|
"author": "Gabe<yugang2002@gmail.com>",
|
||||||
"homepage_url": "https://github.com/fishjar/kiss-translator",
|
"homepage_url": "https://github.com/fishjar/kiss-translator",
|
||||||
|
|||||||
2
dist/firefox/static/js/content.js
vendored
2
dist/firefox/static/js/content.js
vendored
File diff suppressed because one or more lines are too long
@@ -2,7 +2,7 @@
|
|||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "__MSG_app_name__",
|
"name": "__MSG_app_name__",
|
||||||
"description": "__MSG_app_description__",
|
"description": "__MSG_app_description__",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"default_locale": "zh",
|
"default_locale": "zh",
|
||||||
"author": "Gabe<yugang2002@gmail.com>",
|
"author": "Gabe<yugang2002@gmail.com>",
|
||||||
"homepage_url": "https://github.com/fishjar/kiss-translator",
|
"homepage_url": "https://github.com/fishjar/kiss-translator",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "kiss-translator",
|
"name": "kiss-translator",
|
||||||
"description": "A simple translator extension",
|
"description": "A simple translator extension",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"author": "Gabe<yugang2002@gmail.com>",
|
"author": "Gabe<yugang2002@gmail.com>",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "__MSG_app_name__",
|
"name": "__MSG_app_name__",
|
||||||
"description": "__MSG_app_description__",
|
"description": "__MSG_app_description__",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"default_locale": "zh",
|
"default_locale": "zh",
|
||||||
"author": "Gabe<yugang2002@gmail.com>",
|
"author": "Gabe<yugang2002@gmail.com>",
|
||||||
"homepage_url": "https://github.com/fishjar/kiss-translator",
|
"homepage_url": "https://github.com/fishjar/kiss-translator",
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import {
|
|||||||
MSG_TRANS_TOGGLE,
|
MSG_TRANS_TOGGLE,
|
||||||
MSG_TRANS_GETRULE,
|
MSG_TRANS_GETRULE,
|
||||||
MSG_TRANS_PUTRULE,
|
MSG_TRANS_PUTRULE,
|
||||||
OPT_TRANS_OPENAI,
|
|
||||||
TRANS_MIN_LENGTH,
|
TRANS_MIN_LENGTH,
|
||||||
TRANS_MAX_LENGTH,
|
TRANS_MAX_LENGTH,
|
||||||
} from "./config";
|
} from "./config";
|
||||||
@@ -104,10 +103,7 @@ class Translator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 除openai外,保留code和a标签
|
// 除openai外,保留code和a标签
|
||||||
const q =
|
const q = el.innerText.trim();
|
||||||
this._rule.translator === OPT_TRANS_OPENAI
|
|
||||||
? el.innerText.trim()
|
|
||||||
: el.innerHTML.replace(/<(?!\/?(code|a))[^>]+>/gi, "").trim();
|
|
||||||
if (!q || q.length < TRANS_MIN_LENGTH || q.length > TRANS_MAX_LENGTH) {
|
if (!q || q.length < TRANS_MIN_LENGTH || q.length > TRANS_MAX_LENGTH) {
|
||||||
// 太长或太短不翻译
|
// 太长或太短不翻译
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -80,8 +80,9 @@ export default function Content({ q, rule }) {
|
|||||||
style={style}
|
style={style}
|
||||||
onMouseEnter={handleMouseEnter}
|
onMouseEnter={handleMouseEnter}
|
||||||
onMouseLeave={handleMouseLeave}
|
onMouseLeave={handleMouseLeave}
|
||||||
dangerouslySetInnerHTML={{ __html: text }}
|
>
|
||||||
/>
|
{text}
|
||||||
|
</span>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user