Skip to content

Commit 87b3cbf

Browse files
committed
possibly fix
1 parent 8691acd commit 87b3cbf

2 files changed

Lines changed: 30 additions & 28 deletions

File tree

floating.html

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,6 @@
180180
$('#floating-bottom-bar').css("background-color", newOnlyRestColor + "19");
181181
}
182182

183-
ipc.removeAllListeners('floating-stop-sync');
184-
ipc.on("floating-stop-sync", function (event, message) {
185-
isWorking = message;
186-
if (isWorking) $("#stopper").html("<i class='iconfont icon-pause' aria-hidden='true'></i>");
187-
else $("#stopper").html("<i class='iconfont icon-play' aria-hidden='true'></i>");
188-
});
189-
190183
if (method !== 3) {
191184
if (store.get('disable-pausing') === true) {
192185
if (!((store.get('disable-pausing-special') === "work" && method !== 1) ||
@@ -209,6 +202,12 @@
209202
}
210203
});
211204

205+
ipc.on("floating-stop-sync", function (event, message) {
206+
isWorking = message;
207+
if (isWorking) $("#stopper").html("<i class='iconfont icon-pause' aria-hidden='true'></i>");
208+
else $("#stopper").html("<i class='iconfont icon-play' aria-hidden='true'></i>");
209+
});
210+
212211
if (process.platform === "darwin") {
213212
$("#floating-recover").css("display", "none");
214213
$("#floating-close").css("display", "none");

timer.html

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ <h3>
867867
}
868868
if ((method === 1 && workTime > 60000) || (method === 2 && restTime > 60000)) moreThanOneMin = 1;
869869
else moreThanOneMin = 0;//if less than 1 min, prevent less than 1min warning
870-
lastRecordedMinutesLeft = -1, lastRecordedHoursLeft = -1, lastRecordedProgress = 0.00;
870+
lastRecordedMinutesLeft = -1, lastRecordedHoursLeft = -1, lastRecordedProgress = 0.00, lastRecordedSecond = -1;
871871
canStop = false;
872872
timingData.set("last-recorded-minutes-left", -1);
873873
timingData.set("last-recorded-hours-left", -1);
@@ -1351,14 +1351,36 @@ <h3>
13511351
minutes = Math.floor((seconds - hours * 3600) / 60);
13521352
remainMinutes = hours * 60 + minutes;
13531353

1354+
if (progress !== lastRecordedProgress) {
1355+
lastRecordedProgress = progress;
1356+
naturalProgress = Math.round(lastRecordedProgress * 100);
1357+
$bottomBar.css("width", naturalProgress + "%");
1358+
ipc.send("progress-bar-set", {
1359+
progress: progress,
1360+
remain: minutes + hours * 60,
1361+
positive: false
1362+
});
1363+
if (hasFloating && !(hours === 0 && minutes === 0)) {
1364+
ipc.send("floating-conversation", {
1365+
topic: "time-left",
1366+
val: seconds / 60,
1367+
percentage: naturalProgress,
1368+
method: method,
1369+
isWorking: isClockWorking,
1370+
isOnlyRest: isOnlyRest
1371+
});
1372+
}
1373+
}
1374+
13541375
if (hours === 0 && minutes === 0 && (lastRecordedSecond !== seconds)) {
13551376
lastRecordedSecond = seconds;
13561377
if (hasFloating) ipc.send("floating-conversation", {
13571378
topic: "time-left",
13581379
val: seconds / 60,
13591380
percentage: naturalProgress,
13601381
method: method,
1361-
isWorking: isClockWorking
1382+
isWorking: isClockWorking,
1383+
isOnlyRest: isOnlyRest
13621384
});
13631385
}
13641386

@@ -1376,25 +1398,6 @@ <h3>
13761398
});
13771399
}
13781400

1379-
if (progress !== lastRecordedProgress) {
1380-
lastRecordedProgress = progress;
1381-
naturalProgress = Math.round(lastRecordedProgress * 100);
1382-
ipc.send("progress-bar-set", {
1383-
progress: progress,
1384-
remain: minutes + hours * 60,
1385-
positive: false
1386-
});
1387-
if (hasFloating) ipc.send("floating-conversation", {
1388-
topic: "time-left",
1389-
val: seconds / 60,
1390-
percentage: naturalProgress,
1391-
method: method,
1392-
isWorking: isClockWorking,
1393-
isOnlyRest: isOnlyRest
1394-
});
1395-
$bottomBar.css("width", naturalProgress + "%");
1396-
}
1397-
13981401
seconds -= hours * 3600 + minutes * 60;
13991402
$nowTiming.text(hours + h + minutes + min + seconds + s);
14001403

0 commit comments

Comments
 (0)