-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
148 lines (138 loc) · 6.67 KB
/
Copy pathindex.html
File metadata and controls
148 lines (138 loc) · 6.67 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Startpage</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="favicon.png">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" type="text/css" media="screen" href="style.css">
</head>
<script src="//instant.page/1.1.0" type="module"
integrity="sha384-EwBObn5QAxP8f09iemwAJljc+sU+eUXeL9vSBw1eNmVarwhKk2F9vBEpaN9rsrtp"></script>
<body>
<div id="search">
<input id="search-field" type="text" name="search-field" onkeypress="return search(event)" />
</div>
<div class="container">
<div id="clock"></div>
<div class="weather-container">
<a href="https://darksky.net/" target="">
<div class="row">
<div id="weather-description" class="inline"></div>
<div class="inline">-</div>
<div id="temp" class="inline"></div>
</div>
</a>
</div>
<div class="bookmark-container">
<div class="bookmark-set">
<div class="bookmark-title">Daily</div>
<div class="bookmark-inner-container">
<a class="bookmark" href="https://gmail.com" target="">Gmail</a>
<a class="bookmark" href="https://reddit.com" target="">Reddit</a>
<a class="bookmark" href="spotify:user:spotify:playlist:37i9dQZF1DXcBWIGoYBM5M"
target="">Spotify</a>
<a class="bookmark" href="https://coronastats.co/" target="">COVID-19</a>
</div>
</div>
<div class="bookmark-set">
<div class="bookmark-title">Media</div>
<div class="bookmark-inner-container">
<a class="bookmark" href="https://youtube.com" target="">Youtube</a>
<a class="bookmark" href="https://www.netflix.com/" target="">Netflix</a>
<a class="bookmark" href="https://www.crunchyroll.com/" target="">Crunchy Roll</a>
<a class="bookmark" href="http://app.emby.media/#!/home" target="">Emby</a>
</div>
</div>
<div class="bookmark-set">
<div class="bookmark-title">School</div>
<div class="bookmark-inner-container">
<a class="bookmark" href="https://mail.google.com/mail/u/1/#inbox" target="">Gmail</a>
<a class="bookmark" href="https://classroom.google.com/u/1/h" target="">Classroom</a>
<a class="bookmark" href="https://drive.google.com/u/1" target="">Drive</a>
<a class="bookmark" href="https://parents.sbschools.org/genesis/parents" target="">Genesis</a>
</div>
</div>
</div>
</div>
<script>
// Search on enter key event
function search(e) {
if (e.keyCode == 13) {
var val = document.getElementById("search-field").value;
window.open("https://duckduckgo.com/" + val);
}
}
// Get current time and format
function getTime() {
var dt = new Date();
dt.setTime(dt.getTime() + dt.getTimezoneOffset() * 60 * 1000);
var offset = -300;
var date = new Date(dt.getTime() + offset * 60 * 1000),
min = date.getMinutes(),
sec = date.getSeconds(),
hour = date.getHours();
// 12 hour format
hour = (date.getHours() + 1) % 12 || 12
return "" +
(hour < 10 ? ("0" + hour) : hour) + ":" +
(min < 10 ? ("0" + min) : min) + ":" +
(sec < 10 ? ("0" + sec) : sec);
}
function weatherToggle() {
if (document.getElementById("temp").innerHTML.slice(-1) == H)
document.getElementById("temp").innerHTML = Math.round(json.currently.temperature) + " F";
else
document.getElementById("temp").innerHTML = Math.round(json.currently.windSpeed) + " MPH";
}
window.onload = () => {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var lat = position.coords.latitude;
var lng = position.coords.longitude;
var xhr = new XMLHttpRequest();
// Request to weather api
xhr.open("GET",
"https://cors-anywhere.herokuapp.com/https://api.darksky.net/forecast/a8ee06a53ce08e3ae1668ca25de41b09/" +
lat + "," + lng + "?units=us&exclude=minutely,hourly,daily,flags", true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onload = () => {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
let json = JSON.parse(xhr.responseText);
console.log(json);
document.getElementById("temp").innerHTML = Math.round(json.currently
.temperature) + " F";
document.getElementById("weather-description").innerHTML = json
.currently.summary;
} else {
console.log('error msg: ' + xhr.status);
}
}
}
xhr.send(null);
// Set up the clock
document.getElementById("clock").innerHTML = getTime();
// Set clock interval to tick clock
setInterval(() => {
document.getElementById("clock").innerHTML = getTime();
}, 100);
});
}
}
document.addEventListener("keydown", event => {
if (event.keyCode == 32) { // Spacebar code to open search
document.getElementById('search').style.display = 'flex';
document.getElementById('search-field').focus();
} else if (event.keyCode == 27) { // Esc to close search
document.getElementById('search-field').value = '';
document.getElementById('search-field').blur();
document.getElementById('search').style.display = 'none';
}
});
</script>
</body>
</html>