-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProject.html
144 lines (134 loc) · 5.95 KB
/
Project.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="description" content="Bacon_Space's Social's" />
<meta name="keywords" content="Twitch, Wrestling, Bacon_Space" />
<meta name="robots" content="noindex, nofollow" />
<meta name="og:image" content="https://avatars.githubusercontent.com/u/16171045?v=4" id="og-image" />
<meta name="twitter:image" content="https://avatars.githubusercontent.com/u/16171045?v=4" id="twitter-image" />
<title>Bacon_Space</title>
<!-- Include Bootstrap 5.3.0 CSS -->
<link href="https://bootswatch.com/5/vapor/bootstrap.min.css" rel="stylesheet" />
<!-- Include Font Awesome 6.4.2 CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-FJYwNIZOrZoEryj6Oo9VpokExWz9tG+QN/wdoAXTxFImAOoCh4vBuG3AI3fzJWXISL+1RMryU+X1g19WNwEM8g==" crossorigin="anonymous" />
<!-- Custom CSS for styling -->
<link rel="icon" type="image/x-icon" href="default-favicon.ico" id="favicon" />
<style>
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
margin: 0;
padding: 0;
text-align: -webkit-center;
}
header {
background-color: #007bff;
color: #fff;
text-align: center;
padding: 20px 0;
}
h1 {
font-size: 36px;
margin: 10px 0;
}
p {
font-size: 18px;
}
main {
max-width: 800px;
margin: 20px auto;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
footer {
background-color: #007bff;
color: #fff;
text-align: center;
padding: 10px 0;
}
b {
text-align: -webkit-center;
}
</style>
<!-- JavaScript code starts here -->
<script>
// Function to get the current year in the specified timezone
function getCurrentYearInTimeZone(timezone) {
const options = { year: 'numeric', timeZone: timezone };
const formatter = new Intl.DateTimeFormat('en-US', options);
const currentYear = formatter.format(new Date());
return currentYear;
}
// Fetch TheBaconSpace user's avatar and repository creation date from GitHub API
fetch('https://api.github.com/users/TheBaconSpace')
.then(response => response.json())
.then(data => {
// Extract the avatar URL and repository creation date from the API response
const avatarUrl = data.avatar_url;
const repositoryCreatedAt = new Date(data.created_at);
// Update the href attribute of the favicon link
const favicon = document.getElementById('favicon');
favicon.href = avatarUrl;
// Update the current year in the specified timezone
const currentYearElement = document.getElementById('current-year');
const timezone = 'America/Toronto'; // Specify your desired timezone here
const currentYear = getCurrentYearInTimeZone(timezone);
currentYearElement.textContent = `${repositoryCreatedAt.getFullYear()} - ${currentYear}`;
// Fetch and render social links initially
fetchAndRenderSocialLinks();
// Automatically refresh social links every 3 minutes (180,000 milliseconds)
setInterval(fetchAndRenderSocialLinks, 3 * 60 * 1000); // 3 minutes in milliseconds
})
.catch(error => {
console.error('Error fetching data from GitHub:', error);
});
// Function to fetch and render social links
function fetchAndRenderSocialLinks() {
// Fetch the social links from the JSON file (replace with your actual JSON file URL)
fetch("https://thebaconspace.github.io/social_links.json")
.then((response) => response.json())
.then((data) => {
const socialLinksSection = document.getElementById("social-links");
// Clear existing social links
socialLinksSection.innerHTML = '';
// Generate buttons for each social link
data.socialLinks.forEach((link) => {
const socialButton = document.createElement("a");
socialButton.href = link.url;
socialButton.target = "_blank";
socialButton.style.textAlign = "-webkit-center";
socialButton.className = "btn btn-outline-primary mr-2 mb-2"; // Add margin to the right and bottom
// Update this line to show the icon before the text
socialButton.innerHTML = `<i class="${link.icon}"></i> ${link.name}`;
socialLinksSection.appendChild(socialButton);
});
})
.catch((error) => {
console.error("Error loading social links:", error);
});
}
</script>
<!-- JavaScript code ends here -->
</head>
<body>
<header>
<h1>Bacon_Space</h1>
<p>Welcome to my profile!</p>
</header>
<main>
<section id="social-links">
<!-- Social links will be dynamically loaded here -->
</section>
</main>
<footer>
© <span id="current-year"></span> Bacon_Space
</footer>
<!-- Include Bootstrap 5.3.0 JS (Popper.js and Bootstrap JS) -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>