Skip to content

Commit ad2055f

Browse files
committed
update for more fine-grained long-break
1 parent 87beff9 commit ad2055f

File tree

5 files changed

+59
-23
lines changed

5 files changed

+59
-23
lines changed

locales/en.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,22 @@
331331
"relaunch-tip": "Will restart wnr to apply the preferences.",
332332
"global-settings": "3. Global Preferences",
333333
"full-screen-focus-mode-tip": "Try this ultimate, strongest focus mode that prevents you from quitting.",
334+
"long-break-settings": "Long break settings",
335+
"long-break-settings-tip": "Customise your long break experience here.",
336+
"long-break-threshold": "Start long break from...",
337+
"long-break-threshold-tip": "When the number of loops reaches this threshold, a long break will be triggered.",
338+
"dropdown-2-loops": "2 loops",
339+
"dropdown-3-loops": "3 loops",
340+
"dropdown-4-loops": "4 loops",
334341
"long-break": "Long break",
335-
"long-break-tip": "Make the last rest period of a timing schedule longer to have a more comfortable long break. When loop < 3, you will not have a long break.",
342+
"long-break-tip": "Make the last rest period of a timing schedule longer to have a more comfortable long break.",
343+
"dropdown-plus1min": "+1 min",
344+
"dropdown-plus2min": "+2 min",
336345
"dropdown-plus3min": "+3 min",
337346
"dropdown-plus5min": "+5 min",
338347
"dropdown-plus7min": "+7 min",
339348
"dropdown-plus10min": "+10 min",
340349
"dropdown-plus15min": "+15 min",
341-
"dropdown-plus20min": "+20 min",
342350
"should-nap-now": "Rest for a few seconds now!",
343351
"should-nap-now-msg": "Then keep on working!",
344352
"zoom-ratio": "Zoom ratio",
@@ -394,7 +402,6 @@
394402
"dropdown-every3": "Every 3",
395403
"dropdown-every4": "Every 4",
396404
"dropdown-every5": "Every 5",
397-
"dropdown-every6": "Every 6",
398405
"theme-color": "Custom theme colors",
399406
"theme-color-work": "Working (default red): ",
400407
"theme-color-rest": "Resting (default blue): ",

locales/zh-CN.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@
323323
"fullscreen-experience-tip": "你可能是第一次使用全屏专心模式。(如果你不需要强力体验,可以在设置中开启宽松全屏模式。)",
324324
"fullscreen-too-long-tip": "这次你似乎将开启一段很长的专心时间。",
325325
"fullscreen-experience-tip-mistake": "误点?这次你可以撤销",
326-
327326
"quit-from-timer-in-lock-mode-msg": "锁定模式下退出需输入密码",
328327
"focus-mode": "专心模式进行中",
329328
"has-multi-displays": "为确保服务正常运行,请不要在专心模式运行时插、拔显示器。",
@@ -333,14 +332,22 @@
333332
"manually-check-for-update": "手动检测更新",
334333
"manually-check-for-update-tip-1": "(现在你正在使用",
335334
"manually-check-for-update-tip-2": "",
335+
"long-break-settings": "长休息设置",
336+
"long-break-settings-tip": "在此自定义您的长休息体验。",
337+
"long-break-threshold": "长休息触发门槛...",
338+
"long-break-threshold-tip": "当循环次数达到此设定值时,将触发长休息。",
339+
"dropdown-2-loops": "2 次循环",
340+
"dropdown-3-loops": "3 次循环",
341+
"dropdown-4-loops": "4 次循环",
336342
"long-break": "长休息",
337-
"long-break-tip": "在每次时间计划的最后一个休息加上一段时间的补时,使之成为一个长休息(循环次数少于3次或无限模式时不会进行长休息)。",
343+
"long-break-tip": "在每次时间计划的最后一个休息加上一段时间的补时,使之成为一个长休息。",
344+
"dropdown-plus1min": "+1 分钟",
345+
"dropdown-plus2min": "+2 分钟",
338346
"dropdown-plus3min": "+3 分钟",
339347
"dropdown-plus5min": "+5 分钟",
340348
"dropdown-plus7min": "+7 分钟",
341349
"dropdown-plus10min": "+10 分钟",
342350
"dropdown-plus15min": "+15 分钟",
343-
"dropdown-plus20min": "+20 分钟",
344351
"should-nap-now": "现在小憩几秒钟吧!",
345352
"should-nap-now-msg": "然后再继续努力工作!",
346353
"zoom-ratio": "缩放比例",
@@ -396,7 +403,6 @@
396403
"dropdown-every3": "每三次",
397404
"dropdown-every4": "每四次",
398405
"dropdown-every5": "每五次",
399-
"dropdown-every6": "每六次",
400406
"theme-color": "自定义主题颜色",
401407
"theme-color-work": "工作(默认红色):",
402408
"theme-color-rest": "休息(默认蓝色):",
@@ -417,5 +423,6 @@
417423
"can-redo-msg": "是否需要对当前段时间进行重新计时?",
418424
"custom": "自定义",
419425
"custom-notify-sound": "自定义提示音",
420-
"input-url": "输入路径"
426+
"input-url": "输入路径",
427+
"long-break-threshold-tip": "long-break-threshold-tip-[zh-CN]"
421428
}

locales/zh-TW.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,14 +324,22 @@
324324
"manually-check-for-update": "手動檢測更新",
325325
"manually-check-for-update-tip-1": "(現在你正在使用",
326326
"manually-check-for-update-tip-2": "",
327+
"long-break-settings": "長休息設定",
328+
"long-break-settings-tip": "在此自定義您的長休息體驗。",
329+
"long-break-threshold": "長休息觸發門檻...",
330+
"long-break-threshold-tip": "當循環次數達到此設定值時,將觸發長休息。",
331+
"dropdown-2-loops": "2 次循環",
332+
"dropdown-3-loops": "3 次循環",
333+
"dropdown-4-loops": "4 次循環",
327334
"long-break": "長休息",
328-
"long-break-tip": "在每次時間計劃的最後一個休息加上一段時間的補時,使之成爲一個長休息(循環次數少於3次或無限模式時不會進行長休息)。",
335+
"long-break-tip": "在每次時間計劃的最後一個休息加上一段時間的補時,使之成爲一個長休息。",
336+
"dropdown-plus1min": "+1 分鐘",
337+
"dropdown-plus2min": "+2 分鐘",
329338
"dropdown-plus3min": "+3 分鐘",
330339
"dropdown-plus5min": "+5 分鐘",
331340
"dropdown-plus7min": "+7 分鐘",
332341
"dropdown-plus10min": "+10 分鐘",
333342
"dropdown-plus15min": "+15 分鐘",
334-
"dropdown-plus20min": "+20 分鐘",
335343
"should-nap-now": "現在小憩幾秒鐘吧!",
336344
"should-nap-now-msg": "然後再繼續努力工作!",
337345
"zoom-ratio": "縮放比例",
@@ -389,7 +397,6 @@
389397
"dropdown-every3": "每三次",
390398
"dropdown-every4": "每四次",
391399
"dropdown-every5": "每五次",
392-
"dropdown-every6": "每六次",
393400
"theme-color": "自定義主題顏色",
394401
"theme-color-work": "工作(默認紅色):",
395402
"theme-color-rest": "休息(默認藍色):",

preferences-items.js

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,29 @@ if (store.get("islocked") !== true) {
9090
choices: ['never', '5%', '7%', '10%', '15%', '20%', '25%', '30%'],
9191
def: 0
9292
}, {
93-
type: "dropdown",
94-
id: "long-break",
95-
choices: ['never', 'plus3min', 'plus5min', 'plus7min', 'plus10min', 'plus15min', 'plus20min'],
96-
def: 0
97-
}, {
98-
type: "dropdown",
99-
id: "long-break-mode-alter",
100-
choices: ['last', 'every2', 'every3', 'every4', 'every5', 'every6'],
101-
def: 0
93+
type: "collapse",
94+
id: "long-break-settings",
95+
inner: [
96+
{
97+
type: "title",
98+
id: "long-break-settings-tip"
99+
}, {
100+
type: "dropdown",
101+
id: "long-break",
102+
choices: ['never', 'plus1min', 'plus2min', 'plus3min', 'plus5min', 'plus7min', 'plus10min', 'plus15min'],
103+
def: 0
104+
}, {
105+
type: "dropdown",
106+
id: "long-break-threshold",
107+
choices: ['2-loops', '3-loops', '4-loops'],
108+
def: 1
109+
}, {
110+
type: "dropdown",
111+
id: "long-break-mode-alter",
112+
choices: ['last', 'every2', 'every3', 'every4', 'every5'],
113+
def: 0
114+
}
115+
]
102116
}, {
103117
type: "selection",
104118
id: "timing-after-locked",

timer.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ <h3>
533533

534534
function longBreakGetter() {
535535
if (store.has("long-break")) {
536-
let choices = [0, 3, 5, 7, 10, 15, 20];
536+
let choices = [0, 1, 2, 3, 5, 7, 10, 15];
537537
return choices[store.get("long-break")];
538538
} else return 0;
539539
}
@@ -578,13 +578,14 @@ <h3>
578578
isOnlyRest = isFirstTimeOnlyRest,
579579
firstTimeDiscount = isNaN(decodeURI($_GET['discount'])) ? 0 : decodeURI($_GET['discount']) * 60000,
580580
longBreakFrequence = -1,
581+
longBreakLoopThreshold = (store.has("long-break-threshold") ? store.get("long-break-threshold") : 1) + 2,
581582
sessionId = Date.now().toString() + Math.random().toString(36).substr(2, 9),
582583
recordedRecaps = new Set();
583584

584585
if (isOnlyRest) ipc.send("enter-only-rest");
585586

586587
if (store.has("long-break-mode-alter")) {
587-
let frequenceList = [-1, 2, 3, 4, 5, 6];
588+
let frequenceList = [-1, 2, 3, 4, 5];
588589
longBreakFrequence = frequenceList[store.get("long-break-mode-alter")];
589590
}
590591

@@ -1215,7 +1216,7 @@ <h3>
12151216
}
12161217

12171218
function shouldLongBreak() {
1218-
if (longBreakFrequence === -1) return times === loop * 2 - 1 && loop > 2;
1219+
if (longBreakFrequence === -1) return times === loop * 2 - 1 && loop >= longBreakLoopThreshold;
12191220
else return ((times + 1) % (longBreakFrequence * 2)) === 0; // new long break optimization
12201221
}
12211222

0 commit comments

Comments
 (0)