Skip to content

Commit

Permalink
bugs fixed & optimized
Browse files Browse the repository at this point in the history
- Using try-catches to prevent EPERM errors
- Optimized for focus mode.
- No longer counting time when hibernated.
  • Loading branch information
RoderickQiu committed Mar 2, 2020
1 parent 81eeaa6 commit 1e57d62
Show file tree
Hide file tree
Showing 8 changed files with 276 additions and 156 deletions.
4 changes: 3 additions & 1 deletion about.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
</script>
</div>
<div id="about" class="justify-content-center text-center">
<p class="lead rest font-weight-bolder">wnr</p>
<p class="lead font-weight-bolder">
<span class="work">w</span><span class="text-muted">n</span><span class="rest">r</span>
</p>
<p class="small text-muted">
<script>document.write(i18n.__('version') + require("./package.json").version);</script>
</p>
Expand Down
60 changes: 34 additions & 26 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@
<script src="updater.js"></script><!-- check for updates -->
<script src="querier.js"></script><!-- query push messages -->
<script>
if (!store.get('tour')) {
store.set('tour', 'true');
store.set('islocked', false);
ipc.send("tourguide");
try {
if (!store.get('tour')) {
store.set('tour', 'true');
store.set('islocked', false);
ipc.send("tourguide");
}
} catch (e) {
console.log(e);
}
const shi = require("node-shi");
</script>
Expand Down Expand Up @@ -252,29 +256,33 @@
});

setTimeout(function () {
if ((store.get("last-recorded-hours-left") && store.get("last-recorded-hours-left") != -1) ||
(store.get("last-recorded-minutes-left") && store.get("last-recorded-minutes-left") != -1)) {
store.set("fullscreen-work", store.get("last-recorded-state").isWorkTimeFocused);
store.set("fullscreen", store.get("last-recorded-state").isRestTimeFocused);
if (store.get('last-recorded-hours-left') == 0 && store.get("last-recorded-minutes-left") < 2)
store.set("last-recorded-minutes-left", 2);
if (store.get("last-recorded-state").method == 1) {
window.location.href =
"timer.html?title=" + store.get("last-recorded-state").title
+ "&work-time=" + store.get("last-recorded-hours-left") * 60 + store.get("last-recorded-minutes-left")
+ "&rest-time=" + store.get("last-recorded-state").restTime
+ "&loop=" + 1
+ "&note=" + store.get("last-recorded-state").note
+ "&method=1";
} else {
window.location.href =
"timer.html?title=" + store.get("last-recorded-state").title
+ "&work-time=" + store.get("last-recorded-hours-left") * 60 + store.get("last-recorded-minutes-left")
+ "&rest-time=" + store.get("last-recorded-hours-left") * 60 + store.get("last-recorded-minutes-left")
+ "&loop=" + 1
+ "&note=" + store.get("last-recorded-state").note
+ "&method=2";
try {
if ((store.get("last-recorded-hours-left") && store.get("last-recorded-hours-left") != -1) ||
(store.get("last-recorded-minutes-left") && store.get("last-recorded-minutes-left") != -1)) {
store.set("fullscreen-work", store.get("last-recorded-state").isWorkTimeFocused);
store.set("fullscreen", store.get("last-recorded-state").isRestTimeFocused);
if (store.get('last-recorded-hours-left') == 0 && store.get("last-recorded-minutes-left") < 2)
store.set("last-recorded-minutes-left", 2);
if (store.get("last-recorded-state").method == 1) {
window.location.href =
"timer.html?title=" + store.get("last-recorded-state").title
+ "&work-time=" + store.get("last-recorded-hours-left") * 60 + store.get("last-recorded-minutes-left")
+ "&rest-time=" + store.get("last-recorded-state").restTime
+ "&loop=" + 1
+ "&note=" + store.get("last-recorded-state").note
+ "&method=1";
} else {
window.location.href =
"timer.html?title=" + store.get("last-recorded-state").title
+ "&work-time=" + store.get("last-recorded-hours-left") * 60 + store.get("last-recorded-minutes-left")
+ "&rest-time=" + store.get("last-recorded-hours-left") * 60 + store.get("last-recorded-minutes-left")
+ "&loop=" + 1
+ "&note=" + store.get("last-recorded-state").note
+ "&method=2";
}
}
} catch (e) {
console.log(e);
}
}, 500);
</script>
Expand Down
2 changes: 1 addition & 1 deletion locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,5 @@
"settings-import-tip": "粘贴口令进文本框然后按下Enter键,导入设置项。",
"settings-import-error": "口令无效,请重试。",
"menu": "菜单列表",
"prevent-stop": "目前处于锁定模式,不能退出"
"prevent-stop": "目前处于锁定模式或者正在执行专心任务,不能退出"
}
2 changes: 1 addition & 1 deletion locales/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,5 @@
"settings-import-tip": "粘貼口令進文本框然後按下Enter鍵,導入設置項。",
"settings-import-error": "口令無效,請重試。",
"menu": "菜單列表",
"prevent-stop": "目前處於鎖定模式,不能退出"
"prevent-stop": "目前處於鎖定糢式或者正在執行專心任務,不能退出"
}
Loading

0 comments on commit 1e57d62

Please sign in to comment.