-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
695 lines (609 loc) · 23 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width,
initial-scale=1">
<meta http-equiv="X-UA-Compatible">
<title>PomoTube | Productivity timer with youtube player</title>
<meta name="description" content="Simple pomodoro based timer with youtube player">
<link rel="icon" href="./images/logo-192.png">
<!-- Meta Tags requred for
Progressive Web App -->
<meta name=
"apple-mobile-web-app-status-bar"
content="teal">
<meta name="theme-color"
content="teal">
<!-- Manifest File link -->
<link rel="manifest" href="./manifest.webmanifest">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300:700&display=swap"
rel="stylesheet">
<style>
.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}
/* ====== DEFAULT SETTINGS (MOBILE & FULLSCREEN) ======= */
#container {
text-align: center;
font-family: 'Roboto', sans-serif;
}
#header h1 {
color: teal;
}
#timer-bar {
width: 100%;
text-align: center;
font-weight: bold;
color: #eeeeee;
background: teal;
}
#timer-bar > .wrapper {
margin:auto;
display: inline-flex;
min-height: 100%;
align-items: center;
}
#timer-bar span {
padding:3px;
}
#timer-bar label { display: none; }
#timer-bar button {
padding: 3px;
margin:0;
background-color: teal;
color: #fff;
border: none;
height:100%;
text-align: center;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
cursor: pointer;
}
#timer-bar button:hover,
#timer-bar button:disabled {
background-color: #00aaaa;
}
#round-display:before { content: '('; }
#round-display:after { content: ')'; }
#player-area {
width:100%;
height:30vh;
max-width:600px;
max-height:400px;
margin:auto;
display: flex;
flex-flow: column;
}
#player-frame {
flex: 1 1 auto;
}
#history {
padding:0;
background: #D7EAEA;
border:3px solid #227b7e;
text-align: left;
max-height: 50vh;
overflow-y:scroll;
}
#history div {
border-top: 2px solid #36878a;
cursor: pointer;
overflow-x: hidden;
padding:2px;
white-space: nowrap;
}
#history div:first-child {
border-top: none;
}
#settings-duration {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
}
#settings-duration , #settings-duration button { margin-top:10px; }
#settings-duration input { width:20px; }
#social-buttons {
vertical-align:middle;
margin-top:15px;
}
#social-buttons * { margin:auto; }
/* ===== FULLSCREEN SPECIFIC SETTINGS ===== */
.non-fullscreen-hide { display: none }
.fullscreen .non-fullscreen-hide { display: block }
.fullscreen .fullscreen-hide { display: none; }
#container.fullscreen {
width:100%;
height:93vh;
max-width:none;
}
.fullscreen #player-area {
height:100%;
display: flex;
flex-flow: column;
max-width:none;
max-height:none;
}
.fullscreen #player-frame {
flex: 1 1 auto;
}
/* taken from https://www.w3schools.com/howto/howto_css_modals.asp */
.fullscreen .modal {
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content/Box */
.fullscreen .modal-content {
background-color: #fefefe;
margin: 15% auto; /* 15% from the top and centered */
padding: 20px;
border: 1px solid #888;
width: 80%; /* Could be more or less, depending on screen size */
}
/* The Close Button */
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
/* ===== NON-MOBILE SETTINGS ===== */
@media (min-width: 600px) {
#container {
max-width: 800px;
margin: auto;
padding: 20px;
text-align: center;
}
#timer-bar label {
display: inline-block;
font-weight: normal;
}
#round-display:before { content: ''; }
#round-display:after { content: ''; }
#player-area {
height:60vh;
}
}
</style>
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.x.x/dist/alpine.min.js" defer></script>
<script async defer data-website-id="c155d40a-7c77-448e-95e0-b4983573c91e" src="https://umami.rover.server.adianto.id/umami.js"></script>
</head>
<body>
<div id="container" x-data="data()" x-init="init()" x-ref="container">
<a href="https://github.com/azophy/pomotube" class="github-corner fullscreen-hide" aria-label="View source on GitHub" target="_blank" rel="noopener"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#151513; color:#fff; position: fixed; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>
<div id="header" class="fullscreen-hide">
<h1>PomoTube</h1>
<p>Pomodoro timer with youtube player</p>
</div>
<div id="player-area">
<div id="timer-bar">
<div class="wrapper">
<label for="session-display">Session:</label> <span id="session-display" x-text="session" title="current session"></span>
<label for="round-display">Round:</label> <span id="round-display" x-text="round" title="current number of rounds"></span>
<label for="timer-display">Timer:</label> <span id="timer-display" x-text="displayTimer()" title="time left"></span>
<button id="btn-start" @click="toggleTimer()" :title="timer_action"
x-html="(timer_action == 'Start' || timer_action == 'Resume') ? start_text : pause_text">
</button>
<button id="btn-reset" @click="resetTimer()" title="Pause"
x-bind:disabled="timer_action == 'Start'">
<i class="material-icons">replay</i>
</button>
<button class="non-fullscreen-hide" @click="toggleModal()" title="Settings">
<i class="material-icons">settings</i>
</button>
<button x-ref="btn_fullscreen" @click="toggleFullscreen()" title="Toggle Fullscreen">
<i class="material-icons">fullscreen</i>
</button>
</div>
</div>
<iframe id="player-frame"
src="https://www.youtube.com/embed/?enablejsapi=1"
frameborder="0"
></iframe>
</div>
<div id="options" class="fullscreen-hide modal">
<div class="modal-content">
<i id="btn-close-modal" class="non-fullscreen-hide material-icons close" onclick="toggleModal()">close</i>
<p>
<label for="video_url">youtube video/playlist url</label>
<input type="text" id="video_url" x-model="video_url" width="60%"/>
<button @click="loadVideoFromInput()">Use this</button>
</p>
<strong x-show="history.length > 0">Video history:</strong>
<div id="history" x-show="history.length > 0">
<template x-for="item in history" :key="item">
<div x-text="item.title"
@click="video_url = item.url; loadVideoFromInput()"
title="load this video"
></div>
</template>
</div>
<div id="settings-duration">
<label>Focus Duration</label>
<div>
<input type="text" x-ref="focus_duration_min">:
<input type="text" x-ref="focus_duration_sec">
</div>
<label>Break Duration</label>
<div>
<input type="text" x-ref="break_duration_min">:
<input type="text" x-ref="break_duration_sec">
</div>
<label>Long Break Duration</label>
<div>
<input type="text" x-ref="long_break_duration_min">:
<input type="text" x-ref="long_break_duration_sec">
</div>
<label>Long Break Cycle</label>
<div>
<input type="text" x-ref="long_break_cycle"> rounds
</div>
</div>
<button @click="applySettings()"
:disabled="!(session == 'Focus' && timer_action == 'Start')"
:title="(session == 'Focus' && timer_action == 'Start')
? 'Enable these settings'
: 'You could only enable these settings by resetting the timer'
"
>Apply</button>
<button @click="resetSettings()" title="Reset to default settings">Reset</button>
</div>
</div><!-- end options -->
<div id="social-buttons" class="fullscreen-hide">
<iframe src="https://ghbtns.com/github-btn.html?user=azophy&repo=pomotube&type=star&count=true&size=large" frameborder="0" scrolling="0" width="120" height="30" title="GitHub"></iframe>
<a href="https://twitter.com/pomotube?ref_src=twsrc%5Etfw" class="twitter-follow-button" data-size="large" data-dnt="true" data-show-count="false">Follow us on twitter!</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<a href="https://ko-fi.com/M4M42ORK0" target="_blank">
<img src="https://www.ko-fi.com/img/githubbutton_sm.svg" alt="ko-fi button">
</a>
</div>
<div id="faq" class="fullscreen-hide">
<hr/>
<strong>How to use this website?</strong>
<p>First prepare a youtube url you would like to play. You could use a single video or a playlist. The player would loop the video/playlist when it ends.</p>
<p>After that, you paste it on the input box under the video player. Then you could just click the 'Play' button to start your 'Focus' session'. The timer is set to 25 minutes of 'Focus' session and 5 minutes of 'Break' session, and would alternate each session one after another. For each 4 rounds, you would have 15 minutes of long break. You could pause or reset the timer anytime. You also could change any of the durations to suite your needs.</p>
<p>You can turn the player into Fullscreen mode. In that mode, the player would fill the page, and left the timer toolbar above the player. If you wish to, you could also install this website as a PWA by clicking the 'Install this page' button on your browser's URL bar.</p>
<strong>Where do you store my video history?</strong>
<p>The history is stored locally on your browser, so we can't see it on our server. When you change browser or device, the history would be separated.</p>
</div>
<div id="footer" class="fullscreen-hide">
<hr/>
Made by <a href="https://abdurrahman.adianto.id">Abdurrahman Shofy Adianto</a> , 2020. Released under <a href="https://www.gnu.org/licenses/#AGPL">GNU AGPLv3</a>. <br/>
<p style="font-style:italic">PomoTube is not related to the Pomodoro Technique™/Pomodoro™’s trademark holder Cirillo Company and respects its trademarks. Pomodoro Technique® and Pomodoro® are registered trademarks of Francesco Cirillo. All logos and marks contained herein are the property of their respective owners. </p>
</div>
</div>
<script>
window.addEventListener('load', () => {
registerSW();
});
// Register the Service Worker
async function registerSW() {
if ('serviceWorker' in navigator) {
try {
await navigator
.serviceWorker
.register('serviceworker.js');
}
catch (e) {
console.log('SW registration failed');
}
}
}
// taken from https://developers.google.com/youtube/iframe_api_reference#Examples
var tag = document.createElement('script');
tag.id = 'iframe-demo';
tag.src = 'https://www.youtube.com/iframe_api';
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('player-frame', {
events: {
'onReady': function() {
var url = document.getElementById('video_url').value;
loadVideoByUrl(url);
},
}
});
}
function loadVideoByUrl(url, autoplay) {
if (player == undefined) return false;
if (autoplay == undefined) autoplay=false;
// url validation
try {
var params = new URL(url).searchParams;
} catch (e) {
console.log(e);
if (e instanceof TypeError) {
alert('Error: wrong url format. Please make sure the url is right (including http/https)');
} else {
alert('Error: ' + e);
}
return false;
}
var playlist_data;
// only load if new url is different
if (player.getVideoUrl() == url) {
return false;
}
//playlist
if (url.indexOf('playlist') != -1) {
playlist_data = {
listType:'playlist',
list: params.get('list'),
};
}
//video
else {
// load as playlist instead as single video so we could loop it
playlist_data = params.get('v');
}
// actual playlist loading
if (autoplay) {
player.loadPlaylist(playlist_data);
} else {
player.cuePlaylist(playlist_data);
}
player.setLoop(true); //set video loop
// prevent auto play after load
player.pauseVideo();
}
var snd = new Audio("./sounds/eventually.ogg");
function notify(msg) {
// script taken from https://stackoverflow.com/a/23395136
snd.play();
// script taken from https://developer.mozilla.org/en-US/docs/Web/API/notification
// Let's check if the browser supports notifications
if (!("Notification" in window)) {
alert("This browser does not support desktop notification");
}
// Let's check whether notification permissions have already been granted
else if (Notification.permission === "granted") {
// If it's okay let's create a notification
var notification = new Notification(msg);
}
// Otherwise, we need to ask the user for permission
else if (Notification.permission != "denied") {
Notification.requestPermission().then(function (permission) {
// If the user accepts, let's create a notification
if (permission === "granted") {
var notification = new Notification(msg);
}
});
}
// At last, if the user has denied notifications, and you
// want to be respectful there is no need to bother them any more.
else {
alert('sorry, but this app require notification capabilities enabled. please enable first before using');
}
}
function toggleModal() {
Array.from(document.getElementsByClassName('modal')).forEach((elem) => {
//elem.style.display = (elem.style.display != 'block') ? 'block' : 'none';
elem.classList.toggle('fullscreen-hide');
});
}
function data() {
return {
pomodoro_duration: 25*60,
break_duration: 5*60,
long_break_duration: 5*60,
long_break_cycle: 4,
timer: 0,
session: 'Focus',
round: 1,
end_time: 0,
counter: null,
timer_action: 'Start',
video_url: 'https://www.youtube.com/watch?v=5yx6BWlEVcY', //ChillHop caffee
start_text: '<i class="material-icons">play_arrow</i>',
pause_text: '<i class="material-icons">pause</i>',
history: [],
original_window_title:null,
init() {
if (window.localStorage.getItem('video_url')) {
this.video_url = window.localStorage.getItem('video_url');
}
if (window.localStorage.getItem('history')) {
this.history = JSON.parse(window.localStorage.getItem('history'));
}
if (window.localStorage.getItem('pomodoro_duration')) {
this.pomodoro_duration = window.localStorage.getItem('pomodoro_duration')
}
if (window.localStorage.getItem('break_duration')) {
this.break_duration = window.localStorage.getItem('break_duration')
}
if (window.localStorage.getItem('long_break_duration')) {
this.long_break_duration = window.localStorage.getItem('long_break_duration')
}
if (window.localStorage.getItem('long_break_cycle')) {
this.long_break_cycle = window.localStorage.getItem('long_break_cycle')
}
this.displaySettings()
this.timer = this.pomodoro_duration;
if (Notification.permission != "granted") {
Notification.requestPermission().then(function (permission) {
if (permission != "granted") {
alert('sorry, but this app require notification capabilities enabled. please enable first before using');
}
});
}
loadVideoByUrl(this.video_url);
},
displayTimer() {
var mm = Math.floor(this.timer/60),
ss = this.timer%60;
return ( mm < 10 ? '0':'') + mm + ':' + (ss < 10 ? '0' : '') + ss;
},
updateTimer() {
var msg, cur_time = new Date().getTime();
this.timer = Math.floor((this.end_time - cur_time)/1000);
document.title = this.displayTimer() + ' - ' + this.session + ' Session';
if (this.timer <= 0) {
this.toggleTimer();
msg ='session ' + this.session + ' round ' + this.round + ' done';
if (this.session == 'Focus') {
if (this.round % this.long_break_cycle == 0) {
this.timer = this.long_break_duration;
this.session = 'Long Break';
} else {
this.timer = this.break_duration;
this.session = 'Break';
}
} else {
this.session = 'Focus';
this.timer = this.pomodoro_duration;
this.round++;
}
msg += "\nsession " + this.session + ' started'
notify(msg)
this.toggleTimer();
}
},
toggleTimer() {
if (this.timer_action == 'Pause') {
clearInterval(this.counter);
document.title = this.original_window_title;
this.timer_action = 'Resume'
player.pauseVideo();
} else {
this.end_time = new Date().getTime() + this.timer*1000;
this.original_window_title = document.title;
this.counter = setInterval(() => {this.updateTimer();}, 100);
this.timer_action = 'Pause'
if (this.session == "Focus") {
player.playVideo();
}
}
},
resetTimer() {
player.pauseVideo();
if (this.timer_action != 'Resume') {
clearInterval(this.counter);
}
this.timer = this.pomodoro_duration;
this.round = 1;
this.session = 'Focus';
this.timer_action = 'Start'
},
toggleFullscreen() {
this.$refs.container.classList.toggle('fullscreen');
var is_fullscreen = this.$refs.container.classList.contains('fullscreen');
this.$refs.btn_fullscreen.innerHTML = (is_fullscreen)
? '<i class="material-icons">fullscreen_exit</i>'
: '<i class="material-icons">fullscreen</i>'
;
},
loadVideoFromInput() {
var url = this.video_url.trim();
window.localStorage.setItem('video_url', url);
var autoplay = (this.session == "Focus" && this.timer_action == "Pause");
loadVideoByUrl(url, autoplay);
// remove previous value from history
var old_item, title,
idx_old = this.history.findIndex(x => x.url == url)
if (idx_old != -1) {
// clone old item before deleting
old_item = JSON.parse(JSON.stringify(this.history[idx_old]));
this.history.splice(idx_old,1)
}
// get video title
var promise,
base_api = 'https://youtube.googleapis.com/youtube/v3/',
api_key = 'AIzaSyAdiZBboIWG3nhLhsyzamfdHYPbs6tYNi8';
if (idx_old != -1 && old_item.title != old_item.url) {
promise = Promise.resolve(old_item.title)
} else {
var method, object_id, final_url;
var params = new URL(url).searchParams;
// playlist
if (url.indexOf('playlist') != -1) {
object_id = params.get('list')
method = 'playlists'
}
//video
else {
// load as playlist instead as single video so we could loop it
object_id = params.get('v');
method = 'videos'
}
final_url = base_api + method +
'?part=snippet&fields=items(id,snippet(title))&key='
+ api_key + '&id=' + object_id;
promise = fetch(final_url).then(r => r.json()).then(r => {
title = r.items[0].snippet.title;
return title;
})
}
// append to history
promise.then((title) => {
this.history.unshift({
title: title,
url: url,
timestamp: new Date().getTime(),
});
window.localStorage.setItem('history', JSON.stringify(this.history));
})
.catch(e => {
console.log(e);
this.history.unshift({
title: url,
url: url,
timestamp: new Date().getTime(),
});
window.localStorage.setItem('history', JSON.stringify(this.history));
});
},
displaySettings() {
this.$refs.focus_duration_min.value = Math.floor(this.pomodoro_duration/60)
this.$refs.focus_duration_sec.value = this.pomodoro_duration%60
this.$refs.break_duration_min.value = Math.floor(this.break_duration/60)
this.$refs.break_duration_sec.value = this.break_duration%60
this.$refs.long_break_duration_min.value = Math.floor(this.long_break_duration/60)
this.$refs.long_break_duration_sec.value = this.long_break_duration%60
this.$refs.long_break_cycle.value = this.long_break_cycle
},
applySettings() {
this.pomodoro_duration = Number(this.$refs.focus_duration_min.value) * 60 +
Number(this.$refs.focus_duration_sec.value);
this.break_duration = Number(this.$refs.break_duration_min.value) * 60 +
Number(this.$refs.break_duration_sec.value);
this.long_break_duration = Number(this.$refs.long_break_duration_min.value) * 60 +
Number(this.$refs.long_break_duration_sec.value);
this.long_break_cycle = Number(this.$refs.long_break_cycle.value);
this.resetTimer()
this.displaySettings()
window.localStorage.setItem('pomodoro_duration', this.pomodoro_duration);
window.localStorage.setItem('break_duration', this.break_duration);
window.localStorage.setItem('long_break_duration', this.long_break_duration);
window.localStorage.setItem('long_break_cycle', this.long_break_cycle);
},
resetSettings() {
this.pomodoro_duration = 1500
this.break_duration = 300
this.long_break_duration = 900
this.long_break_cycle = 4
this.resetTimer()
this.displaySettings()
},
};
}
</script>
</body>
</html>