Skip to content

Commit

Permalink
optimized
Browse files Browse the repository at this point in the history
  • Loading branch information
RoderickQiu committed Mar 23, 2019
1 parent f850983 commit 56f574f
Show file tree
Hide file tree
Showing 15 changed files with 183 additions and 104 deletions.
5 changes: 3 additions & 2 deletions docs/bangzhu.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ <h2 class="h4">1、如何使用</h2>
<br />
<img src="https://raw.githubusercontent.com/RoderickQiu/wnr/master/res/preview/preview-10.png"
class="img-fluid" /><br />
以上就是全部的基本使用技巧了,开始让wnr改变你吧!<br />
如果有需要更改一些设置,你可以在首页点击齿轮键更改设置。<br /><br />
以上就是全部的基本使用技巧了,开始让wnr改变你吧!<br /><br />
<h2 class="h4">2、其他</h2>
如果有需要更改一些设置,你可以在首页点击齿轮按钮更改设置。<br />
如果想要调出这个帮助手册,你可以在首页点击问号按钮。<br />
如果你还有问题,或者你发现了wnr有bug,请创建一个<a href="https://github.com/RoderickQiu/wnr/issues/">issue</a>或者<a
href="mailto">给我发邮件</a>。谢谢!<br />
</div><br />
Expand Down
3 changes: 2 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
</script>
<main role="main" class="flex-shrink-0 align-content-center">
<div class="container-fluid text-center">
<h1 class="display-4">wnr</h1>
<h1 class="display-4"><span class="work">w</span><span class="text-black-50">n</span><span
class="rest">r</span></h1>
<hr />
<p class="lead">
It's a timer app with strong expansibility for computers.
Expand Down
7 changes: 7 additions & 0 deletions docs/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,11 @@ img{

#howtodoit{
padding: 0 1.5rem;
}

.work{
color: #ea5454;
}
.rest{
color: #5490ea;
}
3 changes: 2 additions & 1 deletion docs/zh.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
</script>
<main role="main" class="flex-shrink-0 align-content-center">
<div class="container-fluid text-center">
<h1 class="display-4">wnr</h1>
<h1 class="display-4"><span class="work">w</span><span class="text-black-50">n</span><span
class="rest">r</span></h1>
<hr />
<div class="lead">
wnr是一款时间管理程序。<br />
Expand Down
35 changes: 18 additions & 17 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,43 +21,39 @@
<script src="renderer.js"></script>
<script src="updater.js"></script>
<script>
if (!store.get('tour') || store.get('tour') == undefined) {
if (!store.get('tour')) {
store.set('tour', 'true');
ipc.send("tourguide");
}
</script>
<script>
function about() {
ipc.send("about");
}
function settings() {
ipc.send("settings");
}
function winhider() {
ipc.send("winhider");
}
function minimizer() {
ipc.send("minimizer");
}
function keydown(e) {
var currKey = 0, e = e || event;
if (e.keyCode == 13) {
window.location.href = "timer.html?title=" + $("#title").val() + "&work-time=" + $("#work-time").val() + "&rest-time=" + $("#rest-time").val() + "&loop=" + $("#loop").val() + "&note=" + $("#note").val();
}
if (e.keyCode == 38 || e.keyCode == 40) {
return false;
}
}
document.onkeydown = keydown;
</script>
<div class="d-flex mx-auto justify-content-center align-items-center text-dark" id="main">
<div id="controller">
<a href="javascript:settings()" class="small rest"><i class="fa fa-cog fa-fw"
&nbsp;&nbsp;
<a href="javascript:call('settings')" class="small rest"><i class="fa fa-cog fa-fw"
id="settings"></i></a>&nbsp;&nbsp;
<a href="javascript:about()" class="small rest"><i class="fa fa-info fa-fw" id="info"></i></a>&nbsp;&nbsp;
<a href="javascript:winhider()" class="small rest" id="win-hider"><i class="fa fa-sort-desc fa-fw"
<a href="javascript:call('tourguide')" class="small rest"><i class="fa fa-question"
id="helper"></i></a>&nbsp;&nbsp;
<a href="javascript:call('about')" class="small rest"><i class="fa fa-info fa-fw"
id="info"></i></a>&nbsp;&nbsp;
<a href="javascript:call('winhider')" class="small rest" id="win-hider"><i class="fa fa-sort-desc fa-fw"
id="winhider"></i></a><span id="no-use-space">&nbsp;&nbsp;</span>
<a href="javascript:minimizer()" class="small rest"><i class="fa fa-minus fa-fw"
<a href="javascript:call('minimizer')" class="small rest"><i class="fa fa-minus fa-fw"
id="minimizer"></i></a>&nbsp;&nbsp;
<a href="javascript:window.close()" class="small rest"><i class="fa fa-times fa-fw" id="exit"></i></a>
<script>
$('#helper').attr('title', i18n.__('helper'));
$('#settings').attr('title', i18n.__('settings'));
$('#info').attr('title', i18n.__('info'));
$('#winhider').attr('title', i18n.__('winhider'));
Expand Down Expand Up @@ -88,6 +84,11 @@
$('#rest-time').attr('placeholder', i18n.__('resttime'));
$('#loop').attr('placeholder', i18n.__('loop'));
$('#note').attr('placeholder', i18n.__('note'));
$('#work-time').attr('title', i18n.__('worktime'));
$('#title').attr('title', i18n.__('title'));
$('#rest-time').attr('title', i18n.__('resttime'));
$('#loop').attr('title', i18n.__('loop'));
$('#note').attr('title', i18n.__('note'));
$("input").mouseenter(function () {
$("#tip").css('opacity', '1');
});
Expand Down
10 changes: 9 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,17 @@
"h": "h ",
"min": "min ",
"s": "s",
"times": "loops",
"welcomer1": "Welcome",
"welcomer2": "When you're in the zone, taking a break is the last thing on your mind. However, you may end up with some serious health issues down the line, and you may not be as productive as you would if you followed a strict work/break schedule. wnr is a simple, Electron-based application that was designed to help you remember when breaks are needed. It allows you to configure work/rest intervals that are then enforced, which will have many positive health effects in the long run. (From Softpedia)",
"welcomer3": "Take a tour",
"welcomer4": "Skip the tour",
"welcomer5": "Open settings first"
"welcomer5": "Open settings first",
"helper": "Guide",
"loadingtip1": "Loading...",
"loadingtip2": "If you cannot see the guide, please click",
"loadingtip3": "this link",
"loadingtip4": "to see the offline guide. (might be out of date)",
"settingstip": "Some tips about wnr settings",
"settingstipmsg": "Welcome to settings! When you change one field, the setting will automatially be set. Some settings needs a restart."
}
10 changes: 9 additions & 1 deletion locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,17 @@
"h": "",
"min": "",
"s": "",
"times": "",
"welcomer1": "欢迎使用wnr",
"welcomer2": "wnr是一款时间管理程序。人们常常遇到这样的情况:一直在聚精会神工作,既觉得做了太久已经很累了,又觉得“把这个做完再休息如何”,便一直没有休息,实质上影响了效率。而wnr就是一款为了解决这个问题而出现的软件。",
"welcomer3": "熟悉一下wnr",
"welcomer4": "直接进入wnr",
"welcomer5": "先调整下设置"
"welcomer5": "先调整下设置",
"helper": "帮助手册",
"loadingtip1": "正在加载……",
"loadingtip2": "如果一直无法加载,请点击",
"loadingtip3": "此链接",
"loadingtip4": "加载本地帮助手册。(本地帮助手册可能已经过时。)",
"settingstip": "你似乎是第一次打开设置",
"settingstipmsg": "很好,你已经迈出了第一步。wnr的设置组件非常强大,可以丰富和方便你的wnr体验。所有设置都会自动生效,部分组件在被设置后会自动重启程序以应用设置,望知悉。"
}
18 changes: 12 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ app.on('ready', () => {

if (store.get("top") == true) win.setAlwaysOnTop(true);

if (store.get('hotkey1') == undefined || !store.get('hotkey1')) store.set('hotkey1', 'W');
if (store.get('hotkey2') == undefined || !store.get('hotkey2')) store.set('hotkey2', 'S');
if (!store.get('hotkey1')) store.set('hotkey1', 'W');
if (!store.get('hotkey2')) store.set('hotkey2', 'S');

globalShortcut.register('CommandOrControl+Shift+Alt+' + store.get('hotkey1'), () => {
win.isVisible() ? win.hide() : win.show();
Expand Down Expand Up @@ -318,19 +318,25 @@ ipcMain.on('settings', function () {
}
settingsWin = null
})
if (!store.get("settings-experience")) {
store.set("settings-experience", true);
dialog.showMessageBox(win, {
title: i18n.__('settingstip'),
type: "info",
message: i18n.__('settingstipmsg'),
silent: true
})
}
})

ipcMain.on('tourguide', function () {
tourWin = new BrowserWindow({ parent: win, modal: true, width: 729, height: 520, resizable: false, frame: false, show: false, center: true, webPreferences: { nodeIntegration: true } });
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', () => {
if (win != null) {
win.reload();
}
tourWin = null
})
})
Expand Down
90 changes: 52 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
"copyright": "© Roderick Qiu",
"productName": "wnr",
"dependencies": {
"ajv": "^6.10.0",
"auto-launch": "^5.0.5",
"cheerio": "^1.0.0-rc.2",
"electron-store": "^2.0.0",
"electron-store": "^3.0.0",
"i18n": "^0.8.3",
"request": "^2.88.0"
},
"devDependencies": {
"electron": "^4.1.0",
"electron": "^4.1.1",
"electron-builder": "^20.39.0"
},
"build": {
Expand Down
3 changes: 3 additions & 0 deletions renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ function isTimerWindow(isTimer) {
if (isTimer) {
ipc.send('timer-win', true);
} else ipc.send('timer-win', false);
}
function call(content) {
ipc.send(content);
}
Loading

0 comments on commit 56f574f

Please sign in to comment.