Skip to content

Commit

Permalink
updated with macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
RoderickQiu committed Jun 6, 2019
1 parent be80fa5 commit 0918582
Show file tree
Hide file tree
Showing 11 changed files with 454 additions and 391 deletions.
5 changes: 5 additions & 0 deletions about.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<a href="javascript:window.close()" class="small rest"><i class="fa fa-times fa-fw" id="close"></i></a>
<script>
$('#close').attr('title', i18n.__('close'));
if (process.platform == "darwin") $("#controller").css("display", "none");
</script>
</div>
<div id="about" class="justify-content-center text-center">
Expand All @@ -50,6 +51,10 @@
$('#issues').attr('title', i18n.__('issues'));
</script>
</p>
<p class="extreme-small">
<a class="rest"
href="javascript:require('electron').shell.openExternal('https://wnr.scris.top/acknoledgements.html/')">Acknoledgements</a>
</p>
<hr />
<p class="extreme-small">
<script>document.write(i18n.__('tip1'));</script>
Expand Down
13 changes: 13 additions & 0 deletions docs/acknoledgements.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<h1>Packages using: </h1>
- node-auto-launch, Teamwork, MIT License.<br />
- compare-version, kevva, MIT License.<br />
- electron-store, sindresorhus, MIT License.<br />
- i18n-node, mashpie, MIT License.<br />
- node-notifier, mikaelbr, MIT License.<br />
- request, request, Apache-2.0 License.<br />
- electron, electron, MIT License.<br />
- electron-builder, electron-userland, MIT License.<br />
- node, nodejs, <a href="https://github.com/nodejs/node/blob/master/LICENSE">License</a>.<br />
- jQuery, JS Foundation and other contributors, <a href="https://jquery.org/license">License</a>.<br />
- bootstrap, twbs, MIT License.<br />
- font-awesome, fontawesome, <a href="https://github.com/FortAwesome/Font-Awesome/blob/master/LICENSE.txt">License</a>.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
$('#winhider').attr('title', i18n.__('winhider'));
$('#minimizer').attr('title', i18n.__('minimizer'));
$('#exit').attr('title', i18n.__('exit'));
if (process.platform == "darwin") $("#controller").css("display", "none");
</script>
</div>
<div id="tip" class="extreme-small font-weight-bold text-black-50">
Expand Down
5 changes: 4 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,8 @@
"allsum1": "all together",
"allsum2": "minutes, to ",
"1min": "Only 1 minute left",
"1minmsg": "Only a few amount of time left! "
"1minmsg": "Only a few amount of time left! ",
"dothings": "Options",
"tourguide": "Tourguide",
"about": "About wnr"
}
5 changes: 4 additions & 1 deletion locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,8 @@
"allsum1": "共计",
"allsum2": "分钟,到",
"1min": "时间仅剩1分钟",
"1minmsg": "这一段时间只剩下1分钟了,好好规划一下暂时的收尾工作吧!"
"1minmsg": "这一段时间只剩下1分钟了,好好规划一下暂时的收尾工作吧!",
"dothings": "操作",
"tourguide": "导览",
"about": "关于"
}
132 changes: 80 additions & 52 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function createWindow() {
show: false,
hasShadow: true,
webPreferences: { nodeIntegration: true },
titleBarStyle: "hiddenInset",
title: "wnr",
icon: "./res/icons/wnrIcon.png",
backgroundColor: "#fefefe"
Expand Down Expand Up @@ -177,8 +178,25 @@ app.on('ready', () => {
}
}]
}, {
label: i18n.__('help'),
label: i18n.__('dothings'),
submenu: [{
label: i18n.__('settings'),
click: function () {
settings();
}
}, {
label: i18n.__('tourguide'),
click: function () {
tourguide();
}
}, {
label: i18n.__('about'),
click: function () {
about();
}
}, {
type: 'separator'
}, {
label: i18n.__('website'),
click: function () {
shell.openExternal('https://wnr.scris.top/');
Expand All @@ -189,14 +207,15 @@ app.on('ready', () => {
shell.openExternal('https://wnr.scris.top/help.html');
}
}, {
label: i18n.__('ongithub'),
label: i18n.__('github'),
click: function () {
shell.openExternal('https://github.com/RoderickQiu/wnr/');
}
}]
}];
var osxMenu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(osxMenu)
Menu.setApplicationMenu(osxMenu);
app.dock.setMenu(osxMenu)
}// 应付macOS的顶栏空缺


Expand Down Expand Up @@ -332,63 +351,72 @@ ipcMain.on('minimizer', function () {
win.minimize()
})

ipcMain.on('about', function () {
aboutWin = new BrowserWindow({ parent: win, modal: true, width: 256, height: 233, resizable: false, frame: false, show: false, center: true, webPreferences: { nodeIntegration: true } });
aboutWin.loadFile("about.html");
if (store.get("top") == true) aboutWin.setAlwaysOnTop(true);
aboutWin.once('ready-to-show', () => {
aboutWin.show();
})
aboutWin.on('closed', () => {
aboutWin = null
})
})

ipcMain.on('settings', function () {
settingsWin = new BrowserWindow({ parent: win, modal: true, width: 729, height: 486, resizable: false, frame: false, show: false, center: true, webPreferences: { nodeIntegration: true } });
settingsWin.loadFile("settings.html");
if (store.get("top") == true) settingsWin.setAlwaysOnTop(true);
settingsWin.once('ready-to-show', () => {
settingsWin.show();
})
settingsWin.on('closed', () => {
if (win != null) {
win.reload();
function about() {
if (app.isReady()) {
aboutWin = new BrowserWindow({ parent: win, width: 256, height: 233, resizable: false, frame: false, show: false, center: true, titleBarStyle: "hidden", webPreferences: { nodeIntegration: true } });
aboutWin.loadFile("about.html");
if (store.get("top") == true) aboutWin.setAlwaysOnTop(true);
aboutWin.once('ready-to-show', () => {
aboutWin.show();
})
aboutWin.on('closed', () => {
aboutWin = null
})
}
}
ipcMain.on('about', about);

function settings() {
if (app.isReady()) {
settingsWin = new BrowserWindow({ parent: win, width: 729, height: 486, resizable: false, frame: false, show: false, center: true, webPreferences: { nodeIntegration: true }, titleBarStyle: "hidden" });
settingsWin.loadFile("settings.html");
if (store.get("top") == true) settingsWin.setAlwaysOnTop(true);
settingsWin.once('ready-to-show', () => {
settingsWin.show();
})
settingsWin.on('closed', () => {
if (win != null) {
win.reload();
}
settingsWin = null
})
if (!store.get("settings-experience")) {
store.set("settings-experience", true);
notifier.notify(
{
title: i18n.__('settingstip'),
message: i18n.__('settingstipmsg'),
sound: true, // Only Notification Center or Windows Toasters
wait: true // Wait with callback, until user action is taken against notification
}
);
}
settingsWin = null
})
if (!store.get("settings-experience")) {
store.set("settings-experience", true);
}
}
ipcMain.on('settings', settings);

function tourguide() {
if (app.isReady()) {
tourWin = new BrowserWindow({ parent: win, width: 729, height: 600, resizable: false, frame: false, show: false, center: true, titleBarStyle: "hidden", webPreferences: { nodeIntegration: true } });
tourWin.loadFile("tourguide.html");
if (store.get("top") == true) tourWin.setAlwaysOnTop(true);
tourWin.once('ready-to-show', () => {
tourWin.show();
})
tourWin.on('closed', () => {
tourWin = null
})
notifier.notify(
{
title: i18n.__('settingstip'),
message: i18n.__('settingstipmsg'),
title: i18n.__('welcomer1'),
message: i18n.__('alarmtipmsg'),
sound: true, // Only Notification Center or Windows Toasters
wait: true // Wait with callback, until user action is taken against notification
}
);
}
})

ipcMain.on('tourguide', function () {
tourWin = new BrowserWindow({ parent: win, modal: true, width: 729, height: 600, resizable: false, frame: false, show: false, center: true, webPreferences: { nodeIntegration: true } });
tourWin.loadFile("tourguide.html");
if (store.get("top") == true) tourWin.setAlwaysOnTop(true);
tourWin.once('ready-to-show', () => {
tourWin.show();
})
tourWin.on('closed', () => {
tourWin = null
})
notifier.notify(
{
title: i18n.__('welcomer1'),
message: i18n.__('alarmtipmsg'),
sound: true, // Only Notification Center or Windows Toasters
wait: true // Wait with callback, until user action is taken against notification
}
);
})
}
ipcMain.on('tourguide', tourguide);

ipcMain.on('1min', function () {
notifier.notify(
Expand Down
Loading

0 comments on commit 0918582

Please sign in to comment.