From 87ee6203ca842be664136b6484a3e2230eb3b3ef Mon Sep 17 00:00:00 2001 From: troyeguo <13820674+troyeguo@users.noreply.github.com> Date: Mon, 14 Jun 2021 16:11:25 +0800 Subject: [PATCH 1/9] fix bug Former-commit-id: db0d8c07547aa39c82bc89a9fc037decbb86f175 --- main.js | 8 ++++---- src/containers/header/component.tsx | 7 ------- src/containers/lists/contentList/component.tsx | 6 +----- src/utils/syncUtils/backupUtil.tsx | 1 - src/utils/syncUtils/common.tsx | 18 ------------------ 5 files changed, 5 insertions(+), 35 deletions(-) diff --git a/main.js b/main.js index ab37c549..a190725d 100644 --- a/main.js +++ b/main.js @@ -33,10 +33,10 @@ app.on("ready", () => { }, }); const isDev = require("electron-is-dev"); - if (!isDev) { - const { Menu } = require("electron"); - Menu.setApplicationMenu(null); - } + // if (!isDev) { + // const { Menu } = require("electron"); + // Menu.setApplicationMenu(null); + // } const path = require("path"); const urlLocation = isDev diff --git a/src/containers/header/component.tsx b/src/containers/header/component.tsx index 3e535e5c..e57974f9 100644 --- a/src/containers/header/component.tsx +++ b/src/containers/header/component.tsx @@ -24,7 +24,6 @@ class Header extends React.Component { }; } componentDidMount() { - console.log(localStorage.getItem("lastSyncTime"), "localStorage1"); if (isElectron) { const fs = window.require("fs"); const path = window.require("path"); @@ -80,7 +79,6 @@ class Header extends React.Component { return; } const readerConfig = JSON.parse(data); - console.log(localStorage.getItem("lastSyncTime"), "localStorage2"); if ( localStorage.getItem("lastSyncTime") && parseInt(readerConfig.lastSyncTime) > @@ -185,11 +183,6 @@ class Header extends React.Component { } const readerConfig = JSON.parse(data); - console.log( - localStorage.getItem("lastSyncTime"), - readerConfig.lastSyncTime, - "localStorage3" - ); if ( readerConfig && localStorage.getItem("lastSyncTime") && diff --git a/src/containers/lists/contentList/component.tsx b/src/containers/lists/contentList/component.tsx index 62f99bb2..b3a60901 100644 --- a/src/containers/lists/contentList/component.tsx +++ b/src/containers/lists/contentList/component.tsx @@ -40,11 +40,7 @@ class ContentList extends React.Component { this.props.currentEpub.rendition.display(href); } else { let id = href.substr(1); - console.log( - id, - window.frames[0].document, - window.frames[0].document.getElementById(id) - ); + var top = window.frames[0].document.getElementById(id)?.offsetTop; if (!top) return; window.frames[0].scrollTo(0, top); diff --git a/src/utils/syncUtils/backupUtil.tsx b/src/utils/syncUtils/backupUtil.tsx index e794ba85..3bfdb357 100644 --- a/src/utils/syncUtils/backupUtil.tsx +++ b/src/utils/syncUtils/backupUtil.tsx @@ -40,7 +40,6 @@ class BackupUtil { } } else { let timestamp = new Date().getTime().toString(); - console.log(timestamp, "timestamp"); OtherUtil.setReaderConfig("lastSyncTime", timestamp); localStorage.setItem("lastSyncTime", timestamp); diff --git a/src/utils/syncUtils/common.tsx b/src/utils/syncUtils/common.tsx index 12feb15c..8191c2b2 100644 --- a/src/utils/syncUtils/common.tsx +++ b/src/utils/syncUtils/common.tsx @@ -62,24 +62,6 @@ export const moveData = ( if (driveIndex === 5) { handleFinish(); } - // try { - // const fs = window.require("fs-extra"); - - // fs.remove(path.join(dirPath, file.name), async (err) => { - // if (err) console.log(err); - // if (driveIndex === 4) { - // let deleteBooks = books.map((item) => { - // return localforage.removeItem(item.key); - // }); - // await Promise.all(deleteBooks); - // } - // if (driveIndex === 5) { - // handleFinish(); - // } - // }); - // } catch (e) { - // console.error(e, "移动失败"); - // } }; }; From 53d205a665ebd5b7c486166d8c2c514d477a5d05 Mon Sep 17 00:00:00 2001 From: troyeguo <13820674+troyeguo@users.noreply.github.com> Date: Mon, 14 Jun 2021 16:23:24 +0800 Subject: [PATCH 2/9] fix bug Former-commit-id: b1fea8e080f661ac73b6cf58a88f5d5f1bbc2f3c --- src/assets/locales/tw/translation.json | 118 ++++++++++++------------- src/pages/htmlReader/component.tsx | 1 + src/utils/htmlParser.tsx | 4 +- 3 files changed, 62 insertions(+), 61 deletions(-) diff --git a/src/assets/locales/tw/translation.json b/src/assets/locales/tw/translation.json index 3099f49a..26b4d046 100644 --- a/src/assets/locales/tw/translation.json +++ b/src/assets/locales/tw/translation.json @@ -219,75 +219,75 @@ "Cover Mode": "封面模式", "Update to": "更新至", "Update Complete": "更新成功", - "Changelog": "更新日志", - "Download": "前往下载", - "Theme Color": "选择主题色", - "The deleted books will show up here": "被删除的图书会出现在这里,清空回收站才会彻底删除", - "Disable update notification": "暂停接收更新", - "Use the fonts from your local computer": "使用电脑中的字体", - "Backup your data with Webdav": "使用 Webdav 来备份和恢复数据", - "More formats supported": "支持更多的图书格式,mobi、azw3、txt", - "Download Desktop Version": "下载客户端", - "Koodo Reader's web version are limited by the browser, for more powerful features, please download the desktop version.": "网页版功能受浏览器限制,部分功能仅客户端支持", - "Do you want to backup or restore?": "选择您的操作", - "Where is your data?": "选择资料来源", - "Where to keep your data?": "选择资料存放位置", - "Not supported yet": "暂不支持", - "Unauthorize": "取消授权", - "Unauthorize Successfully": "取消授权成功", - "Change storage location": "更改存储位置", + "Changelog": "更新日誌", + "Download": "前往下載", + "Theme Color": "選擇主題色", + "The deleted books will show up here": "被刪除的圖書會出現在這裏,清空回收站才會徹底刪除", + "Disable update notification": "暫停接收更新", + "Use the fonts from your local computer": "使用電腦中的字體", + "Backup your data with Webdav": "使用 Webdav 來備份和恢復數據", + "More formats supported": "支持更多的圖書格式,mobi、azw3、txt", + "Download Desktop Version": "下載客戶端", + "Koodo Reader's web version are limited by the browser, for more powerful features, please download the desktop version.": "網頁版功能受瀏覽器限製,部分功能僅客戶端支持", + "Do you want to backup or restore?": "選擇您的操作", + "Where is your data?": "選擇資料來源", + "Where to keep your data?": "選擇資料存放位置", + "Not supported yet": "暫不支持", + "Unauthorize": "取消授權", + "Unauthorize Successfully": "取消授權成功", + "Change storage location": "更改存儲位置", "Change location": "更改", "Change Successfully": "更改成功", - "Change Failed": "更改失败", + "Change Failed": "更改失敗", "You successfully update to": "您已成功更新到", - "Built-in font": "默认字体", - "View Mode": "视图模式", - "Letter Spacing": "字间距", + "Built-in font": "默認字體", + "View Mode": "視圖模式", + "Letter Spacing": "字間距", "Voice": "音色", - "Unlock": "解锁", - "Lock": "锁定", - "Speed": "语速", - "Collapse sidebar": "收起侧边栏", - "Show sidebar": "打开侧边栏", + "Unlock": "解鎖", + "Lock": "鎖定", + "Speed": "語速", + "Collapse sidebar": "收起側邊欄", + "Show sidebar": "打開側邊欄", "Sync": "同步", - "Help": "需要帮助", - "Feedback": "反馈建议", - "Default search engine": "默认搜索引擎", - "Github Repo": "Github 仓库", - "Turn on auto update": "开启自动更新", - "Text Align": "文字对齐", - "left": "左对齐", - "justify": "两端对齐", - "right": "右对齐", + "Help": "需要幫助", + "Feedback": "反饋建議", + "Default search engine": "默認搜索引擎", + "Github Repo": "Github 倉庫", + "Turn on auto update": "開啟自動更新", + "Text Align": "文字對齊", + "left": "左對齊", + "justify": "兩端對齊", + "right": "右對齊", "Understand": "我知道了", "Sync Successfully": "同步成功", - "Permanently Delete": "永久删除", - "Roadmap": "开发计划", - "Paragraph Spacing": "段落间距", - "Italic": "斜体", - "Text Underline": "下划线", - "Text Shadow": "文字阴影", - "Speak the text": "朗读文字", - "Try refresh or restart": "重启软件后生效", - "Search on the internet": "网上搜索", - "Search in the book": "全书搜索", - "Remember window's size from last read": "记忆阅读器窗口大小", - "Blue": "蓝色", - "Customize": "自定义", - "Red": "红色", + "Permanently Delete": "永久刪除", + "Roadmap": "開發計劃", + "Paragraph Spacing": "段落間距", + "Italic": "斜體", + "Text Underline": "下劃線", + "Text Shadow": "文字陰影", + "Speak the text": "朗讀文字", + "Try refresh or restart": "重啟軟件後生效", + "Search on the internet": "網上搜索", + "Search in the book": "全書搜索", + "Remember window's size from last read": "記憶閱讀器窗口大小", + "Blue": "藍色", + "Customize": "自定義", + "Red": "紅色", "Brightness": "屏幕亮度", - "Green": "绿色", + "Green": "綠色", "Purple": "紫色", - "Auto open book in fullscreen": "图书窗口自动最大化", - "System Font": "系统字体", + "Auto open book in fullscreen": "圖書窗口自動最大化", + "System Font": "系統字體", "Tips": "提示", - "How sync works": "同步是如何实现的?", - "You need to manually change the storage location to the same sync folder on different computers. When you click the sync button, Koodo Reader will automatically upload or download the data from this folder according the timestamp.": "同步功能需要配合第三方同步盘实现,在不同电脑上把数据存储位置修改为同一个同步文件夹,手动点击同步按钮后,Koodo会把同步文件夹中的数据更新到软件中,从而实现同步。", - "Please choose an empty folder": "请选择空文件夹", - "Data change detected, whether to update?": "检测到数据变化,是否更新", + "How sync works": "同步是如何實現的?", + "You need to manually change the storage location to the same sync folder on different computers. When you click the sync button, Koodo Reader will automatically upload or download the data from this folder according the timestamp.": "同步功能需要配合第三方同步盤實現,在不同電腦上把數據存儲位置修改為同一個同步文件夾,手動點擊同步按鈕後,Koodo會把同步文件夾中的數據更新到軟件中,從而實現同步。", + "Please choose an empty folder": "請選擇空文件夾", + "Data change detected, whether to update?": "檢測到數據變化,是否更新", "File Size": "文件大小", - "Take effect at next startup": "下次打开图书生效", - "Auto Update relys on Github Release for package hosting, if your internet doesn't have stable connection to Github, we highly recommand you to turn off this option": "自动更新功能依赖Github,如果您本地网络无法稳定访问Github,则不建议开启此功能,开启之后,将不再单独提供更新提醒。", - "Bold Font": "字体加粗" + "Take effect at next startup": "下次打開圖書生效", + "Auto Update relys on Github Release for package hosting, if your internet doesn't have stable connection to Github, we highly recommand you to turn off this option": "自動更新功能依賴Github,如果您本地網絡無法穩定訪問Github,則不建議開啟此功能,開啟之後,將不再單獨提供更新提醒。", + "Bold Font": "字體加粗" } diff --git a/src/pages/htmlReader/component.tsx b/src/pages/htmlReader/component.tsx index f8d53b66..e5fed541 100644 --- a/src/pages/htmlReader/component.tsx +++ b/src/pages/htmlReader/component.tsx @@ -198,6 +198,7 @@ class Reader extends React.Component { onClick={() => { this.handleEnterReader("bottom"); }} + style={this.props.currentEpub ? {} : { display: "none" }} >
Date: Mon, 14 Jun 2021 17:15:38 +0800 Subject: [PATCH 3/9] fix bug Former-commit-id: 87d1882bd49e5eed44186700210bb0709948c0e9 --- main.js | 12 +-- public/index.html | 123 +---------------------- src/components/bookCardtem/component.tsx | 4 +- src/index.tsx | 8 +- 4 files changed, 10 insertions(+), 137 deletions(-) diff --git a/main.js b/main.js index a190725d..9694ef9a 100644 --- a/main.js +++ b/main.js @@ -112,16 +112,10 @@ app.on("ready", () => { readerWindow = null; }); }); - ipcMain.on("fonts-ready", (event, arg) => { + ipcMain.handle("fonts-ready", async (event, arg) => { const fontList = require("font-list"); - fontList - .getFonts({ disableQuoting: true }) - .then((fonts) => { - event.returnValue = fonts; - }) - .catch((err) => { - console.log(err); - }); + const fonts = await fontList.getFonts({ disableQuoting: true }); + return fonts; }); ipcMain.on("storage-location", (event, arg) => { diff --git a/public/index.html b/public/index.html index 53752649..b8b72061 100644 --- a/public/index.html +++ b/public/index.html @@ -20,133 +20,12 @@ height: 100%; width: 100%; } - .loading-cover { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - } - .logo-container { - width: 200px; - } - .loading-cover img { - width: 80px; - position: relative; - left: 50%; - top: 50%; - margin-left: -40px; - margin-top: -80px; - } - .cover-spinner { - position: absolute; - left: 50%; - top: 50%; - margin-left: -15px; - margin-top: 40px; - } - .sk-chase { - width: 30px; - height: 30px; - animation: sk-chase 2.5s infinite linear both; - z-index: 20; - } - - .sk-chase-dot { - width: 100%; - height: 100%; - position: absolute; - left: 0; - top: 0; - animation: sk-chase-dot 2s infinite ease-in-out both; - } - - .sk-chase-dot:before { - content: ""; - display: block; - width: 25%; - height: 25%; - border-radius: 100%; - animation: sk-chase-dot-before 2s infinite ease-in-out both; - } - - .sk-chase-dot:nth-child(1) { - animation-delay: -1.1s; - } - .sk-chase-dot:nth-child(2) { - animation-delay: -1s; - } - .sk-chase-dot:nth-child(3) { - animation-delay: -0.9s; - } - .sk-chase-dot:nth-child(4) { - animation-delay: -0.8s; - } - .sk-chase-dot:nth-child(5) { - animation-delay: -0.7s; - } - .sk-chase-dot:nth-child(6) { - animation-delay: -0.6s; - } - .sk-chase-dot:nth-child(1):before { - animation-delay: -1.1s; - } - .sk-chase-dot:nth-child(2):before { - animation-delay: -1s; - } - .sk-chase-dot:nth-child(3):before { - animation-delay: -0.9s; - } - .sk-chase-dot:nth-child(4):before { - animation-delay: -0.8s; - } - .sk-chase-dot:nth-child(5):before { - animation-delay: -0.7s; - } - .sk-chase-dot:nth-child(6):before { - animation-delay: -0.6s; - } - - @keyframes sk-chase { - 100% { - transform: rotate(360deg); - } - } - - @keyframes sk-chase-dot { - 80%, - 100% { - transform: rotate(360deg); - } - } - - @keyframes sk-chase-dot-before { - 50% { - transform: scale(0.4); - } - 100%, - 0% { - transform: scale(1); - } - } Koodo Reader -
- -
-
-
-
-
-
-
-
-
-
-
+