Skip to content

Commit

Permalink
now actually usable
Browse files Browse the repository at this point in the history
  • Loading branch information
RoderickQiu committed Jan 22, 2019
1 parent 5de96f4 commit 8844b99
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 186 deletions.
12 changes: 6 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
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();
window.location.href = "timer.html?title=" + $("#title").val() + "&work-time=" + $("#work-time").val() + "&rest-time=" + $("#rest-time").val() + "&loop=" + $("#loop").val();
}
}
document.onkeydown = keydown;
Expand All @@ -30,12 +30,12 @@
<div id="set" class="justify-content-center">
<form action="timer.html" method="GET">
<input name="title" id="title" placeholder="please enter a title" type="text" class="small" /><br /><br />
<input name="work-time" id="work-time" placeholder="work for" type="text" class="work lead" style="ime-mode:Disabled"
autofocus required /><br /><br />
<input name="rest-time" id="rest-time" placeholder="then rest for" type="text" class="rest lead" style="ime-mode:Disabled"
required /><br /><br />
<input name="work-time" id="work-time" placeholder="work for (minutes)" type="number" onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
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 (/[\d]/.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 (/[\d]/.test(String.fromCharCode(event.keyCode)))"
style="ime-mode:Disabled" class="small" /><br /><!-- control that only numbers are OK -->
style="ime-mode:Disabled" class="small" required /><br /><!-- control that only numbers are OK -->
</form>

</div>
Expand Down
15 changes: 12 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
const { app, BrowserWindow, ipcMain, Tray, Menu, globalShortcut } = require('electron')
const Store = require('electron-store');
const store = new Store();//设置数据读取

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let win
let tray = null

app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required');// 允许自动播放音频

function createWindow() {
// 创建浏览器窗口。
win = new BrowserWindow({ width: 324, height: 233, frame: false, resizable: true, show: false, hasShadow: true, webPreferences: { nodeIntegration: true } })
Expand Down Expand Up @@ -64,4 +63,14 @@ app.on('activate', () => {
if (win === null) {
createWindow()
}
})

ipcMain.on('warninggiver', function () {
if (win != null) {
win.show();
win.moveTop();// 强制移到最顶层
win.center();
win.once('focus', () => win.flashFrame(false));
win.flashFrame(true);// 在Windows平台上闪烁任务栏按钮
}
})
Loading

0 comments on commit 8844b99

Please sign in to comment.