-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
167 lines (144 loc) · 4.07 KB
/
index.html
File metadata and controls
167 lines (144 loc) · 4.07 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ART Star Count</title>
<style>
body {
margin: 0;
padding: 0;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
Oxygen, Ubuntu, Cantarell, sans-serif;
}
.container {
text-align: center;
background: white;
padding: 5vw 6vw;
border-radius: 20px;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease;
width: 90vw;
max-width: 1200px;
}
.container:hover {
transform: translateY(-5px);
}
h1 {
color: #2d3748;
font-size: clamp(3rem, 6vw, 5rem);
margin-bottom: 3vh;
font-weight: 600;
}
.star-count {
font-size: clamp(6rem, 12vw, 10rem);
font-weight: 700;
color: #4a5568;
margin: 2vh 0;
display: flex;
align-items: center;
justify-content: center;
gap: 2vw;
}
.star-icon {
color: #f6e05e;
font-size: clamp(5rem, 10vw, 8rem);
}
.loading {
color: #718096;
font-size: clamp(3rem, 6vw, 5rem);
}
.error {
color: #e53e3e;
font-size: clamp(1.5rem, 3vw, 2.5rem);
}
.refresh-info {
color: #718096;
font-size: clamp(1rem, 2vw, 1.5rem);
margin-top: 3vh;
}
.github-link {
margin-top: 2vh;
display: inline-block;
color: #4a5568;
text-decoration: none;
font-size: clamp(1.2rem, 2.5vw, 2rem);
transition: color 0.3s ease;
}
.github-link:hover {
color: #2d3748;
}
@media (orientation: portrait) {
.container {
padding: 8vw;
}
h1 {
font-size: clamp(4rem, 8vw, 6rem);
}
.star-count {
font-size: clamp(8rem, 16vw, 12rem);
}
.star-icon {
font-size: clamp(6rem, 12vw, 10rem);
}
}
</style>
</head>
<body>
<div class="container">
<h1>ART Star Count</h1>
<div class="star-count" id="starCount">
<span class="loading">Loading...</span>
</div>
<a
href="https://github.com/OpenPipe/ART"
target="_blank"
class="github-link"
>
View on GitHub →
</a>
</div>
<script>
const REPO_API_URL = "https://api.github.com/repos/OpenPipe/ART";
async function fetchStarCount() {
const starCountElement = document.getElementById("starCount");
try {
const response = await fetch(REPO_API_URL);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
const stars = data.stargazers_count;
starCountElement.innerHTML = `
<span class="star-icon">⭐</span>
<span>${stars.toLocaleString()}</span>
`;
} catch (error) {
console.error("Error fetching star count:", error);
starCountElement.innerHTML =
'<span class="error">Error loading star count</span>';
}
}
// Function to calculate milliseconds until next hour
function msUntilNextHour() {
const now = new Date();
const nextHour = new Date(now);
nextHour.setHours(now.getHours() + 1, 0, 0, 0);
return nextHour - now;
}
// Fetch on page load
fetchStarCount();
// Set up refresh on the hour
setTimeout(() => {
fetchStarCount(); // Fetch at the first hour mark
// Then set up hourly interval
setInterval(fetchStarCount, 60 * 60 * 1000); // 1 hour in milliseconds
}, msUntilNextHour());
</script>
</body>
</html>