Skip to content

Commit

Permalink
Merge pull request #19 from rolandbernard/devel
Browse files Browse the repository at this point in the history
v0.0.11
  • Loading branch information
rolandbernard committed Nov 29, 2020
2 parents 4e62dc8 + 8ba50f6 commit a05f95c
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 28 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"devDependencies": {
"@babel/preset-react": "^7.10.1",
"electron": "9.0.0",
"electron": "^9.3.5",
"electron-builder": "^22.4.1",
"electron-webpack": "^2.8.2",
"webpack": "~4.42.1"
Expand Down
4 changes: 4 additions & 0 deletions src/main/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

import { TurnedInRounded } from '@material-ui/icons';
import { app, globalShortcut, BrowserWindow, ipcMain } from 'electron';
import * as path from 'path';
import { format as formatUrl } from 'url';
Expand All @@ -15,6 +16,8 @@ function createMainWindow() {
webPreferences: {
nodeIntegration: true,
plugins: true,
contextIsolation: false,
webSecurity: !isDevelopment,
},
resizable: false,
maximizable: false,
Expand All @@ -29,6 +32,7 @@ function createMainWindow() {
height: config.general.max_height,
alwaysOnTop: true,
icon: path.join(__static, 'logo.png'),
paintWhenInitiallyHidden: true,
});

if (isDevelopment) {
Expand Down
12 changes: 6 additions & 6 deletions src/main/modules/deepl.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const DeeplModule = {
resolve();
return;
}
await page.waitFor(100);
await page.waitForTimeout(100);
if (stop) {
resolve();
return;
Expand All @@ -113,7 +113,7 @@ const DeeplModule = {
return;
}
if (last_lang != lang) {
await page.waitFor(100);
await page.waitForTimeout(100);
if (stop) {
resolve();
return;
Expand All @@ -123,7 +123,7 @@ const DeeplModule = {
resolve();
return;
}
await page.waitFor(100);
await page.waitForTimeout(100);
if (stop) {
resolve();
return;
Expand All @@ -135,7 +135,7 @@ const DeeplModule = {
}
last_lang = lang;
}
await page.waitFor(20);
await page.waitForTimeout(20);
if (stop) {
resolve();
return;
Expand All @@ -145,7 +145,7 @@ const DeeplModule = {
resolve();
return;
}
await page.waitFor(100);
await page.waitForTimeout(100);
if (stop) {
resolve();
return;
Expand All @@ -165,7 +165,7 @@ const DeeplModule = {
resolve();
return;
}
await page.waitFor(100);
await page.waitForTimeout(100);
if (stop) {
resolve();
return;
Expand Down
12 changes: 6 additions & 6 deletions src/main/modules/google-translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const GoogleTranslateModule = {
page = await pie.getPage(browser, window);
try {
await page.click('.tlid-open-source-language-list');
await page.waitFor(100);
await page.waitForTimeout(100);
await page.click('.language-list-unfiltered-langs-sl_list .language_list_item_wrapper-auto');
} catch (e) { }
})();
Expand Down Expand Up @@ -199,7 +199,7 @@ const GoogleTranslateModule = {
resolve();
return;
}
await page.waitFor(100);
await page.waitForTimeout(100);
if (stop) {
resolve();
return;
Expand All @@ -212,7 +212,7 @@ const GoogleTranslateModule = {
return;
}
if (last_lang != lang) {
await page.waitFor(100);
await page.waitForTimeout(100);
if (stop) {
resolve();
return;
Expand All @@ -222,7 +222,7 @@ const GoogleTranslateModule = {
resolve();
return;
}
await page.waitFor(100);
await page.waitForTimeout(100);
if (stop) {
resolve();
return;
Expand All @@ -234,7 +234,7 @@ const GoogleTranslateModule = {
}
last_lang = lang;
}
await page.waitFor(20);
await page.waitForTimeout(20);
if (stop) {
resolve();
return;
Expand All @@ -256,7 +256,7 @@ const GoogleTranslateModule = {
resolve();
return;
}
await page.waitFor(500);
await page.waitForTimeout(500);
if (stop) {
resolve();
return;
Expand Down
6 changes: 5 additions & 1 deletion src/main/modules/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ let settings_window;

export function createSettingsWindow() {
settings_window = new BrowserWindow({
webPreferences: { nodeIntegration: true },
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
},
skipTaskbar: true,
center: true,
show: false,
width: config.general.width * 2,
icon: path.join(__static, 'logo.png'),
paintWhenInitiallyHidden: true,
});

if (isDevelopment) {
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const styles = {
display: 'flex',
flexFlow: 'row nowrap',
width: '100%',
height: 'min-content',
maxHeight: '100%',
overflow: 'hidden',
},
list: {
Expand Down
7 changes: 5 additions & 2 deletions src/renderer/main/preview/audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ import React, { useEffect } from 'react';

const styles = {
color_preview: {
width: '100%',
width: '30%',
position: 'absolute',
right: 0,
top: 0,
},
}

function AudioPreview(props) {
useEffect(() => {
if(props.onLoad) {
props.onLoad('20%');
props.onLoad('0%');
}
}, []);
return (
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/main/preview/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ const styles = {
function EmbedPreview(props) {
const ref = createRef();
const onLoad = () => {
props.onLoad('0%');
if(props.onLoad) {
props.onLoad('0%');
}
};
useEffect(() => {
ref.current.innerHTML = `<embed style="width:100%; height: 100%;" src="${props.preview.url}"></embed>`;
Expand Down
7 changes: 5 additions & 2 deletions src/renderer/main/preview/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ import React, { useEffect } from 'react';

const styles = {
color_preview: {
width: '100%',
width: '50%',
position: 'absolute',
right: 0,
top: 0,
},
}

function ImagePreview(props) {
useEffect(() => {
if(props.onLoad) {
props.onLoad('50%');
props.onLoad('0%');
}
}, []);
return (
Expand Down
7 changes: 5 additions & 2 deletions src/renderer/main/preview/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ import React, { useEffect } from 'react';

const styles = {
color_preview: {
width: '100%',
width: '50%',
position: 'absolute',
right: 0,
top: 0,
},
}

function VideoPreview(props) {
useEffect(() => {
if(props.onLoad) {
props.onLoad('50%');
props.onLoad('0%');
}
}, []);
return (
Expand Down
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3080,10 +3080,10 @@ electron-webpack@^2.8.2:
webpack-merge "^4.2.2"
yargs "^15.3.1"

electron@9.0.0:
version "9.0.0"
resolved "https://registry.yarnpkg.com/electron/-/electron-9.0.0.tgz#335cd426a8a542ad8d4c96c0c40a8668ab5527b8"
integrity sha512-JsaSQNPh+XDYkLj8APtVKTtvpb86KIG57W5OOss4TNrn8L3isC9LsCITwfnVmGIXHhvX6oY/weCtN5hAAytjVg==
electron@^9.3.5:
version "9.3.5"
resolved "https://registry.yarnpkg.com/electron/-/electron-9.3.5.tgz#7967146b81e6d9b484773243fd4a4f671a50b884"
integrity sha512-EPmDsp7sO0UPtw7nLD1ufse/nBskP+ifXzBgUg9psCUlapkzuwYi6pmLAzKLW/bVjwgyUKwh1OKWILWfOeLGcQ==
dependencies:
"@electron/get" "^1.0.1"
"@types/node" "^12.0.12"
Expand Down Expand Up @@ -6609,9 +6609,9 @@ spdx-expression-parse@^3.0.0:
spdx-license-ids "^3.0.0"

spdx-license-ids@^3.0.0:
version "3.0.6"
resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.6.tgz#c80757383c28abf7296744998cbc106ae8b854ce"
integrity sha512-+orQK83kyMva3WyPf59k1+Y525csj5JejicWut55zeTWANuN17qSiSLUXWtzHeNWORSvT7GLDJ/E/XiIWoXBTw==
version "3.0.7"
resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz#e9c18a410e5ed7e12442a549fbd8afa767038d65"
integrity sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==

spdy-transport@^3.0.0:
version "3.0.0"
Expand Down

0 comments on commit a05f95c

Please sign in to comment.