Skip to content

Commit

Permalink
bugs fixed & hotkey for back
Browse files Browse the repository at this point in the history
  • Loading branch information
RoderickQiu committed Aug 22, 2019
1 parent 181cdf9 commit cf04950
Show file tree
Hide file tree
Showing 11 changed files with 257 additions and 117 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ yDic是一个轻量级、易用的电脑端词典解决方案。

## 致谢名单

### 使用以下依赖包
### 使用以下依赖包

- Electron, Electron, MIT License.
- request, request, Apache-2.0 License.
Expand All @@ -20,19 +20,19 @@ yDic是一个轻量级、易用的电脑端词典解决方案。
- electron-store, Sindre Sorhus, MIT License.
- electron-builder, Electron Userland, MIT License.

### 使用以下API
### 使用以下API

- 有道智云, ©2017 网易公司, [许可协议](https://youdao.com/terms).
- Merriam-Webster Advanced English Learner's Dictionary API, © 2018 Merriam-Webster Incorporated, [许可协议](https://dictionaryapi.com/info/terms-of-service).
- 百度翻译开放平台, © 2018 Baidu, [许可协议](https://fanyi-api.baidu.com/api/trans/product/apidoc).
- 必应词典, © 2019 Microsoft, [许可协议](https://www.microsoft.com/zh-cn/servicesagreement).

### 使用以下资源
### 使用以下资源

- Modern UI Icons, Austin Andrews, Creative Commons Attribution-Share Alike 3.0 Unported License.
- Source Han Sans, Adobe Fonts, SIL Open Font License 1.1.
- english-wordlists, mahavivo, [许可协议](https://github.com/mahavivo/english-wordlists).

感谢这些项目的开发者/开发公司,没有他们,这个项目就不可能实现。

Copyright (c) 2018-2019 [Roderick Qiu](https://roderickqiu.scris.top/).
Copyright (c) 2018-2019 [Roderick Qiu](https://roderickqiu.scris.top/).
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimal-ui" />
<script>if (typeof module === 'object') { window.module = module; module = undefined; }</script><!-- 解决electron环境下jQuery缺失问题 -->
<script>
if (typeof module === 'object') {
window.module = module; module = undefined;
}
</script><!-- 解决electron环境下jQuery缺失问题 -->
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/barCtrl.js"></script>
<script>
Expand Down
55 changes: 31 additions & 24 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,31 +40,31 @@ app.on('will-quit', () => {



// Electron 会在初始化后并准备
// 创建浏览器窗口时,调用这个函数。
// 部分 API 在 ready 事件触发后才能使用。
app.on('ready', () => {
createWindow()
// Electron 会在初始化后并准备
// 创建浏览器窗口时,调用这个函数。
// 部分 API 在 ready 事件触发后才能使用。
app.on('ready', () => {
createWindow()

tray = new Tray('./res/icons/iconWin.ico')
const contextMenu = Menu.buildFromTemplate([
{ label: '退出', click: () => { app.quit() } }
])
tray.setToolTip('yDic 你的词典')
tray.setContextMenu(contextMenu)
tray.on('click', () => {
win.isVisible() ? win.hide() : win.show()
})//托盘菜单

var hideOrShowAcc = store.get('hideOrShowAcc');
if (hideOrShowAcc == 'undefined' || !hideOrShowAcc) {
store.set('hideOrShowAcc', 'Y');
hideOrShowAcc = 'Y';
}
globalShortcut.register('CommandOrControl+Alt+Shift+' + hideOrShowAcc, () => {
win.isVisible() ? win.hide() : win.show()
})//注册全局快捷键:显示/隐藏
})
tray = new Tray('./res/icons/iconWin.ico')
const contextMenu = Menu.buildFromTemplate([
{ label: '退出', click: () => { app.quit() } }
])
tray.setToolTip('yDic 你的词典')
tray.setContextMenu(contextMenu)
tray.on('click', () => {
win.isVisible() ? win.hide() : win.show()
})//托盘菜单

var hideOrShowAcc = store.get('hideOrShowAcc');
if (hideOrShowAcc == 'undefined' || !hideOrShowAcc) {
store.set('hideOrShowAcc', 'Y');
hideOrShowAcc = 'Y';
}
globalShortcut.register('CommandOrControl+Alt+Shift+' + hideOrShowAcc, () => {
win.isVisible() ? win.hide() : win.show()
})//注册全局快捷键:显示/隐藏
})

app.on('activate', () => {
// 在macOS上,当单击dock图标并且没有其他窗口打开时,
Expand Down Expand Up @@ -93,4 +93,11 @@ ipcMain.on('window-englishExplains', function () {
win.setContentSize(768, 450)
win.center()
}
})

//返回首页
ipcMain.on('back-home', function () {
if (win != null) {
win.loadFile("index.html")
}
})
61 changes: 61 additions & 0 deletions pack.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "yDic"
#define MyAppVersion "1.4.2"
#define MyAppPublisher "Roderick Qiu"
#define MyAppPublisherURL "https://r-q.name/"
#define MyAppURL "https://ydic.scris.top/"
#define MyAppUpdateURL "https://github.com/RoderickQiu/ydic/releases"
#define MyAppExeName "yDic.exe"
#define MyFolder "C:\Users\RoderickQiu\Documents\ydic"
#define MyYear "2019"

[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{DBC3F859-21A9-4815-9548-E1EE65BAD707}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
VersionInfoVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppPublisherURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppUpdateURL}
AppCopyright=Copyright (C) {#MyYear} {#MyAppPublisher}
DefaultDirName={autopf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
; Uncomment the following line to run in non administrative install mode (install for current user only.)
PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog
OutputBaseFilename=ydic-{#MyAppVersion}-win
OutputDir={#MyFolder}\dist
SetupIconFile={#MyFolder}\res\icons\iconWin.ico
Compression=lzma2/max
SolidCompression=yes
WizardStyle=modern

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "chinesesimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "{#MyFolder}\dist\win-unpacked\yDic.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#MyFolder}\dist\win-unpacked\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

Loading

0 comments on commit cf04950

Please sign in to comment.