Skip to content

Commit

Permalink
add wikipedia as dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
troyeguo committed Jan 1, 2024
1 parent c4bd856 commit 47f14df
Show file tree
Hide file tree
Showing 22 changed files with 1,899 additions and 66 deletions.
26 changes: 26 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,32 @@ const createMainWin = () => {
return null;
}
});
ipcMain.handle("wiki-index", async (event, config) => {
const wiki = require("wikijs").default;
console.log(config);
try {
let page = await wiki({
apiUrl: "https://" + config.code + ".wikipedia.org/w/api.php",
}).page(config.text);
let summary = await page.summary();
let image = await page.mainImage();
return { summary, image };
} catch (error) {
console.error(error);
return null;
}
});
ipcMain.handle("wiki-images", async (event, config) => {
const wiki = require("wikijs").default;
try {
return await wiki()
.page("bat")
.then((page) => page.mainImage());
} catch (error) {
console.error(error);
return null;
}
});
ipcMain.on("storage-location", (event, arg) => {
event.returnValue = path.join(dirPath, "data");
});
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"uuid": "^9.0.1",
"webdav": "^3.6.2",
"webdav-fs": "3.0.0",
"wikijs": "^6.4.1",
"wink-lemmatizer": "^3.0.4",
"ws": "^8.13.0",
"zip-a-folder": "^0.0.12"
Expand Down
7 changes: 0 additions & 7 deletions public/assets/styles/blue.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@
.setting-close-container:hover,
.side-menu-hover-container,
.setting-dialog-location-title,
.note-option:hover,
.digest-option:hover,
.translation-option:hover,
.speaker-option:hover,
.search-book-option:hover,
.dict-option:hover,
.browser-option:hover,
.header-search-text:hover,
.reader-setting-icon-container:hover,
.setting-icon-container:hover,
Expand Down
1 change: 1 addition & 0 deletions public/assets/styles/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ body {
.speaker-option:hover,
.search-book-option:hover,
.dict-option:hover,
.wikipedia-option:hover,
.browser-option:hover,
.header-search-text:hover,
.reader-setting-icon-container:hover,
Expand Down
1 change: 1 addition & 0 deletions public/assets/styles/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ body {
.backup-page-backup:hover,
.search-book-option:hover,
.dict-option:hover,
.wikipedia-option:hover,
.browser-option:hover,
.header-search-text:hover,
.reader-setting-icon-container:hover,
Expand Down
7 changes: 0 additions & 7 deletions public/assets/styles/green.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@
.setting-close-container:hover,
.side-menu-hover-container,
.setting-dialog-location-title,
.note-option:hover,
.digest-option:hover,
.translation-option:hover,
.speaker-option:hover,
.search-book-option:hover,
.dict-option:hover,
.browser-option:hover,
.header-search-text:hover,
.reader-setting-icon-container:hover,
.setting-icon-container:hover,
Expand Down
7 changes: 0 additions & 7 deletions public/assets/styles/purple.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@
.setting-close-container:hover,
.side-menu-hover-container,
.setting-dialog-location-title,
.note-option:hover,
.digest-option:hover,
.translation-option:hover,
.speaker-option:hover,
.search-book-option:hover,
.dict-option:hover,
.browser-option:hover,
.header-search-text:hover,
.reader-setting-icon-container:hover,
.setting-icon-container:hover,
Expand Down
7 changes: 0 additions & 7 deletions public/assets/styles/red.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@
.setting-close-container:hover,
.side-menu-hover-container,
.setting-dialog-location-title,
.note-option:hover,
.digest-option:hover,
.translation-option:hover,
.speaker-option:hover,
.search-book-option:hover,
.dict-option:hover,
.browser-option:hover,
.header-search-text:hover,
.reader-setting-icon-container:hover,
.setting-icon-container:hover,
Expand Down
Binary file modified src/assets/styles/fonts/icomoon.eot
Binary file not shown.
1 change: 1 addition & 0 deletions src/assets/styles/fonts/icomoon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/styles/fonts/icomoon.ttf
Binary file not shown.
Binary file modified src/assets/styles/fonts/icomoon.woff
Binary file not shown.
13 changes: 8 additions & 5 deletions src/assets/styles/style.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@font-face {
font-family: 'icomoon';
src: url('fonts/icomoon.eot?2sz268');
src: url('fonts/icomoon.eot?2sz268#iefix') format('embedded-opentype'),
url('fonts/icomoon.ttf?2sz268') format('truetype'),
url('fonts/icomoon.woff?2sz268') format('woff'),
url('fonts/icomoon.svg?2sz268#icomoon') format('svg');
src: url('fonts/icomoon.eot?w46lf');
src: url('fonts/icomoon.eot?w46lf#iefix') format('embedded-opentype'),
url('fonts/icomoon.ttf?w46lf') format('truetype'),
url('fonts/icomoon.woff?w46lf') format('woff'),
url('fonts/icomoon.svg?w46lf#icomoon') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
Expand All @@ -25,6 +25,9 @@
-moz-osx-font-smoothing: grayscale;
}

.icon-wikipedia:before {
content: "\e957";
}
.icon-sftp:before {
content: "\e956";
}
Expand Down
Loading

0 comments on commit 47f14df

Please sign in to comment.