Skip to content

Commit

Permalink
support #49
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenYCL committed May 31, 2020
1 parent 3529eee commit f74863e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

## 版本

v2.0.7
v2.0.8

## 功能点

Expand Down
2 changes: 1 addition & 1 deletion README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Now,It works

## Version

v2.0.7
v2.0.8

## Features

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chrome-extension-udemy-translate",
"version": "2.0.7",
"version": "2.0.8",
"description": "Translate Udemy's subtitles into Chinese/English(netflix+udemy+lynda+hulu+hbo now字幕翻译)",
"license": "MIT",
"repository": {
Expand Down
15 changes: 12 additions & 3 deletions src/pages/Content/VideoType/primevideo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ const getOriginText = () => {
obj_text = obj_text.replace('<br>', ' ').replace(/\[(.+)\]/, '');
}
return obj_text;
} else if ($('.fg8afi5') != null) {
let obj_text = $('.fg8afi5').innerText;
if (obj_text) {
obj_text = obj_text.replace('<br>', ' ').replace(/\[(.+)\]/, '');
}
} else {
return '';
}
Expand All @@ -36,7 +41,7 @@ const run = async () => {
let plugin_status = await getItem('status');
if (plugin_status) {
// cover css
hiddenSubtitleCssInject(['.persistentPanel']);
hiddenSubtitleCssInject(['.persistentPanel', '.webPlayerUIContainer']);
let current = getOriginText();
// when change send request ,then make same
if (sub.pre !== current && current !== '') {
Expand Down Expand Up @@ -68,10 +73,14 @@ run();
chrome.runtime.onMessage.addListener(async function(
request,
sender,
sendResponse
sendResponse,
) {
console.log(JSON.stringify(request));
if (sub.current !== sub.pre) {
dealSubtitle('.persistentPanel', request);
if ($('.persistenPanel')) {
dealSubtitle('.persistentPanel', request);
} else if ($('.fg8afi5')) {
dealSubtitle('.webPlayerUIContainer', request);
}
}
});

0 comments on commit f74863e

Please sign in to comment.