-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
101 lines (81 loc) · 2.87 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
<html>
<head>
<meta name="viewport" content="width=device-width,minimum-scale=1">
<title>0 dias</title>
</head>
<link rel="stylesheet" href="style.css">
<script type ="text/javascript" >
//localStorage.removeItem("recordDate");
//localStorage.setItem("recordDate", new Date("06/2/2023"));
//localStorage.removeItem("recordDays");
//localStorage.setItem("recordDays","0");
if (typeof(Storage) !== "undefined") {
if(localStorage.getItem("recordDays") == null){
resetRecordDays();
}
if(localStorage.getItem("recordDate") == null){
resetRecordDate();
}
} else {
console.log("Sorry, your browser does not support Web Storage...");
}
function showtime() {
var recordDays = ( localStorage.getItem("recordDays") == null ? "0" : localStorage.getItem("recordDays") );
var recordDate = ( localStorage.getItem("recordDate") == null ? new Date() : localStorage.getItem("recordDate") );
var actualDays = getDaysDiff(new Date(recordDate), new Date());
if(actualDays > recordDays){
recordDays = actualDays;
localStorage.setItem("recordDays", recordDays);
localStorage.setItem("recordDate", new Date());
}
document.dateform.days.value = actualDays;
document.dateform.record.value = recordDays;
sleep(60000).then(() => {
location.reload();
showtime();
});
}
function getDaysDiff(date_1, date_2){
let difference = date_1.getTime() - date_2.getTime();
let TotalDays = Math.ceil(difference / (1000 * 3600 * 24));
return Math.abs(TotalDays);
}
function sleep (time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
function resetRecordDate(){
localStorage.setItem("recordDate", new Date());
location.reload();
}
function resetRecordDays(){
localStorage.setItem("recordDays", "0");
location.reload();
}
</script>
<body Onload="showtime()" >
<form name=dateform>
<br>
<a href="" id="a"></a>
<div style="white-space:nowrap;text-align:center;" >
<label for="score" align="center" style="color:white">ESTAMOS TRABALHANDO</label >
<br>
<label for="score" align="center" style="color:white"> HÁ </label >
<input class="center" size="3" type="text" name="days" id="score" disabled>
<label style="color:white" align="center"> DIA(S)</label>
</div>
<div style="white-space:nowrap;text-align:center;" >
<label style="color:white" align="center">SEM BUGS</br></label>
<br>
<label style="color:white" align="center"> NOSSO RECORDE É DE </label>
<input class="center" size="4" type="text" name="record" id="record" disabled>
<label style="color:white" align="center"> DIA(S).</label>
</div>
</form>
<br>
<div style="text-align:center;" >
<label align="center" style="color:white">COLABORE PARA MELHORAR ESTE ÍNDICE</label>
</div>
<button class="botRecord" onclick="resetRecordDays()" >Resetar Record</button-->
<button class="bot" onclick="resetRecordDate()" >Resetar Dias</button>
</body>
</html>