Skip to content

Commit

Permalink
optimized
Browse files Browse the repository at this point in the history
- updated to electron-store v6 to make trycatches useless.
- optimized with alarming sounds, etc.
- bugs fixed.
  • Loading branch information
RoderickQiu committed Jul 18, 2020
1 parent 07900ee commit 65e75e8
Show file tree
Hide file tree
Showing 12 changed files with 374 additions and 397 deletions.
72 changes: 35 additions & 37 deletions index.html
Expand Up @@ -39,14 +39,10 @@
<script src="supporter.js"></script><!-- support wnr running -->
<script src="updater.js"></script><!-- check for updates -->
<script>
try {
if (!store.get('tour')) {
store.set('tour', 'true');
store.set('islocked', false);
ipc.send("tourguide");
}
} catch (e) {
console.log(e);
if (!store.get('tour')) {
store.set('tour', 'true');
store.set('islocked', false);
ipc.send("tourguide");
}

const shi = require("node-shi");
Expand Down Expand Up @@ -86,6 +82,8 @@
<script>document.write(i18n.__('menu'));</script>
</div>
<div class="dropdown-divider"></div>
<a href="javascript:statistics()" class="small dropdown-item">
<script>document.write(i18n.__('statistics'));</script></a>
<a href="javascript:call('locker')" class="small dropdown-item">
<script>document.write(i18n.__('locker-settings'));</script></a>
<a href="javascript:call('settings')" class="small dropdown-item should-lock">
Expand Down Expand Up @@ -228,6 +226,10 @@
$("#no-use-space").css("display", "none");
}

function statistics() {
window.location.href = "statistics.html";
}

var timeCount, myDate, h, min, defaultArray;
function sumGet(workTimeGet, restTimeGet, loopGet) {
timeCount = Math.floor((Number(workTimeGet) + Number(restTimeGet)) * Number(loopGet));
Expand Down Expand Up @@ -329,36 +331,32 @@

setTimeout(function () {
focusNotifier();
try {
if ((timingData.get("last-recorded-hours-left") > 0 || timingData.get("last-recorded-minutes-left") > 0)) {
if (store.get('last-recorded-hours-left') <= 0 && timingData.get("last-recorded-minutes-left") < 2)
timingData.set("last-recorded-minutes-left", 2);
if (timingData.get("last-recorded-state").method == 1) {
window.location.href =
"timer.html?title=" + timingData.get("last-recorded-state").title
+ "&work-time=" + Number(timingData.get("last-recorded-hours-left") * 60 + timingData.get("last-recorded-minutes-left"))
+ "&rest-time=" + timingData.get("last-recorded-state").restTime
+ "&loop=" + (store.get("infinity") ? 0 : 1)
+ "&note=" + timingData.get("last-recorded-state").note
+ "&method=1"
+ "&work-time-focused=" + timingData.get("last-recorded-state").isWorkTimeFocused
+ "&rest-time-focused=" + timingData.get("last-recorded-state").isRestTimeFocused
+ "&restored=true";
} else {
window.location.href =
"timer.html?title=" + timingData.get("last-recorded-state").title
+ "&work-time=" + Number(timingData.get("last-recorded-hours-left") * 60 + timingData.get("last-recorded-minutes-left"))
+ "&rest-time=" + Number(timingData.get("last-recorded-hours-left") * 60 + timingData.get("last-recorded-minutes-left"))
+ "&loop=" + (store.get("infinity") ? 0 : 1)
+ "&note=" + timingData.get("last-recorded-state").note
+ "&method=2"
+ "&work-time-focused=" + timingData.get("last-recorded-state").isWorkTimeFocused
+ "&rest-time-focused=" + timingData.get("last-recorded-state").isRestTimeFocused
+ "&restored=true";
}
if ((timingData.get("last-recorded-hours-left") > 0 || timingData.get("last-recorded-minutes-left") > 0)) {
if (timingData.get('last-recorded-hours-left') <= 0 && timingData.get("last-recorded-minutes-left") < 2)
timingData.set("last-recorded-minutes-left", 2);
if (timingData.get("last-recorded-state").method == 1) {
window.location.href =
"timer.html?title=" + timingData.get("last-recorded-state").title
+ "&work-time=" + Number(timingData.get("last-recorded-hours-left") * 60 + timingData.get("last-recorded-minutes-left"))
+ "&rest-time=" + timingData.get("last-recorded-state").restTime
+ "&loop=" + (store.get("infinity") ? 0 : 1)
+ "&note=" + timingData.get("last-recorded-state").note
+ "&method=1"
+ "&work-time-focused=" + timingData.get("last-recorded-state").isWorkTimeFocused
+ "&rest-time-focused=" + timingData.get("last-recorded-state").isRestTimeFocused
+ "&restored=true";
} else {
window.location.href =
"timer.html?title=" + timingData.get("last-recorded-state").title
+ "&work-time=" + Number(timingData.get("last-recorded-hours-left") * 60 + timingData.get("last-recorded-minutes-left"))
+ "&rest-time=" + Number(timingData.get("last-recorded-hours-left") * 60 + timingData.get("last-recorded-minutes-left"))
+ "&loop=" + (store.get("infinity") ? 0 : 1)
+ "&note=" + timingData.get("last-recorded-state").note
+ "&method=2"
+ "&work-time-focused=" + timingData.get("last-recorded-state").isWorkTimeFocused
+ "&rest-time-focused=" + timingData.get("last-recorded-state").isRestTimeFocused
+ "&restored=true";
}
} catch (e) {
console.log(e);
}
}, 500);
</script>
Expand Down
3 changes: 2 additions & 1 deletion locales/en.json
Expand Up @@ -253,5 +253,6 @@
"focus-notify-body": "focus mode will be on",
"recover": "Exit the mini mode",
"mini-mode": "Mini mode",
"min-left": "min left"
"min-left": "min left",
"statistics": "Statistics"
}
3 changes: 2 additions & 1 deletion locales/zh-CN.json
Expand Up @@ -253,5 +253,6 @@
"focus-notify-body": "时开启全屏专心模式,到时将无法退出",
"recover": "退出MINI模式",
"mini-mode": "MINI模式",
"min-left": "分钟剩余"
"min-left": "分钟剩余",
"statistics": "使用统计"
}
3 changes: 2 additions & 1 deletion locales/zh-TW.json
Expand Up @@ -253,5 +253,6 @@
"focus-notify-body": "時開啓全屏專心模式,到時將無法退出",
"recover": "退出MINI模式",
"mini-mode": "MINI模式",
"min-left": "分鍾剩余"
"min-left": "分鍾剩余",
"statistics": "使用統計"
}

0 comments on commit 65e75e8

Please sign in to comment.