Skip to content

Commit

Permalink
fix unacceptable bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
RoderickQiu committed Mar 16, 2023
1 parent ab83a5e commit a830fa2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
8 changes: 4 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2335,9 +2335,9 @@ ipcMain.on("progress-bar-set", function (event, message) {
win.setOverlayIcon(nativeImage.createFromPath(path.join(__dirname, '\\res\\icons\\overlay\\'
+ (message.remain <= 60 ? message.remain : 61) + '.png')), progress.toString());
if (message.positive)
win.setTitle("wnr | " + i18n.__('min-already') + " " + message.remain + " " + i18n.__('min') + " | " + i18n.__('today-total') + (estimCurrent + todaySum) + ' ' + i18n.__('min'));
win.setTitle("wnr | " + i18n.__('min-already') + " " + message.remain + " " + i18n.__('min') + " | " + i18n.__('today-total') + getStyledTimeForTray(estimCurrent + todaySum));
else
win.setTitle("wnr | " + i18n.__('min-left') + " " + message.remain + " " + i18n.__('min') + " | " + i18n.__('today-total') + (estimCurrent + todaySum) + ' ' + i18n.__('min'));
win.setTitle("wnr | " + i18n.__('min-left') + " " + message.remain + " " + i18n.__('min') + " | " + i18n.__('today-total') + getStyledTimeForTray(estimCurrent + todaySum));
}
}
})
Expand All @@ -2347,9 +2347,9 @@ ipcMain.on("tray-time-set", function (event, message) {
trayH = message.h;
trayMin = message.min;
if (message.positive === false)
trayTimeMsg = (trayH ? (trayH + ' ' + i18n.__('h')) : "") + trayMin + ' ' + i18n.__('min') + '| ' + timeLeftTip + " " + Math.floor(100 - progress * 100) + "% | " + i18n.__('today-total') + (estimCurrent + todaySum) + ' ' + i18n.__('min');
trayTimeMsg = (trayH ? (trayH + ' ' + i18n.__('h')) : "") + trayMin + ' ' + i18n.__('min') + '| ' + timeLeftTip + " " + Math.floor(100 - progress * 100) + "% | " + i18n.__('today-total') + (process.platform === "win32" ? getStyledTimeForTray(estimCurrent + todaySum) : ((estimCurrent + todaySum) + ' ' + i18n.__('min')));
else {
trayTimeMsg = (trayH ? (trayH + ' ' + i18n.__('h')) : "") + trayMin + ' ' + i18n.__('min') + '| ' + positiveTimingTip + " | " + i18n.__('today-total') + (estimCurrent + todaySum) + ' ' + i18n.__('min');
trayTimeMsg = (trayH ? (trayH + ' ' + i18n.__('h')) : "") + trayMin + ' ' + i18n.__('min') + '| ' + positiveTimingTip + " | " + i18n.__('today-total') + (process.platform === "win32" ? getStyledTimeForTray(estimCurrent + todaySum) : ((estimCurrent + todaySum) + ' ' + i18n.__('min')));
}

if (tray != null) tray.setToolTip(trayTimeMsg);
Expand Down
14 changes: 10 additions & 4 deletions timer.html
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ <h3>
$("#time-cnt").css("display", "none");
if (continueLoop || method === 3) {
$("#infinity-label").css("display", "none");
$("#time-cnt-blank").css("display", "none");
if (!continueLoop) $("#time-cnt-blank").css("display", "none");
}
} else {
$("#infinity-label").css("display", "none");
Expand Down Expand Up @@ -586,6 +586,7 @@ <h3>
}

if (store.get("nap") || methodFromStart === 3) {
method = 3;
shouldNap = true;
napInterval = (store.has("nap-time") ? store.get("nap-time") : 10) * 60;
if (isNaN(napInterval)) napInterval = 600;
Expand Down Expand Up @@ -651,13 +652,18 @@ <h3>

stopper();
if (!wasCounting) stopCounter++;
if (stopCounter) $("#stop-count").text(((method === 3 || continueLoop) ? "" : " | ") + i18n.__("already-paused") + " " + stopCounter.toString() + " " + i18n.__("time(s)"));
if (stopCounter) $("#stop-count").text(((methodFromStart === 3 || continueLoop) ? "" : " | ") + i18n.__("already-paused") + " " + stopCounter.toString() + " " + i18n.__("time(s)"));
}

ipc.on("can-redo-exec", function () {
window.clearInterval(int);
startTime = new Date().getTime();
int = setInterval(clock, 250);
if (methodFromStart !== 3)
int = setInterval(clock, 250);
else {
$("#infinity-label").css("display", "none");
int = setInterval(positive, 250);
}
$("#stopper").html("<i class='iconfont icon-pause' aria-hidden='true'></i>");
isClockWorking = 1;//to restart
ipc.send("tray-image-change", "start");
Expand All @@ -670,7 +676,7 @@ <h3>
window.clearInterval(int);
pauseInt = setTimeout(function () {
ipc.send("can-redo-alert");
}, 1000 * 10);
}, 1000 * 60 * 7);
$("#stopper").html("<i class='iconfont icon-play' aria-hidden='true'></i>");
isClockWorking = 0;//to stop
ipc.send("tray-image-change", "stop");
Expand Down

0 comments on commit a830fa2

Please sign in to comment.