Skip to content

Commit

Permalink
optimized
Browse files Browse the repository at this point in the history
  • Loading branch information
RoderickQiu committed Feb 3, 2019
1 parent 6cf4502 commit c5439f8
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 27 deletions.
11 changes: 6 additions & 5 deletions about.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@
class="fa fa-exclamation-circle" title="Issues"></i></a>
</p>
<hr />
<p class="small">
<i class="fa fa-copyright" aria-hidden="true"></i> 2019
<a href="javascript:require('electron').shell.openExternal('https://roderickqiu.scris.top/')" class="rest">Roderick
Qiu</a>.
</p>
<span class="small text-muted">
&copy; 2019<a href="javascript:require('electron').shell.openExternal('https://roderickqiu.scris.top/')"
class="rest">&nbsp;Roderick Qiu</a>.
</span><br />
<p class="extreme-small">If you have problems or you want to</p>
<p class="extreme-small"> some suggestion, just tell me!</p>
</div>
</div>
</body>
Expand Down
Binary file modified docs/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions docs/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ <h2 class="h4">1. How to use it</h2>
When the time ends, a warning is given. <br />
<img src="https://raw.githubusercontent.com/RoderickQiu/wnr/master/res/preview/preview-4.png" class="img-fluid" /><br />
And another period of time starts. <br />
(You can have a rest time with wnr <b>full-screen</b> to prevent you from using you computer, too.) <br />
<img src="https://raw.githubusercontent.com/RoderickQiu/wnr/master/res/preview/preview-5.png" class="img-fluid" /><br />
Now, you've learnt to use wnr! Congratulations! <br /><br />
<h2 class="h4">2. Other things</h2>
Expand Down
11 changes: 6 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
<div id="controller">
<a href="javascript:settings()" class="small rest"><i class="fa fa-cog fa-fw" title="Settings"></i></a>&nbsp;
<a href="javascript:about()" class="small rest"><i class="fa fa-info fa-fw" title="About wnr"></i></a>&nbsp;
<a href="javascript:winhider()" class="small rest" id="win-hider"><i class="fa fa-sort-desc fa-fw" title="Hide the window to system tray"></i></a><span id="no-use-space">&nbsp;</span>
<a href="javascript:winhider()" class="small rest" id="win-hider"><i class="fa fa-sort-desc fa-fw" title="Hide the window to system tray"></i></a><span
id="no-use-space">&nbsp;</span>
<a href="javascript:minimizer()" class="small rest"><i class="fa fa-minus fa-fw" title="Minimize to taskbar"></i></a>&nbsp;
<a href="javascript:window.close()" class="small rest"><i class="fa fa-times fa-fw" title="Exit"></i></a>
</div>
Expand All @@ -53,7 +54,7 @@
style="ime-mode:Disabled" class="work lead" autofocus required /><br /><br />
<input name="rest-time" id="rest-time" placeholder="then rest for (minutes)" type="number" onkeypress="return (/[0-9]/.test(String.fromCharCode(event.keyCode)))"
style="ime-mode:Disabled" class="rest lead" required /><br /><br />
<input name="loop" id="loop" placeholder="loop for how many times" type="number" onkeypress="return (/[0-9]/.test(String.fromCharCode(event.keyCode)))"
<input name="loop" id="loop" placeholder="loop for (times)" type="number" onkeypress="return (/[0-9]/.test(String.fromCharCode(event.keyCode)))"
style="ime-mode:Disabled" class="small" required /><br /><!-- control that only numbers are OK -->
</form>
</div>
Expand All @@ -63,9 +64,9 @@
$("#work-time").val(store.get("worktime"));
$("#rest-time").val(store.get("resttime"));
$("#loop").val(store.get("looptime"));
if(process.platform == "darwin") {
$("#win-hider").css("display","none");
$("#no-use-space").css("display","none");
if (process.platform == "darwin") {
$("#win-hider").css("display", "none");
$("#no-use-space").css("display", "none");
}
</script>
</body>
Expand Down
34 changes: 28 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,40 @@ app.on('ready', () => {
})

if (process.platform == "win32") tray = new Tray(path.join(__dirname, '\\res\\icons\\iconWin.ico'));
else if(process.platform != "darwin") tray = new Tray(path.join(__dirname, '\\res\\icons\\wnrIcon.png'));
else if (process.platform != "darwin") tray = new Tray(path.join(__dirname, '\\res\\icons\\wnrIcon.png'));
const contextMenu = Menu.buildFromTemplate([
{
label: 'Show/Hide', click: () => {
label: 'wnr v' + require("./package.json").version
}, {
type: 'separator'
}, {
label: 'Website',
click: function () {
shell.openExternal('https://wnr.scris.top/');
}
}, {
label: 'Help Page',
click: function () {
shell.openExternal('https://wnr.scris.top/help.html');
}
}, {
label: 'Github',
click: function () {
shell.openExternal('https://github.com/RoderickQiu/wnr/');
}
}, {
type: 'separator'
}, {
label: 'Show / Hide', click: () => {
win.isVisible() ? win.hide() : win.show();
if (settingsWin != null) settingsWin.isVisible() ? settingsWin.hide() : settingsWin.show();
if (aboutWin != null) aboutWin.isVisible() ? aboutWin.hide() : aboutWin.show();
}
},
{ label: 'Exit', click: () => { app.quit() } }
}, {
label: 'Exit', click: () => { app.quit() }
}
]);
if(tray != null) {
if (tray != null) {
tray.setToolTip('wnr');
tray.setContextMenu(contextMenu);
tray.on('click', () => {
Expand Down Expand Up @@ -218,7 +240,7 @@ ipcMain.on('minimizer', function () {
})

ipcMain.on('about', function () {
aboutWin = new BrowserWindow({ parent: win, modal: true, width: 233, height: 216, resizable: false, frame: false, show: false, center: true, webPreferences: { nodeIntegration: true } });
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 || store.get("top") == undefined) aboutWin.setAlwaysOnTop(true);
aboutWin.once('ready-to-show', () => {
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"request": "^2.88.0"
},
"devDependencies": {
"electron": "^4.0.2",
"electron": "^4.0.4",
"electron-builder": "^20.38.5"
},
"build": {
Expand Down
Binary file modified res/icons/iconMac.psd
Binary file not shown.
Binary file modified res/icons/iconWin.ico
Binary file not shown.
Binary file modified res/icons/wnrIcon.png
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 res/icons/wnrIcon.psd
Binary file not shown.
4 changes: 2 additions & 2 deletions settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<li>
<a href="javascript:updatechecker(2)" class="rest"><span id="manually">Manually check for update</span></a>&nbsp;<b>(Now
<script>document.write("v" + require("./package.json").version)</script>)</b>
</li>
</li>
<li id="hotkey-tip">
Open/Hide hotkey:
<b>
Expand All @@ -103,7 +103,7 @@
</div>
<script>
if (process.platform == 'darwin') {
$("#hotkey-tip").css("display","none");
$("#hotkey-tip").css("display", "none");
}
</script>
<script src="updater.js"></script>
Expand Down
6 changes: 6 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ input:focus::-webkit-input-placeholder, input:hover::-webkit-input-placeholder {
.rest:focus::-webkit-input-placeholder, .rest:hover::-webkit-input-placeholder{
color: #5490eac2;
}
.extreme-small{
font-size: xx-small;
line-break: loose;
line-height: 100%;
margin: 5px;
}

#main{
-webkit-app-region: no-drag;/* let it clickable */
Expand Down
9 changes: 5 additions & 4 deletions timer.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
<div class="d-flex mx-auto justify-content-center align-items-center text-dark" id="main">
<div id="controller">
<a href="index.html" class="small work"><i class="fa fa-chevron-left fa-fw" title="Give up the timer & Back"></i></a>&nbsp;
<a href="javascript:winhider()" class="small work" id="win-hider"><i class="fa fa-sort-desc fa-fw" title="Hide the window to system tray"></i></a><span id="no-use-space">&nbsp;</span>
<a href="javascript:winhider()" class="small work" id="win-hider"><i class="fa fa-sort-desc fa-fw" title="Hide the window to system tray"></i></a><span
id="no-use-space">&nbsp;</span>
<a href="javascript:minimizer()" class="small work"><i class="fa fa-minus fa-fw" title="Minimize to taskbar"></i></a>&nbsp;
<a href="javascript:window.close()" class="small work"><i class="fa fa-times fa-fw" title="Exit"></i></a>
</div>
Expand All @@ -31,9 +32,9 @@
</div>
</div><!-- for things with 'work' mark, when it's resting, the color should be changed -->
<script>
if(process.platform == "darwin") {
$("#win-hider").css("display","none");
$("#no-use-space").css("display","none");
if (process.platform == "darwin") {
$("#win-hider").css("display", "none");
$("#no-use-space").css("display", "none");
}
var ipc = require('electron').ipcRenderer;
const Store = require('electron-store');
Expand Down

0 comments on commit c5439f8

Please sign in to comment.