Skip to content

Commit 353655f

Browse files
committed
updated for time settings etc
1 parent 9977373 commit 353655f

File tree

10 files changed

+394
-479
lines changed

10 files changed

+394
-479
lines changed

defaults.html

Lines changed: 0 additions & 119 deletions
This file was deleted.

index.html

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@
3636
if (e.keyCode == 13) {
3737
window.location.href = "timer.html?title=" + $("#title").val() + "&work-time=" + $("#work-time").val() + "&rest-time=" + $("#rest-time").val() + "&loop=" + $("#loop").val() + "&note=" + $("#note").val();
3838
}
39-
/*if (e.keyCode == 38 || e.keyCode == 40 || e.keyCode == 110 || e.keyCode == 69) {
40-
return false;
41-
}*/
4239
}
4340
document.onkeydown = keydown;
4441
</script>
@@ -83,7 +80,7 @@
8380
<div id="dropdown-itemlist">
8481
</div>
8582
<div class="dropdown-divider"></div>
86-
<a class="dropdown-item font-weight-bold" href="defaults.html">
83+
<a class="dropdown-item font-weight-bold" href="javascript:call('settings')">
8784
<script>document.write(i18n.__('edit'));</script>
8885
</a>
8986
</div>
@@ -140,7 +137,6 @@
140137
<script>
141138
var timecnt, myDate, h, min, defaultArray;
142139
function sumGet() {
143-
console.log('a')
144140
timecnt = (Number($("#work-time").val()) + Number($("#rest-time").val())) * Number($("#loop").val());
145141
$("#allsum-num").html(timecnt);
146142
myDate = new Date();
@@ -152,24 +148,30 @@
152148
if (min >= 10) $("#to-num-min").html(parseInt(min));
153149
else $("#to-num-min").html("0" + parseInt(min));
154150
}
155-
function defaultSet(workTime, restTime, loopFor) {
151+
function defaultSet(workTime, restTime, loops, focusWhenWorking, focusWhenResting) {
156152
$("#work-time").val(workTime);
157153
$("#rest-time").val(restTime);
158-
$("#loop").val(loopFor);
154+
$("#loop").val(loops);
155+
document.getElementById("focus-work-set").checked = focusWhenWorking;
156+
document.getElementById("focus-rest-set").checked = focusWhenResting;
159157
allSet();
160158
}
161159
isTimerWindow(false);
162-
$("#work-time").val(store.get("worktime"));
163-
$("#rest-time").val(store.get("resttime"));
164-
$("#loop").val(store.get("looptime"));
165-
if ((Number($("#work-time").val()) + Number($("#rest-time").val())) * Number($("#loop").val())) sumGet();
166160
if (process.platform == "darwin") {
167161
$("#win-hider").css("display", "none");
168162
$("#no-use-space").css("display", "none");
169163
}
170-
defaultArray = store.get("defaults");
164+
defaultArray = store.get("predefined-tasks");
171165
defaultArray.forEach(function (item, index, array) {
172-
$("#dropdown-itemlist").append("<a class='dropdown-item' href='javascript:defaultSet(" + item.workTime + ", " + item.restTime + ", " + item.loops + ")'>" + item.name + "</a>");
166+
if (store.get("default-task") == index) {
167+
defaultSet(item.workTime, item.restTime, item.loops, item.focusWhenWorking, item.focusWhenResting);
168+
if (store.get("autostarttask") && store.get("just-launched") && (!store.get("just-relaunched"))) {//auto-send the form is autostarttask is on
169+
window.location.href = "timer.html?title=" + $("#title").val() + "&work-time=" + $("#work-time").val() + "&rest-time=" + $("#rest-time").val() + "&loop=" + $("#loop").val() + "&note=" + $("#note").val();
170+
} else if (store.get("just-relaunched")) {
171+
store.set("just-relaunched", false);
172+
}
173+
}
174+
$("#dropdown-itemlist").append("<a class='dropdown-item' href='javascript:defaultSet(" + item.workTime + ", " + item.restTime + ", " + item.loops + "," + item.focusWhenWorking + "," + item.focusWhenResting + ")'>" + item.name + "</a>");
173175
});
174176
function allSet() {
175177
if (Number($("#work-time").val()) != 0 && Number($("#rest-time").val()) != 0 && Number($("#loop").val()) != 0 && String(Number($("#work-time").val())).indexOf('e') == -1 && String(Number($("#rest-time").val())).indexOf('e') == -1 && String(Number($("#loop").val())).indexOf('e') == -1) {
@@ -180,18 +182,6 @@
180182
$("#to-num-min").html("--");
181183
}
182184
}
183-
if (store.get("fullscreen") == true) document.getElementById("focus-rest-set").checked = true;
184-
else document.getElementById("focus-rest-set").checked = false;
185-
function fullscreenset() {
186-
if (document.getElementById("focus-rest-set").checked == true) store.set("fullscreen", true);
187-
else store.set("fullscreen", false);
188-
}
189-
if (store.get("fullscreen-work") == true) document.getElementById("focus-work-set").checked = true;
190-
else document.getElementById("focus-work-set").checked = false;
191-
function focusworkset() {
192-
if (document.getElementById("focus-work-set").checked == true) store.set("fullscreen-work", true);
193-
else store.set("fullscreen-work", false);
194-
}
195185
</script>
196186
<script src="renderer.js"></script>
197187
</body>

locales/en.json

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"winhider": "Hide the window to system tray",
2828
"minimizer": "Minimize to taskbar",
2929
"title": "please enter a title",
30-
"worktime": "1. work for (minutes)",
31-
"resttime": "2. rest for (minutes)",
30+
"worktime": "work for (minutes)",
31+
"resttime": "rest for (minutes)",
3232
"loop": "loop for (times)",
3333
"note": "notes",
3434
"tip": "Press Enter to submit.",
@@ -65,7 +65,7 @@
6565
"alwaystip": "If it is enabled, then every time you start wnr, it will stay on the top of the screen.",
6666
"restarttip": "Restart for wnr is required.",
6767
"restartnow": "Restart Now",
68-
"autorestarttip": "The software is going to restart.",
68+
"autorestarttip": "The software will automatically restart.",
6969
"autostart": "Start up with system: ",
7070
"autotip": "If it is enabled, then every time your system starts, wnr starts.",
7171
"fullscreenrest": "Fullscreen rest time: ",
@@ -77,9 +77,9 @@
7777
"checker1": "(Now ",
7878
"checker2": ")",
7979
"hotkeytip": "Open/Hide hotkey: ",
80-
"hotkeyusage": "(Hide wnr to the system tray. [Can be set. The software is going to restart.])",
80+
"hotkeyusage": "(Hide wnr to the system tray. [Can be set. The software will restart.])",
8181
"hotkey2tip": "Start/Stop hotkey: ",
82-
"hotkey2usage": "(Fast start/stop the timer. Only available when there is a timer working. [Can be set. The software is going to restart.])",
82+
"hotkey2usage": "(Fast start/stop the timer. Only available when there is a timer working. [Can be set. The software will restart.])",
8383
"deleteall": "Delete all settings.",
8484
"deletealltitle": "Are you sure you want to delete all data? ",
8585
"deleteallcontent": "It will be erased, and cannot be re-found. ",
@@ -124,11 +124,19 @@
124124
"isalarmtipontip": "If it is enabled, wnr will send tips for you if you aren't really using wnr. ",
125125
"isonemintipon": "Tip for only 1 min left: ",
126126
"isonemintipontip": "If it is enabled, wnr will send you a tip that your time is running out in 1 min. ",
127-
"working": "WORK",
128-
"resting": "REST",
127+
"working": "WORK FOR",
128+
"resting": "REST FOR",
129129
"looping": "LOOP FOR",
130130
"timeleft": "% Left",
131131
"defaultsbackhome": "Back home",
132132
"add": "Add",
133-
"delete": "Delete"
133+
"delete": "Delete",
134+
"timesetdeleted": "The former Time Settings has been deleted. The alternative is the Predefined Tasks Settings.",
135+
"defaultsset": "Predefined Tasks Settings",
136+
"focuswhenworking": "Focus when working",
137+
"focuswhenresting": "Focus when resting",
138+
"setasdefault": "Set this as default",
139+
"defaulttip": "(The task with red title is the default task.)",
140+
"isautostarttaskon": "Auto start default task when wnr is launched: ",
141+
"isautostarttaskontip": "If it is enabled, wnr will automatically start the default predefined task if there is one."
134142
}

locales/zh.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,23 @@
120120
"default1": "预设",
121121
"default2": "任务",
122122
"edit": "编辑预设",
123-
"isalarmtipon": "是否要让wnr发出使用提醒",
123+
"isalarmtipon": "是否要发出使用提醒",
124124
"isalarmtipontip": "如果此项被选中,则wnr会在您一直不使用的时候提示您使用wnr,提高效率。",
125-
"isonemintipon": "是否要让wnr在时间仅剩下一分钟时发出提醒",
125+
"isonemintipon": "是否要在时间仅剩下一分钟时发出提醒",
126126
"isonemintipontip": "如果此项被选中,则wnr会在时间仅剩下一分钟时发出提醒,提示您进行暂时收尾工作。",
127127
"working": "工作",
128128
"resting": "休息",
129129
"looping": "循环",
130130
"timeleft": "% 时间剩余",
131131
"defaultsbackhome": "返回首页",
132132
"add": "添加",
133-
"delete": "删除"
133+
"delete": "删除",
134+
"timesetdeleted": "时间设置已经被移除。请使用新的预设设置,原有的时间设置内容将被保存成为“user default”预设。",
135+
"defaultsset": "预设设置",
136+
"focuswhenworking": "工作时启用专心模式",
137+
"focuswhenresting": "休息时启用专心模式",
138+
"setasdefault": "设为默认预设",
139+
"defaulttip": "红色标题的是默认预设,会自动使用;蓝色的是普通预设。",
140+
"isautostarttaskon": "是否在启动时自动开始默认预设:",
141+
"isautostarttaskontip": "如果此项被选中,则wnr会在启动时自动启用默认预设(假如有),这使你不会把wnr放在一边不管。"
134142
}

0 commit comments

Comments
 (0)