forked from Aproxia-dev/startpage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
184 lines (175 loc) · 6.47 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
<!DOCTYPE html>
<html lang='en'>
<head>
<title>Ace's Startpage</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🔎</text></svg>">
<meta charset='utf-8'>
<link rel='stylesheet' href='catppuccin.css'>
<script src="https://kit.fontawesome.com/497f4f4907.js" crossorigin="anonymous"></script>
</head>
<body class='flexbox' onload="startTime()">
<div class="mainbox">
<table>
<tr>
<td>
<div id="time" class="time"></div>
<h1 class='title'>Welcome back, <span class='hl'>Ace</span>.</h1>
</td>
<td>
<div class='cat'>
/l、<br>
(⠁、.7<br>
|、 ~ヽ<br>
じしf_,)ノ<br>
</div>
</td>
</tr>
</table>
<nav class='flexbox' style='flex-direction: column;'>
<div class='flexbox' style='flex-direction: row; align-items: flex-start; justify-content: space-evenly; width: 100%'>
<div>
<b>~/media</b>
<ul>
<li><a href='https://tube.cadence.moe/'>/youtube</a></li>
<li><a href='https://open.spotify.com/'>/spotify</a></li>
<li><a href='http://localhost:8096'>/jellyfin</a></li>
</ul>
</div>
<div>
<b>~/dev</b>
<ul>
<li><a href='https://www.github.com/'>/github</a></li>
<li><a href='https://www.stackoverflow.com/'>/stack-overflow</a></li>
</ul>
</div>
<div>
<b>~/school</b>
<ul>
<li><a href="https://www.theodinproject.com/dashboard">/the-odin-project</a></li>
<li><a href='https://www.gmail.com/'>/gmail</a></li>
<li><a href='https://app.notesnook.com'>/notesnook</a></li>
<li><a href='https://mail.proton.me/u/0/inbox'>/protonmail</a></li>
<li><a href='https://chat.openai.com'>/chatgpt</a></li>
</ul>
</div>
<div>
<b>~/misc</b>
<ul>
<li><a href='https://play.pokemonshowdown.com/'>/showdown</a></li>
<li><a href='https://wiki.archlinux.org/'>/archwiki</a></li>
<li><a href='https://fosstodon.org/'>/fosstodon</a></li>
<li><a href='http://127.0.0.1:8384/'>/syncthing</a></li>
<li><a href='https://pairdrop.net/'>/pairdrop</a></li>
</ul>
</div>
</div>
</nav>
<tr>
<td colspan='2'>
<div id="nowPlaying" style="text-align: center; margin-top: 20px;"></div>
</td>
</tr>
<tr>
<td colspan='2'>
<div class='flexbox search'>
<form onsubmit="return searchBrave()" style='width: 80%;'>
<input type="text" placeholder="Search..." id='search_box' autocomplete='false'>
<button type="submit"><i class="fas fa-search"></i></button>
</form>
</div>
<div class='flexbox' style='padding: 15px;'>
<div class='colcir' style='background-color:var(--black); '></div>
<div class='colcir' style='background-color:var(--red); '></div>
<div class='colcir' style='background-color:var(--green); '></div>
<div class='colcir' style='background-color:var(--yellow); '></div>
<div class='colcir' style='background-color:var(--blue); '></div>
<div class='colcir' style='background-color:var(--magenta);'></div>
<div class='colcir' style='background-color:var(--cyan); '></div>
<div class='colcir' style='background-color:var(--fg); '></div>
</div>
</td>
</div>
<script>
function startTime() {
const today = new Date();
let hour = today.getHours();
let ampm = hour >= 12 ? 'PM' : 'AM';
hour = hour % 12 || 12;
let minute = today.getMinutes();
let day = today.getDate();
let month = today.getMonth();
let year = today.getFullYear();
let weekDay = today.getDay();
let weekDays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
let months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
let daySuf = numSuf(day);
minute = checkTime(minute);
document.getElementById('clock').innerHTML = hour + "<span class='hl'>:</span>" + minute + " " + ampm;
document.getElementById('cal').innerHTML = weekDays[weekDay] + ", " + daySuf + " " + months[month] + " " + year;
setTimeout(startTime, 1000);
// Fetch the currently playing song from Last.fm API
fetchLastFmNowPlaying();
}
function numSuf(i) {
if (i > 10 && i < 21) return i + 'th';
switch (i % 10) {
case 1: return i + 'st';
case 2: return i + 'nd';
case 3: return i + 'rd';
default: return i + 'th';
}
}
function checkTime(i) {
if (i < 10) {
i = "0" + i;
}
// add zero in front of numbers < 10
return i;
}
function searchBrave() {
search_term = document.getElementById('search_box').value;
window.location.href = "https://search.brave.com/search?q=" + encodeURI(search_term);
return false;
}
function fetchLastFmNowPlaying() {
// Replace "YOUR_API_KEY" with your actual Last.fm API key
const apiKey = "938b22f905a12a2b19b1bad4feafba20";
// Replace "YOUR_USERNAME" with your Last.fm username
const username = "DestroyerAce";
const url = `https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=${username}&api_key=${apiKey}&format=json&limit=1`;
fetch(url)
.then((response) => response.json())
.then((data) => {
const track = data.recenttracks.track[0];
if (track["@attr"] && track["@attr"].nowplaying === "true") {
const artist = track.artist["#text"];
const song = track.name;
let nowPlaying = `${song} by ${artist}`;
if (nowPlaying.length > 50) {
nowPlaying = nowPlaying.substring(0, 50) + "...";
}
document.getElementById("nowPlaying").innerHTML = nowPlaying;
} else {
document.getElementById("nowPlaying").innerHTML = "";
}
})
.catch((error) => {
console.error("Error fetching Last.fm data:", error);
});
}
function updateClock() {
let date = new Date();
let hours = date.getHours();
let minutes = date.getMinutes();
let ampm = hours >= 12 ? "pm" : "am";
hours = hours % 12;
hours = hours ? hours : 12;
minutes = minutes < 10 ? "0" + minutes : minutes;
let time = hours + ":" + minutes + " " + ampm;
document.getElementById("time").innerHTML = time;
setTimeout(updateClock, 1000);
}
updateClock();
</script>
</body>
</html>