Skip to content

Commit

Permalink
updated for time settings etc
Browse files Browse the repository at this point in the history
  • Loading branch information
RoderickQiu committed Jan 18, 2020
1 parent 9977373 commit 353655f
Show file tree
Hide file tree
Showing 10 changed files with 394 additions and 479 deletions.
119 changes: 0 additions & 119 deletions defaults.html

This file was deleted.

40 changes: 15 additions & 25 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@
if (e.keyCode == 13) {
window.location.href = "timer.html?title=" + $("#title").val() + "&work-time=" + $("#work-time").val() + "&rest-time=" + $("#rest-time").val() + "&loop=" + $("#loop").val() + "&note=" + $("#note").val();
}
/*if (e.keyCode == 38 || e.keyCode == 40 || e.keyCode == 110 || e.keyCode == 69) {
return false;
}*/
}
document.onkeydown = keydown;
</script>
Expand Down Expand Up @@ -83,7 +80,7 @@
<div id="dropdown-itemlist">
</div>
<div class="dropdown-divider"></div>
<a class="dropdown-item font-weight-bold" href="defaults.html">
<a class="dropdown-item font-weight-bold" href="javascript:call('settings')">
<script>document.write(i18n.__('edit'));</script>
</a>
</div>
Expand Down Expand Up @@ -140,7 +137,6 @@
<script>
var timecnt, myDate, h, min, defaultArray;
function sumGet() {
console.log('a')
timecnt = (Number($("#work-time").val()) + Number($("#rest-time").val())) * Number($("#loop").val());
$("#allsum-num").html(timecnt);
myDate = new Date();
Expand All @@ -152,24 +148,30 @@
if (min >= 10) $("#to-num-min").html(parseInt(min));
else $("#to-num-min").html("0" + parseInt(min));
}
function defaultSet(workTime, restTime, loopFor) {
function defaultSet(workTime, restTime, loops, focusWhenWorking, focusWhenResting) {
$("#work-time").val(workTime);
$("#rest-time").val(restTime);
$("#loop").val(loopFor);
$("#loop").val(loops);
document.getElementById("focus-work-set").checked = focusWhenWorking;
document.getElementById("focus-rest-set").checked = focusWhenResting;
allSet();
}
isTimerWindow(false);
$("#work-time").val(store.get("worktime"));
$("#rest-time").val(store.get("resttime"));
$("#loop").val(store.get("looptime"));
if ((Number($("#work-time").val()) + Number($("#rest-time").val())) * Number($("#loop").val())) sumGet();
if (process.platform == "darwin") {
$("#win-hider").css("display", "none");
$("#no-use-space").css("display", "none");
}
defaultArray = store.get("defaults");
defaultArray = store.get("predefined-tasks");
defaultArray.forEach(function (item, index, array) {
$("#dropdown-itemlist").append("<a class='dropdown-item' href='javascript:defaultSet(" + item.workTime + ", " + item.restTime + ", " + item.loops + ")'>" + item.name + "</a>");
if (store.get("default-task") == index) {
defaultSet(item.workTime, item.restTime, item.loops, item.focusWhenWorking, item.focusWhenResting);
if (store.get("autostarttask") && store.get("just-launched") && (!store.get("just-relaunched"))) {//auto-send the form is autostarttask is on
window.location.href = "timer.html?title=" + $("#title").val() + "&work-time=" + $("#work-time").val() + "&rest-time=" + $("#rest-time").val() + "&loop=" + $("#loop").val() + "&note=" + $("#note").val();
} else if (store.get("just-relaunched")) {
store.set("just-relaunched", false);
}
}
$("#dropdown-itemlist").append("<a class='dropdown-item' href='javascript:defaultSet(" + item.workTime + ", " + item.restTime + ", " + item.loops + "," + item.focusWhenWorking + "," + item.focusWhenResting + ")'>" + item.name + "</a>");
});
function allSet() {
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) {
Expand All @@ -180,18 +182,6 @@
$("#to-num-min").html("--");
}
}
if (store.get("fullscreen") == true) document.getElementById("focus-rest-set").checked = true;
else document.getElementById("focus-rest-set").checked = false;
function fullscreenset() {
if (document.getElementById("focus-rest-set").checked == true) store.set("fullscreen", true);
else store.set("fullscreen", false);
}
if (store.get("fullscreen-work") == true) document.getElementById("focus-work-set").checked = true;
else document.getElementById("focus-work-set").checked = false;
function focusworkset() {
if (document.getElementById("focus-work-set").checked == true) store.set("fullscreen-work", true);
else store.set("fullscreen-work", false);
}
</script>
<script src="renderer.js"></script>
</body>
Expand Down
24 changes: 16 additions & 8 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"winhider": "Hide the window to system tray",
"minimizer": "Minimize to taskbar",
"title": "please enter a title",
"worktime": "1. work for (minutes)",
"resttime": "2. rest for (minutes)",
"worktime": "work for (minutes)",
"resttime": "rest for (minutes)",
"loop": "loop for (times)",
"note": "notes",
"tip": "Press Enter to submit.",
Expand Down Expand Up @@ -65,7 +65,7 @@
"alwaystip": "If it is enabled, then every time you start wnr, it will stay on the top of the screen.",
"restarttip": "Restart for wnr is required.",
"restartnow": "Restart Now",
"autorestarttip": "The software is going to restart.",
"autorestarttip": "The software will automatically restart.",
"autostart": "Start up with system: ",
"autotip": "If it is enabled, then every time your system starts, wnr starts.",
"fullscreenrest": "Fullscreen rest time: ",
Expand All @@ -77,9 +77,9 @@
"checker1": "(Now ",
"checker2": ")",
"hotkeytip": "Open/Hide hotkey: ",
"hotkeyusage": "(Hide wnr to the system tray. [Can be set. The software is going to restart.])",
"hotkeyusage": "(Hide wnr to the system tray. [Can be set. The software will restart.])",
"hotkey2tip": "Start/Stop hotkey: ",
"hotkey2usage": "(Fast start/stop the timer. Only available when there is a timer working. [Can be set. The software is going to restart.])",
"hotkey2usage": "(Fast start/stop the timer. Only available when there is a timer working. [Can be set. The software will restart.])",
"deleteall": "Delete all settings.",
"deletealltitle": "Are you sure you want to delete all data? ",
"deleteallcontent": "It will be erased, and cannot be re-found. ",
Expand Down Expand Up @@ -124,11 +124,19 @@
"isalarmtipontip": "If it is enabled, wnr will send tips for you if you aren't really using wnr. ",
"isonemintipon": "Tip for only 1 min left: ",
"isonemintipontip": "If it is enabled, wnr will send you a tip that your time is running out in 1 min. ",
"working": "WORK",
"resting": "REST",
"working": "WORK FOR",
"resting": "REST FOR",
"looping": "LOOP FOR",
"timeleft": "% Left",
"defaultsbackhome": "Back home",
"add": "Add",
"delete": "Delete"
"delete": "Delete",
"timesetdeleted": "The former Time Settings has been deleted. The alternative is the Predefined Tasks Settings.",
"defaultsset": "Predefined Tasks Settings",
"focuswhenworking": "Focus when working",
"focuswhenresting": "Focus when resting",
"setasdefault": "Set this as default",
"defaulttip": "(The task with red title is the default task.)",
"isautostarttaskon": "Auto start default task when wnr is launched: ",
"isautostarttaskontip": "If it is enabled, wnr will automatically start the default predefined task if there is one."
}
14 changes: 11 additions & 3 deletions locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,23 @@
"default1": "预设",
"default2": "任务",
"edit": "编辑预设",
"isalarmtipon": "是否要让wnr发出使用提醒",
"isalarmtipon": "是否要发出使用提醒",
"isalarmtipontip": "如果此项被选中,则wnr会在您一直不使用的时候提示您使用wnr,提高效率。",
"isonemintipon": "是否要让wnr在时间仅剩下一分钟时发出提醒",
"isonemintipon": "是否要在时间仅剩下一分钟时发出提醒",
"isonemintipontip": "如果此项被选中,则wnr会在时间仅剩下一分钟时发出提醒,提示您进行暂时收尾工作。",
"working": "工作",
"resting": "休息",
"looping": "循环",
"timeleft": "% 时间剩余",
"defaultsbackhome": "返回首页",
"add": "添加",
"delete": "删除"
"delete": "删除",
"timesetdeleted": "时间设置已经被移除。请使用新的预设设置,原有的时间设置内容将被保存成为“user default”预设。",
"defaultsset": "预设设置",
"focuswhenworking": "工作时启用专心模式",
"focuswhenresting": "休息时启用专心模式",
"setasdefault": "设为默认预设",
"defaulttip": "红色标题的是默认预设,会自动使用;蓝色的是普通预设。",
"isautostarttaskon": "是否在启动时自动开始默认预设:",
"isautostarttaskontip": "如果此项被选中,则wnr会在启动时自动启用默认预设(假如有),这使你不会把wnr放在一边不管。"
}
Loading

0 comments on commit 353655f

Please sign in to comment.