Skip to content

Commit 306a360

Browse files
committed
fix several issues
fix: #140, #141, #143
1 parent 985936e commit 306a360

9 files changed

Lines changed: 98 additions & 13 deletions

File tree

floating.html

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@
7373
$("#floating-unhover").css("opacity", "1");
7474
}
7575

76+
function semihover() {
77+
hover();
78+
}
79+
7680
let isWorking = true;
7781

7882
function stopper() {
@@ -142,14 +146,19 @@
142146
if (message.method === 2 && method === 1) {
143147
$(".work").addClass("rest");
144148
$(".work").removeClass("work");
145-
$('#floating-bottom-bar').css("background-color", "#5490ea19");
149+
if (message.isOnlyRest) {
150+
$(".rest").addClass("onlyRest");
151+
$('#floating-bottom-bar').css("background-color", newOnlyRestColor + "19");
152+
} else {
153+
$('#floating-bottom-bar').css("background-color", newRestColor + "19");
154+
}
146155
method = 2;
147156
}
148157

149158
if (message.method === 1 && method === 2) {
150159
$(".rest").addClass("work");
151160
$(".rest").removeClass("rest");
152-
$('#floating-bottom-bar').css("background-color", "#ea545419");
161+
$('#floating-bottom-bar').css("background-color", newWorkColor + "19");
153162
method = 1;
154163
}
155164

@@ -160,6 +169,11 @@
160169
method = 3;
161170
}
162171

172+
if (message.isOnlyRest && method === 2) {
173+
$(".rest").addClass("onlyRest");
174+
$('#floating-bottom-bar').css("background-color", newOnlyRestColor + "19");
175+
}
176+
163177
ipc.removeAllListeners('floating-stop-sync');
164178
ipc.on("floating-stop-sync", function (event, message) {
165179
isWorking = message;

index.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,14 @@ <h6 id="new-feature-title" class="rest"></h6>
373373
$("#statistics-back").show();
374374
$("#logo-bar").hide();
375375
onlyrest = true;
376+
let countdownTime = store.has("simple-countdown-time") ? store.get("simple-countdown-time") : 2;
377+
let countdownFocus = store.has("simple-countdown-focus") ? store.get("simple-countdown-focus") : false;
378+
$("#rest-time-onlyrest").val(shi.ArabicNumberTimeParser(countdownTime, {
379+
as: 'm',
380+
lang: store.get("i18n").replace(/-/g, '_'),
381+
ignoreError: true
382+
}));
383+
document.getElementById("focus-rest-set-onlyrest").checked = countdownFocus;
376384
allSet();
377385
$("#rest-time-onlyrest").focus();
378386
$(".work").addClass("onlyRest");//onlyRest mode now has specific color
@@ -571,12 +579,6 @@ <h6 id="new-feature-title" class="rest"></h6>
571579
document.getElementById("focus-work-set").checked = focusWhenWorking;
572580
document.getElementById("focus-rest-set").checked = focusWhenResting;
573581

574-
$("#rest-time-onlyrest").val(shi.ArabicNumberTimeParser(restTime, {
575-
as: 'm',
576-
lang: store.get("i18n").replace(/-/g, '_'),
577-
ignoreError: true
578-
}));
579-
document.getElementById("focus-rest-set-onlyrest").checked = focusWhenResting;
580582

581583
allSet();
582584
}

locales/en.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,10 @@
394394
"theme-color-positive": "Stopwatch (default green): ",
395395
"autostarttask": "Auto start default task",
396396
"autostarttask-tip": "When a default task is set and this setting is on, wnr will automatically start the default task every time this app is opened. ",
397+
"simple-countdown-settings": "Simple countdown settings",
398+
"simple-countdown-settings-tip": "These settings are independent from predefined tasks and only affect the simple countdown mode.",
399+
"simple-countdown-time": "Default countdown time (minutes)",
400+
"simple-countdown-focus": "Full screen focus mode",
397401
"withdraw-timing": "Withdraw timing",
398402
"fail-to-withdraw": "You cannot withdraw timing currently. ",
399403
"statistics-enter": "Enter statistics",

locales/zh-CN.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,10 @@
396396
"theme-color-positive": "正计时(默认绿色):",
397397
"autostarttask": "自动开始默认预设",
398398
"autostarttask-tip": "当设置了默认预设且开启了此选项后,将在每次打开 wnr 软件时自动开始默认预设的计时,以提升强力水平。",
399+
"simple-countdown-settings": "单纯计时设置",
400+
"simple-countdown-settings-tip": "这些设置独立于预设任务,仅影响单纯计时模式。",
401+
"simple-countdown-time": "默认计时时间(分钟)",
402+
"simple-countdown-focus": "全屏专心模式",
399403
"withdraw-timing": "提前退出计时",
400404
"fail-to-withdraw": "当前不能提前退出。",
401405
"statistics-enter": "进入统计界面",

locales/zh-TW.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,10 @@
389389
"theme-color-positive": "正計時(默認綠色):",
390390
"autostarttask": "自動開始默認預設",
391391
"autostarttask-tip": "當設置了默認預設且開啟了此選項後,將在每次打開 wnr 軟件時自動開始默認預設的計時,以提升強力水平。",
392+
"simple-countdown-settings": "單純計時設置",
393+
"simple-countdown-settings-tip": "這些設置獨立於預設任務,僅影響單純計時模式。",
394+
"simple-countdown-time": "默認計時時間(分鐘)",
395+
"simple-countdown-focus": "全屏專心模式",
392396
"withdraw-timing": "提前退出計時",
393397
"fail-to-withdraw": "當前不能提前退出。",
394398
"statistics-enter": "進入統計界面",

preferences-items.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ if (store.get("islocked") !== true) {
1717
}, {
1818
type: "selection",
1919
id: "autostarttask"
20+
}, {
21+
type: "collapse",
22+
id: "simple-countdown-settings",
23+
inner: [
24+
{
25+
type: "title",
26+
id: "simple-countdown-settings-tip"
27+
}, {
28+
type: "simple-countdown-settings"
29+
}
30+
],
2031
}, {
2132
type: "collapse",
2233
id: "task-reservation",

preferences-renderer.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,44 @@ function domString(type) {
368368
</script>
369369
</div><br/>`;
370370
break;
371+
case "simple-countdown-settings":
372+
let defaultCountdownTime = store.has("simple-countdown-time") ? store.get("simple-countdown-time") : 2;
373+
let defaultCountdownFocus = store.has("simple-countdown-focus") ? store.get("simple-countdown-focus") : false;
374+
appendDOMString = `
375+
<div class="w-100 row align-items-center">
376+
<div class="col-8 text-left">
377+
<label>
378+
${ i18n.__("simple-countdown-time") }
379+
</label>
380+
</div>
381+
<div class="col-4 text-right">
382+
<input id="simple-countdown-time-input" type="number" class="hotkeyset"
383+
value="${ defaultCountdownTime }"
384+
onchange="store.set('simple-countdown-time', Number($('#simple-countdown-time-input').val()))"
385+
oninput="if (Number(value) > 1440) value = 1440; if (Number(value) < 0.1) value = 0.1"
386+
style="ime-mode:Disabled"
387+
title="${ i18n.__('what-can-be-here-predefined-tasks') }" />
388+
<span class="text-muted small"> ${ i18n.__('min') }</span>
389+
</div>
390+
</div>
391+
<br/>
392+
<div class="w-100 row align-items-center">
393+
<div class="col-9 text-left">
394+
<label>
395+
${ i18n.__("simple-countdown-focus") }
396+
</label>
397+
</div>
398+
<div class="col-3 text-right">
399+
<label class="switch-slide">
400+
<input type="checkbox" id="simple-countdown-focus-checkbox" hidden
401+
${ defaultCountdownFocus ? 'checked' : '' }
402+
onclick="store.set('simple-countdown-focus', $('#simple-countdown-focus-checkbox').prop('checked'))">
403+
<label for="simple-countdown-focus-checkbox" class="switch-slide-label"></label>
404+
</label>
405+
</div>
406+
</div>
407+
<br/>`;
408+
break;
371409
case "personalization-notify-sound":
372410
appendDOMString = `
373411
<div class="w-100 row align-items-center">

style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ li input:nth-last-child(4)::after {
210210
color: #a26ae5c2;
211211
}
212212

213+
#rest-time-onlyrest {
214+
min-width: 225px;
215+
}
216+
213217
.text-grey {
214218
color: #6c757d;
215219
}

timer.html

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ <h3>
388388
(times === 0 ? firstTimeDiscount : 0)) / 60000,
389389
percentage: Math.round(lastRecordedProgress * 100),
390390
method: method,
391-
isWorking: isClockWorking
391+
isWorking: isClockWorking,
392+
isOnlyRest: isOnlyRest
392393
});
393394
}, 500 * floatingRepeater);
394395
else
@@ -792,9 +793,11 @@ <h3>
792793
wasCounting = !wasCounting;
793794
if (isClockWorking) {
794795
window.clearInterval(int);
795-
pauseInt = setTimeout(function () {
796-
ipc.send("can-redo-alert");
797-
}, 1000 * 60 * 7);
796+
if (store.get("alarmtip") !== false) {
797+
pauseInt = setTimeout(function () {
798+
ipc.send("can-redo-alert");
799+
}, 1000 * 60 * 7);
800+
}
798801
$("#stopper").html("<i class='iconfont icon-play' aria-hidden='true'></i>");
799802
isClockWorking = 0;//to stop
800803
ipc.send("tray-image-change", "stop");
@@ -1323,7 +1326,8 @@ <h3>
13231326
val: seconds / 60,
13241327
percentage: naturalProgress,
13251328
method: method,
1326-
isWorking: isClockWorking
1329+
isWorking: isClockWorking,
1330+
isOnlyRest: isOnlyRest
13271331
});
13281332
$bottomBar.css("width", naturalProgress + "%");
13291333
}

0 commit comments

Comments
 (0)