|
36 | 36 | if (e.keyCode == 13) {
|
37 | 37 | window.location.href = "timer.html?title=" + $("#title").val() + "&work-time=" + $("#work-time").val() + "&rest-time=" + $("#rest-time").val() + "&loop=" + $("#loop").val() + "¬e=" + $("#note").val();
|
38 | 38 | }
|
39 |
| - /*if (e.keyCode == 38 || e.keyCode == 40 || e.keyCode == 110 || e.keyCode == 69) { |
40 |
| - return false; |
41 |
| - }*/ |
42 | 39 | }
|
43 | 40 | document.onkeydown = keydown;
|
44 | 41 | </script>
|
|
83 | 80 | <div id="dropdown-itemlist">
|
84 | 81 | </div>
|
85 | 82 | <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')"> |
87 | 84 | <script>document.write(i18n.__('edit'));</script>
|
88 | 85 | </a>
|
89 | 86 | </div>
|
|
140 | 137 | <script>
|
141 | 138 | var timecnt, myDate, h, min, defaultArray;
|
142 | 139 | function sumGet() {
|
143 |
| - console.log('a') |
144 | 140 | timecnt = (Number($("#work-time").val()) + Number($("#rest-time").val())) * Number($("#loop").val());
|
145 | 141 | $("#allsum-num").html(timecnt);
|
146 | 142 | myDate = new Date();
|
|
152 | 148 | if (min >= 10) $("#to-num-min").html(parseInt(min));
|
153 | 149 | else $("#to-num-min").html("0" + parseInt(min));
|
154 | 150 | }
|
155 |
| - function defaultSet(workTime, restTime, loopFor) { |
| 151 | + function defaultSet(workTime, restTime, loops, focusWhenWorking, focusWhenResting) { |
156 | 152 | $("#work-time").val(workTime);
|
157 | 153 | $("#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; |
159 | 157 | allSet();
|
160 | 158 | }
|
161 | 159 | 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(); |
166 | 160 | if (process.platform == "darwin") {
|
167 | 161 | $("#win-hider").css("display", "none");
|
168 | 162 | $("#no-use-space").css("display", "none");
|
169 | 163 | }
|
170 |
| - defaultArray = store.get("defaults"); |
| 164 | + defaultArray = store.get("predefined-tasks"); |
171 | 165 | 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() + "¬e=" + $("#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>"); |
173 | 175 | });
|
174 | 176 | function allSet() {
|
175 | 177 | 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 | 182 | $("#to-num-min").html("--");
|
181 | 183 | }
|
182 | 184 | }
|
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 |
| - } |
195 | 185 | </script>
|
196 | 186 | <script src="renderer.js"></script>
|
197 | 187 | </body>
|
|
0 commit comments