-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
60 lines (52 loc) · 1.28 KB
/
main.js
File metadata and controls
60 lines (52 loc) · 1.28 KB
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
import { setTime } from "./modules/date-time.js";
import {
backupTasks,
formatNewTask,
TODO_WRITE,
TODO_ADD,
} from "./modules/todo.js";
import { backUpNotes, addNewNote, NOTES_ADD } from "./modules/notes.js";
import {
startPomodoro,
pausePomodoro,
resetPomodoro,
START_BTN,
PAUSE_BTN,
RESET_BTN,
} from "./modules/pomodoro.js";
import { weatherAPI } from "./modules/weather.js";
// Date and Time
setTime();
setInterval(setTime, 1000);
// TODO
TODO_ADD.onclick = function () {
if (TODO_WRITE.value != "") {
formatNewTask(TODO_WRITE.value);
TODO_WRITE.value = "";
TODO_WRITE.focus();
}
};
TODO_WRITE.addEventListener("keydown", (e) => {
if (e.key === "Enter") {
formatNewTask(TODO_WRITE.value);
TODO_WRITE.value = "";
}
});
backupTasks();
// Calendar
document.addEventListener("DOMContentLoaded", function () {
var calendarEl = document.getElementById("calendar");
var calendar = new FullCalendar.Calendar(calendarEl, {
initialView: "dayGridMonth",
});
calendar.render();
});
// Notes
backUpNotes();
NOTES_ADD.addEventListener("click", addNewNote);
// Pomodoro
START_BTN.addEventListener("click", startPomodoro);
PAUSE_BTN.addEventListener("click", pausePomodoro);
RESET_BTN.addEventListener("click", resetPomodoro);
// Weather
weatherAPI();