|
459 | 459 |
|
460 | 460 | function backer() { |
461 | 461 | call('floating-destroy'); |
| 462 | + call('exit-fullscreen'); |
462 | 463 | store.set("just-back", true); |
463 | 464 | timingData.set("last-recorded-minutes-left", -1); |
464 | 465 | timingData.set("last-recorded-hours-left", -1); |
@@ -594,9 +595,12 @@ <h3> |
594 | 595 | $("#mistake-button").addClass("disabled").css("pointer-events", "none").css("opacity", "0.5"); |
595 | 596 | } |
596 | 597 |
|
597 | | - // Set initial state for time adjustment dropdown based on preferences |
| 598 | + // Set initial state for time adjustment dropdown based on preferences and focused mode |
598 | 599 | const disableTimeAdjustValue = store.get('disable-time-adjust'); |
599 | | - if (isFeatureDisabled(disableTimeAdjustValue, methodFromStart)) { |
| 600 | + const isFocusedMode = (methodFromStart === 1 && workTimeFocused) || (methodFromStart === 2 && restTimeFocused); |
| 601 | + const isLooseMode = methodFromStart === 3; |
| 602 | + |
| 603 | + if (isFeatureDisabled(disableTimeAdjustValue, methodFromStart) || (isFocusedMode && !isLooseMode)) { |
600 | 604 | $("#time-adjust-dropdown").hide(); |
601 | 605 | } |
602 | 606 |
|
@@ -920,7 +924,10 @@ <h3> |
920 | 924 | } |
921 | 925 |
|
922 | 926 | // Handle time adjustment dropdown visibility for rest mode |
923 | | - if (isFeatureDisabled(store.get('disable-time-adjust'), 2)) { |
| 927 | + const isRestFocusedMode = restTimeFocused; |
| 928 | + const isLooseMode = methodFromStart === 3; |
| 929 | + |
| 930 | + if (isFeatureDisabled(store.get('disable-time-adjust'), 2) || (isRestFocusedMode && !isLooseMode)) { |
924 | 931 | $("#time-adjust-dropdown").hide(); |
925 | 932 | } else { |
926 | 933 | $("#time-adjust-dropdown").show(); |
@@ -988,7 +995,10 @@ <h3> |
988 | 995 | } |
989 | 996 |
|
990 | 997 | // Handle time adjustment dropdown visibility for work mode |
991 | | - if (isFeatureDisabled(store.get('disable-time-adjust'), 1)) { |
| 998 | + const isWorkFocusedMode = workTimeFocused; |
| 999 | + const isLooseMode = methodFromStart === 3; |
| 1000 | + |
| 1001 | + if (isFeatureDisabled(store.get('disable-time-adjust'), 1) || (isWorkFocusedMode && !isLooseMode)) { |
992 | 1002 | $("#time-adjust-dropdown").hide(); |
993 | 1003 | } else { |
994 | 1004 | $("#time-adjust-dropdown").show(); |
@@ -1075,13 +1085,25 @@ <h3> |
1075 | 1085 | // adjust time according to mode |
1076 | 1086 | if (method === 1) { |
1077 | 1087 | // working mode: adjust work time |
1078 | | - |
1079 | | - workTime = Math.max(10000, workTime + ms); |
| 1088 | + workTime = workTime + ms; |
1080 | 1089 | } else { |
1081 | 1090 | // rest mode: adjust rest time |
1082 | | - restTime = Math.max(10000, restTime + ms); |
| 1091 | + restTime = restTime + ms; |
1083 | 1092 | } |
1084 | 1093 | lastRecordedProgress = -1; |
| 1094 | + |
| 1095 | + // Check if timer should end immediately after adjustment |
| 1096 | + if (workTime <= 0 || restTime <= 0) { |
| 1097 | + // End the timer immediately |
| 1098 | + ender(); |
| 1099 | + } else { |
| 1100 | + // Ensure minimum time is 10 seconds if not ending |
| 1101 | + if (method === 1) { |
| 1102 | + workTime = Math.max(10000, workTime); |
| 1103 | + } else { |
| 1104 | + restTime = Math.max(10000, restTime); |
| 1105 | + } |
| 1106 | + } |
1085 | 1107 | } |
1086 | 1108 |
|
1087 | 1109 | function shouldLongBreak() { |
|
0 commit comments