-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
344 lines (303 loc) · 11.6 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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Swightshome</title>
<link rel="icon" href="https://raw.githubusercontent.com/SwightsNotFound/swightshome/main/images/Logonowhite.png" type="image/x-icon">
<style>
/* General body styling */
body {
font-family: 'Roboto', sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f9;
color: #333;
display: flex;
flex-direction: column;
min-height: 100vh;
transition: background-color 0.3s, color 0.3s; /* Smooth transition */
}
/* Dark mode body styling */
body.dark-mode {
background-color: #333;
color: #f4f4f9;
}
/* Topbar styling */
.topbar {
background-color: #2c3e50;
display: flex;
justify-content: center;
align-items: center;
padding: 15px 0;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
position: relative;
transition: background-color 0.3s; /* Smooth transition */
}
/* Dark mode topbar styling */
.topbar.dark-mode {
background-color: #1a252f;
}
/* Styling for the links in the topbar */
.topbar a {
color: white;
text-align: center;
padding: 12px 20px;
text-decoration: none;
font-weight: 500;
text-transform: uppercase;
letter-spacing: 1px;
transition: all 0.3s ease;
}
/* Hover effect for links */
.topbar a:hover {
background-color: #3498db;
color: white;
border-radius: 5px;
}
/* Dark mode toggle button styling */
.dark-mode-toggle {
background: none;
border: none;
color: white;
font-size: 20px;
cursor: pointer;
transition: all 0.3s ease;
position: absolute;
left: 20px;
}
/* Notification bar styling */
.notification-bar {
width: 80%; /* Smaller width */
max-width: 1000px; /* Limit maximum width */
background-color: rgba(52, 152, 219, 0.7); /* Semi-transparent blue */
color: white;
text-align: center;
padding: 10px 0;
font-size: 1rem;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
transition: background-color 0.3s, color 0.3s;
border-radius: 10px; /* Rounded corners */
margin: 20px auto 10px auto; /* Add spacing between notification bars and move down from topbar */
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.notification-bar::before {
content: "ℹ️"; /* Info symbol */
position: absolute;
left: 15px;
font-size: 1.2rem;
}
/* Dark mode notification bar styling */
.notification-bar.dark-mode {
background-color: rgba(41, 128, 185, 0.7); /* Semi-transparent dark blue */
}
/* Main content area */
.content {
max-width: 1000px;
margin: 50px auto;
text-align: center;
padding: 20px;
flex-grow: 1;
position: relative;
}
/* Image container styling */
.image-container {
position: relative;
text-align: center;
color: white;
overflow: hidden;
border-radius: 10px;
}
.image-container img {
width: 100%;
height: auto;
display: block;
}
.centered-text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: rgba(0, 0, 0, 0.5);
padding: 20px;
border-radius: 10px;
font-size: 2rem;
}
.centered-text p {
margin: 0;
}
.small-text {
font-size: 1rem; /* Smaller font size for the second line */
}
/* Typing animation */
.typing {
display: inline-block;
overflow: hidden;
white-space: nowrap;
border-right: 2px solid white; /* Blinking cursor */
animation: blink-caret 0.75s step-end infinite;
}
@keyframes blink-caret {
from, to { border-color: transparent }
50% { border-color: white; }
}
/* Footer Styling */
footer {
background-color: #2c3e50;
color: white;
padding: 20px 0;
text-align: center;
margin-top: auto;
transition: background-color 0.3s; /* Smooth transition */
}
/* Dark mode footer styling */
footer.dark-mode {
background-color: #1a252f;
}
footer a {
color: #3498db;
text-decoration: none;
}
footer a:hover {
text-decoration: underline;
}
/* Flex container for footer links */
.footer-links {
display: flex;
justify-content: center;
align-items: center;
gap: 10px;
}
</style>
</head>
<body>
<!-- Apply dark mode preference immediately -->
<script>
// Utility functions for handling cookies
function setCookie(name, value, days) {
const d = new Date();
d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
const expires = "expires=" + d.toUTCString();
document.cookie = name + "=" + value + ";" + expires + ";path=/";
}
function getCookie(name) {
const cname = name + "=";
const decodedCookie = decodeURIComponent(document.cookie);
const ca = decodedCookie.split(';');
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(cname) == 0) {
return c.substring(cname.length, c.length);
}
}
return "";
}
// Function to apply dark mode based on preference
function applyDarkModePreference() {
const darkModePreference = getCookie("darkMode");
const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)").matches;
if (darkModePreference === "enabled" || (darkModePreference === "" && prefersDarkScheme)) {
document.body.classList.add('dark-mode');
document.getElementById('topbar').classList.add('dark-mode');
document.getElementById('notification-bar-1').classList.add('dark-mode');
document.getElementById('notification-bar-2').classList.add('dark-mode');
document.getElementById('content').classList.add('dark-mode');
document.getElementById('footer').classList.add('dark-mode');
// Set the dark mode toggle button to sun
document.getElementById('darkModeToggle').textContent = '☀️';
} else {
document.getElementById('darkModeToggle').textContent = '🌙';
}
}
// Apply dark mode preference immediately
applyDarkModePreference();
</script>
<!-- Topbar with links -->
<div class="topbar" id="topbar">
<button id="darkModeToggle" class="dark-mode-toggle">🌙</button>
<a href="Services">Services</a>
<a href="Projects">Projects</a>
<a href="Overview">Lists</a>
<a href="Links">Links</a>
<a href="Contact">Contact</a>
</div>
<!-- Notification bars -->
<div class="notification-bar" id="notification-bar-1">
This site is still being developed, things like the dark mode is in beta, expect many pages to not look right if it's on.
</div>
<div class="notification-bar" id="notification-bar-2">
This site does not really support mobile, especially smaller screens, expect things to be broken if you use a phone.
</div>
<!-- Main content -->
<div class="content" id="content">
<div class="image-container">
<img id="random-image" alt="Random Image">
<div class="centered-text">
<p><span id="typing-text-1"></span></p>
<p class="small-text"><span id="typing-text-2"></span></p>
</div>
</div>
</div>
<!-- Footer -->
<footer id="footer">
<p>Hosted using <a href="https://pages.github.com/" role="button">Github Pages</a> and <a href="https://www.cloudflare.com/" role="button">Cloudflare</a>.</p>
<div class="footer-links">
<a href="https://swightshome.xyz/Status" role="button">Status Page</a>
<span>|</span>
<a href="https://github.com/SwightsNotFound/swightshome" role="button">Source Code</a>
<span>|</span>
<a href="Privacy" role="button">Privacy Policy</a>
</div>
</footer>
<script>
// Function to toggle dark mode
function toggleDarkMode() {
const isDarkMode = document.body.classList.toggle('dark-mode');
document.getElementById('topbar').classList.toggle('dark-mode');
document.getElementById('notification-bar-1').classList.toggle('dark-mode');
document.getElementById('notification-bar-2').classList.toggle('dark-mode');
document.getElementById('content').classList.toggle('dark-mode');
document.getElementById('footer').classList.toggle('dark-mode');
// Change the icon of the dark mode toggle button
darkModeToggle.textContent = isDarkMode ? '☀️' : '🌙';
// Set the dark mode preference in a cookie
setCookie("darkMode", isDarkMode ? "enabled" : "disabled", 365);
}
// Attach the toggle function to the dark mode button
const darkModeToggle = document.getElementById('darkModeToggle');
darkModeToggle.addEventListener('click', toggleDarkMode);
// Typing animation function
function typeText(text, elementId, speed, callback) {
const typingElement = document.getElementById(elementId);
let index = 0;
function type() {
if (index < text.length) {
typingElement.textContent += text.charAt(index);
index++;
setTimeout(type, speed); // Adjust typing speed here
} else {
typingElement.classList.remove('typing'); // Remove cursor after typing
if (callback) callback(); // Call the callback function if provided
}
}
typingElement.classList.add('typing'); // Add cursor before typing starts
type();
}
// Typing animation on load
window.onload = function() {
typeText("Welcome to Swightshome!", "typing-text-1", 60, () => {
typeText("A website for things I host.", "typing-text-2", 70);
});
// Set random image
const randomIndex = Math.floor(Math.random() * 100);
document.getElementById('random-image').src = `images/walls/image_${randomIndex}.jpg`;
};
</script>
</body>
</html>