-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv2.js
More file actions
115 lines (114 loc) · 3.3 KB
/
Copy pathv2.js
File metadata and controls
115 lines (114 loc) · 3.3 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
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
var btn = document.getElementById("check")
var bg = document.getElementById("body")
var image =document.querySelector(".img2")
var navbarh1 =document.getElementById("navh1")
var themeh1 =document.getElementById("themeh1")
var navbar =document.querySelector(".narbar")
var acnigth=document.querySelector(".acnigth")
var lightnight = document.querySelector(".lightnight")
btn.addEventListener("change",function(event){
if(this.checked){
image.style.display="block"
themeh1.textContent="Night"
acnigth.style.display="block"
acnigth.style.opacity="0.4"
lightnight.style.display="block"
lightday.style.display="none"
}
else{
image.style.display="none"
themeh1.textContent="Day"
acnigth.style.display="none"
lightnight.style.display="none"
lightday.style.display="block"
}
})
var acbtn =document.getElementById("Ac-check")
var aconimg=document.querySelector(".ac-on")
var acoff=document.querySelector(".Ac")
var acname=document.querySelector(".acname")
var acoffsvg=document.querySelector(".ac-off2")
var temp=document.getElementById("hometemp")
var divtemp=document.querySelector(".temp")
acbtn.addEventListener("change",function(event){
if(this.checked)
{
aconimg.style.display="block"
acoff.style.display="none"
divtemp.style.background="linear-gradient(180deg,white,rgba(131, 196, 212, 0.87))"
temp.textContent="Home temperature 22'C"
}
else
{
aconimg.style.display="none"
acoff.style.display="block"
divtemp.style.background="linear-gradient(180deg,white,rgba(255, 129, 129, 0.87))"
temp.textContent="Home temperature 33'C"
}
})
var date = new Date();
const todaydate = document.getElementById("Date")
const todaytime = document.getElementById("time")
const todayday = document.getElementById("Day")
const noofday = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
function printDate()
{
var date = new Date();
var day = date.getDate();
var month= date.getMonth()+1;
var year = date.getFullYear();
todaydate.innerHTML= day + "/" + month + "/" + year;
}
printDate();
function printDay(){
var date = new Date();
var today = date.getDay();
var day = noofday[today];
todayday.innerHTML=day;
}
printDay();
function printtime(){
var date = new Date();
var hour = date.getHours();
var min = date.getMinutes();
var sec = date.getSeconds();
var period = "AM";
if(hour == 0){
hour=12;
}
if (hour>12)
{
hour=hour-12;
period="PM";
}
if(hour < 10)
{
hour = "0"+ hour;
}
if(min < 10){
min = "0"+min;
}
if(sec < 10){
sec = "0" + sec;
}
var time = hour + ":" + min + ":" + sec + " " + period;
document.getElementById("time").innerHTML=time;
setTimeout(printtime,1000);
}
printtime();
var lightday = document.querySelector(".lightday")
var lightglow = document.querySelector(".lightglow")
var lighton = document.getElementById("lighton")
lighton.addEventListener("change",function(event)
{
if(this.checked)
{
lightglow.style.display="inline-block"
lightday.style.display="none"
}
else
{
lightglow.style.display="none"
lightday.style.display="inline-block"
}
})