Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6db5ab0ece | ||
|
|
5aca06fb9c | ||
|
|
d735ee977c | ||
|
|
48c7bcf126 |
@@ -47,3 +47,7 @@ yarn dist
|
||||
### Data Sync
|
||||
|
||||
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)
|
||||
|
||||
### 交流
|
||||
|
||||
- 加入 [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,
|
||||
"name": "__MSG_app_name__",
|
||||
"description": "__MSG_app_description__",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"default_locale": "zh",
|
||||
"author": "Gabe<yugang2002@gmail.com>",
|
||||
"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,
|
||||
"name": "__MSG_app_name__",
|
||||
"description": "__MSG_app_description__",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"default_locale": "zh",
|
||||
"author": "Gabe<yugang2002@gmail.com>",
|
||||
"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,
|
||||
"name": "__MSG_app_name__",
|
||||
"description": "__MSG_app_description__",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"default_locale": "zh",
|
||||
"author": "Gabe<yugang2002@gmail.com>",
|
||||
"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,
|
||||
"name": "__MSG_app_name__",
|
||||
"description": "__MSG_app_description__",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"default_locale": "zh",
|
||||
"author": "Gabe<yugang2002@gmail.com>",
|
||||
"homepage_url": "https://github.com/fishjar/kiss-translator",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "kiss-translator",
|
||||
"description": "A simple translator extension",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"author": "Gabe<yugang2002@gmail.com>",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"manifest_version": 3,
|
||||
"name": "__MSG_app_name__",
|
||||
"description": "__MSG_app_description__",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"default_locale": "zh",
|
||||
"author": "Gabe<yugang2002@gmail.com>",
|
||||
"homepage_url": "https://github.com/fishjar/kiss-translator",
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
MSG_TRANS_TOGGLE,
|
||||
MSG_TRANS_GETRULE,
|
||||
MSG_TRANS_PUTRULE,
|
||||
OPT_TRANS_OPENAI,
|
||||
TRANS_MIN_LENGTH,
|
||||
TRANS_MAX_LENGTH,
|
||||
} from "./config";
|
||||
@@ -104,10 +103,7 @@ class Translator {
|
||||
}
|
||||
|
||||
// 除openai外,保留code和a标签
|
||||
const q =
|
||||
this._rule.translator === OPT_TRANS_OPENAI
|
||||
? el.innerText.trim()
|
||||
: el.innerHTML.replace(/<(?!\/?(code|a))[^>]+>/gi, "").trim();
|
||||
const q = el.innerText.trim();
|
||||
if (!q || q.length < TRANS_MIN_LENGTH || q.length > TRANS_MAX_LENGTH) {
|
||||
// 太长或太短不翻译
|
||||
return;
|
||||
|
||||
@@ -80,8 +80,9 @@ export default function Content({ q, rule }) {
|
||||
style={style}
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
dangerouslySetInnerHTML={{ __html: text }}
|
||||
/>
|
||||
>
|
||||
{text}
|
||||
</span>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user