-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
237 lines (170 loc) · 6.25 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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<html>
<meta charset="UTF-8">
<head>
<title></title>
<link rel="stylesheet" href="style.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body id="allBody">
<div class="all">
<div class="catalina">
<img id="BACKGROUND" src="pg/0-5.jpeg">
</div>
<span id="clock"></span>
<p id="dateA">Hello</p>
<span id="weather">
<center>
<img id="weatherIcon" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/162656/04n.svg">
<p>Jacksonville, FL</p>
<p>High: <span id="high"></span> | Low: <span id="low"></span></p>
<p>Feels Like: <span id="feellike"></span></p>
<p>Humidity: <span id="humidity"></span></p>
</center>
</span>
</div>
</body>
<script language="JavaScript" type="text/javascript" src="jquery-1.2.6.min.js"></script>
<script type="text/javascript">
function preventBurn() {
console.log(document.getElementById("allBody").style.filter);
const element = document.querySelector('body')
const style = getComputedStyle(element)
console.log(style.filter);
//document.getElementById("allBody").style.filter = "brightness(0%)";
}
var $burnGuard = $('<div>').attr('id','burnGuard').css({
'background-color':'#FF00FF',
'width':'1px',
'height':$(document).height()+'px',
'position':'absolute',
'top':'0px',
'left':'0px',
'display':'none'
}).appendTo('body');
var colors = ['#FF0000','#00FF00','#0000FF'], color = 0, delay = 50000, scrollDelay = 1000;
function burnGuardAnimate()
{
color = ++color % 3;
var rColor = colors[color];
$burnGuard.css({
'left':'0px',
'background-color':rColor,
}).show().animate({
'left':$(window).width()+'px'
},scrollDelay,function(){
$(this).hide();
});
setTimeout(burnGuardAnimate,delay);
}
setTimeout(burnGuardAnimate,delay);
var months = [ "January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December" ];
var currentTime = new Date().getHours();
console.log(currentTime);
var span = document.getElementById('clock');
function time() {
var currentTime = new Date().getHours();
var d = new Date();
var s = d.getSeconds();
var m = d.getMinutes();
var h = d.getHours();
console.log(h, hour);
if (h > 12){
var hour = Number(h - 12);
}else{
var hour = Number(h);
}
span.textContent = ("" + hour).substr(-2) + ":" + ("0" + m).substr(-2);
// Add this code to the above statement if you want seconds to show.
// + ":" + ("0" + s).substr(-2);
// Change Screen Picture Based on Time of Day
if (0 <= currentTime && currentTime <= 5) {
//document.body.style.backgroundImage = "url('pg/0-5.jpeg')";
document.getElementById('BACKGROUND').innerHTML = 'pg/0-5.jpeg">';
}
else if (6 <= currentTime && currentTime <= 10) {
//document.body.style.backgroundImage = "url('pg/6-8.jpeg')";
document.getElementById('BACKGROUND').src = 'pg/6-10.jpeg';
}
else if (9 <= currentTime && currentTime <= 11) {
//document.body.style.backgroundImage = "url('pg/9-11.jpeg')";
document.getElementById('BACKGROUND').src = 'pg/9-11.jpeg';
}
else if (12 <= currentTime && currentTime <= 14) {
//document.body.style.backgroundImage = "url('pg/12-2.jpeg')";
document.getElementById('BACKGROUND').src = 'pg/12-2.jpeg';
}
else if (15 <= currentTime && currentTime <= 17) {
//document.body.style.backgroundImage = "url(pg/3-5.jpeg')";
document.getElementById('BACKGROUND').src = 'pg/3-5.jpeg';
}
else if (18 <= currentTime && currentTime <= 22) {
//document.body.style.backgroundImage = "url('pg/6-10.jpeg')";
document.getElementById('BACKGROUND').src = 'pg/6-8.jpeg';
}
else if (23 <= currentTime && currentTime <= 24) {
//document.body.style.backgroundImage = "url('pg/11-12.jpeg')";
document.getElementById('BACKGROUND').innerHTML = 'pg/11-12.jpeg';
}
// Change Screen Brightness Based on Time of Day
}
function cToF(celsius)
{
var cTemp = celsius;
var cToFahr = cTemp * 9 / 5 + 32;
var final = Math.round(cToFahr * 10) / 10
var message = final + ' \xB0F.';
return(message);
}
function checkWeather() {
var currentTime = new Date().getHours();
var d = new Date();
// Weekday
var weekday = new Array(7);
weekday[0] = "Sunday";
weekday[1] = "Monday";
weekday[2] = "Tuesday";
weekday[3] = "Wednesday";
weekday[4] = "Thursday";
weekday[5] = "Friday";
weekday[6] = "Saturday";
var month = d.getUTCMonth(); //months from 1-12
var day = d.getUTCDate();
var year = d.getUTCFullYear();
var WeekDay = weekday[d.getDay()];
var Month = months[month]
var configure = WeekDay + " - " + Month + " " + day + " - " + year;
console.log(configure);
document.getElementById('dateA').innerText = configure;
console.log("checking")
function cToF(celsius)
{
var cTemp = celsius;
var cToFahr = cTemp * 9 / 5 + 32;
var final = Math.round(cToFahr * 10) / 10
var message = final + ' \xB0F.';
return(message);
}
const apiKey = "f7d27826040cbfb52b9b78c4e84e0c05";
var inputVal = "jacksonville";
//ajax here
const url = `https://api.openweathermap.org/data/2.5/weather?q=${inputVal}&appid=${apiKey}&units=metric`;
fetch(url)
.then(response => response.json())
.then(data => {
const { main, name, sys, weather } = data;
const icon = `https://s3-us-west-2.amazonaws.com/s.cdpn.io/162656/${
weather[0]["icon"]
}.svg`;
document.getElementById("weatherIcon").src=icon;
document.getElementById('feellike').innerText = cToF(main.feels_like);
document.getElementById('high').innerText = cToF(main.temp_max);
document.getElementById('low').innerText = cToF(main.temp_min);
document.getElementById('humidity').innerText = main.humidity + "%";
})
}
setInterval(time, 1000);
setInterval(checkWeather, 600000);
checkWeather();
</script>
</html>