-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
131 lines (100 loc) · 3.53 KB
/
script.js
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
let moon = document.getElementsByClassName( "fa-moon" )[0];
let calculatorContanier = document.getElementsByClassName( "calculator" )[0];
let iconsHolder = document.getElementsByClassName( "body_Upper" )[0];
let sun = document.getElementsByClassName( "fa-sun" )[0];
let footer_border = document.getElementsByClassName( "row_6" )[0];
let h2 = document.querySelectorAll( "h2" ).forEach( element => {
element.style.color = "white";
} );
let outuput = document.getElementById( 'inputText' );
let dateAndTime = new Date();
let timeHolder = document.getElementById( 'time' );
function showTime(){
var date = new Date();
var h = date.getHours(); // 0 - 23
var m = date.getMinutes(); // 0 - 59
var s = date.getSeconds(); // 0 - 59
var session = "AM";
if(h == 0){
h = 12;
}
if(h > 12){
h = h - 12;
session = "PM";
}
h = (h < 10) ? "0" + h : h;
m = (m < 10) ? "0" + m : m;
s = (s < 10) ? "0" + s : s;
var time = h + ":" + m + ":" + s + " " + session;
document.getElementById("time").innerText = time;
document.getElementById("time").textContent = time;
timeHolder.style.color="#F1BB00";
timeHolder.style.fontWeight="bold";
setTimeout(showTime, 1000);
}
showTime();
let calculate = ( number ) => {
// outuput.style.color="white";
outuput.value = outuput.value + number;
outuput.style.color = "orange";
outuput.style.transition = "all 0.5s ease 0s";
}
let result = () => {
try {
outuput.value = eval( outuput.value );
}
catch ( err ) {
alert( "Add Valid Input" );
}
}
let clr = () => {
outuput.value = " ";
}
let del = () => {
outuput.value = outuput.value.slice( 0, -1 );
}
moon.addEventListener( "click", turnLightMoon = () => {
moon.style.color = "#000";
sun.style.color = "#000";
iconsHolder.style.background = "#fff";
iconsHolder.style.borderRadius = "2px 2px 2px 2px rgba(0,0,0,0.25)";
sun.style.cursor = "pointer";
moon.style.cursor = "pointer";
calculatorContanier.style.background = '#fff';
footer_border.style.background = "#000";
calculatorContanier.style.transition = "all 0.9s ease 0s";
let icons = document.querySelectorAll( "i" ).forEach( icon => {
icon.style.color = "#000";
} );
let buttons = document.querySelectorAll( "button" ).forEach( ( button ) => {
button.style.background = "#fff";
button.style.color = "#000";
} );
let parargrpah = document.querySelectorAll( "p" ).forEach( element => {
element.style.color = "black";
} );
let h2 = document.querySelectorAll( "h2" ).forEach( element => {
element.style.color = "black";
} );
} );
sun.addEventListener( "click", turnLightSun = () => {
iconsHolder.style.background = "#292D36";
moon.style.color = "#fff";
sun.style.color = "#fff";
calculatorContanier.style.background = '#292D36';
footer_border.style.background = "white";
calculatorContanier.style.transition = "all 0.9s ease 0s";
let icons = document.querySelectorAll( "i" ).forEach( icon => {
icon.style.color = "white";
} );
let buttons = document.querySelectorAll( "button" ).forEach( ( button ) => {
button.style.background = "#292D36";
button.style.color = "#fff";
} );
let parargrpah = document.querySelectorAll( "p" ).forEach( element => {
element.style.color = "#fff";
} );
let h2 = document.querySelectorAll( "h2" ).forEach( element => {
element.style.color = "white";
} );
} );