-
Notifications
You must be signed in to change notification settings - Fork 0
/
plan.html
95 lines (65 loc) · 2.67 KB
/
plan.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Pasajul zilei, Versetul zilei si altele">
<meta name="keywords" content="HTML, CSS, JavaScript">
<meta name="author" content="Cristian Toma">
<title>Hrana Zilnica Lista</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
<script src="./script.js">
</script>
<script>
function setList() {
// Just if on mobile the localstorage must be deleted
// if (localStorage.getItem("plan")) localStorage.clear();
if (!localStorage.getItem("plan")) {
let firstDay = 1640991600000;
let oneDayInMs = 86400000;
firstDay -= oneDayInMs;
let temp = `
<tr>
<th>Data</th>
<th>Dimineata</th>
<th>Seara</th>
</tr>
`;
for (let i = 0; i < 365; i++) {
firstDay += oneDayInMs;
let dat = new Date(firstDay);
let dd = dat.getDate() < 10 ? "0" + dat.getDate() : dat.getDate();
let mont = dat.getMonth() + 1;
let mm = mont < 10 ? "0" + mont : mont;
let dateline = dd + "." + mm;
temp += `
<tr>
<td>${dateline}</td>
<td>${dimi[i]}</td>
<td>${seara[i]}</td>
</tr>
`
}
let list = document.getElementById("customers");
list.innerHTML += temp;
localStorage.setItem("plan", JSON.stringify(list.innerHTML));
} else {
let planFromLS = JSON.parse(localStorage.getItem("plan"));
let list = document.getElementById("customers");
list.innerHTML = "";
list.innerHTML = planFromLS;
}
}
</script>
</head>
<body onload="setList()">
<h2 class="mt-4">Planul Complet de Citire</h2>
<button class="button-37" onclick="window.location.href='./index.html'" role="button"><a href="./index.html">Inapoi
la pagina principala</a></button>
<table id="customers" class="tableT">
</table>
</body>
</html>