forked from PSLmodels/PSL-Infrastructure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
310 lines (288 loc) · 9.71 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
<!doctype html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8" />
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta content="summary" name="twitter:card" />
<meta
content="http://pslmodels.org/imgs/PolicySimLibrary-1000px.png"
name="twitter:image"
/>
<meta content="Catalog" name="twitter:title" />
<title>PSL</title>
<link rel="preload" href="/layout/navbar.html" as="fetch" crossorigin="anonymous">
<link rel="preload" href="/layout/footer.html" as="fetch" crossorigin="anonymous">
<script
async=""
src="https://www.googletagmanager.com/gtag/js?id=UA-128365658-1"
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "UA-128365658-1");
</script>
<link
crossorigin="anonymous"
href="https://use.fontawesome.com/releases/v5.5.0/css/all.css"
integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap"
rel="stylesheet"
/>
<link
crossorigin="anonymous"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
rel="stylesheet"
/>
<link
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
/>
<link
rel="stylesheet"
type="text/css"
href="https://cdn.jsdelivr.net/npm/[email protected]/slick/slick.css"
/>
<link
rel="stylesheet"
type="text/css"
href="https://cdn.jsdelivr.net/npm/[email protected]/slick/slick-theme.css"
/>
<link href="./CSS/catalog.css" rel="stylesheet" />
</head>
<body id="page">
<div id="navbar"></div>
<div style="text-align: center; padding: 20px">
<img
src="../imgs/PSL.svg"
alt="PSL Logo"
class="img-fluid"
style="width: auto; height: 350px"
/>
</div>
<div class="custom-section">
<div class="box">
<a href="./about.html" style="color: inherit; text-decoration: none">
<i class="fas fa-info-circle"></i>
<h3>About</h3>
<p>
PSL is a collection of open-source models and data preparation
routines for policy analysis. Learn more about our organization and
our mission.
</p>
</a>
</div>
<div class="box">
<a
href="./Catalog/index.html"
style="color: inherit; text-decoration: none"
>
<i class="fas fa-book"></i>
<h3>Models Catalog</h3>
<p>
We have a collection of open-source models and data preparation
routines for policy analysis. Explore the various models and tools
we offer.
</p>
</a>
</div>
<div class="box">
<a
href="./Community/contribute.html"
style="color: inherit; text-decoration: none"
>
<i class="fas fa-hands-helping"></i>
<h3>Collaborate</h3>
<p>
PSL is developed by a community of technical contributors. Learn how
to contribute to library projects or add a new project to the
library. Find out how you can contribute and be a part of our
community.
</p>
</a>
</div>
</div>
<div class="carousel-container">
<h2>Featured Users:</h2>
<div id="userCarousel" class="slick-slider"></div>
</div>
<div class="carousel-container">
<h2>Latest Pull Requests:</h2>
<div id="prCarousel" class="slick-slider"></div>
</div>
<div id="footer"></div>
</body>
<script>
document.addEventListener("DOMContentLoaded", function () {
fetch('/layout/navbar.html')
.then(response => response.text())
.then(data => {
document.getElementById('navbar').innerHTML = data;
});
fetch('/layout/footer.html')
.then(response => response.text())
.then(data => {
document.getElementById('footer').innerHTML = data;
});
fetch("Catalog/prs.json")
.then((response) => response.json())
.then((repos) => {
const prCards = [];
for (const [repoName, prs] of Object.entries(repos)) {
for (const pr of prs) {
const createdAt = new Date(pr.created_at);
prCards.push({
repoName,
prTitle: pr.title,
createdAt,
html_url: pr.html_url,
img: pr.base.user.avatar_url,
});
}
}
const sortedPrCards = prCards.sort((a, b) => {
return new Date(b.createdAt) - new Date(a.createdAt);
});
const carousel = document.getElementById("prCarousel");
let carouselHtml = "";
for (const prCard of sortedPrCards) {
carouselHtml += `
<div class="carousel-item">
<img src="${prCard.img} Logo" alt="${
prCard.repoName
} Logo" class="repo-logo">
<div class="text-content">
<h3 class="repo-title">${prCard.repoName}:</h3>
<h4 class="pr-title">${prCard.prTitle}</h4>
<p class="pr-time">${prCard.createdAt.toLocaleDateString()}</p>
<a href="${
prCard.html_url
}" target="_blank" class="pr-link-button">View PR</a>
</div>
</div>
`;
}
carousel.innerHTML = carouselHtml;
$("#prCarousel").slick({
slidesToShow: 3,
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 1,
speed: 8000,
infinite: true,
cssEase: "linear",
adaptiveHeight: true,
responsive: [
{
breakpoint: 1200,
settings: {
slidesToShow: 2,
slidesToScroll: 1,
infinite: true,
autoplaySpeed: 1,
speed: 8000,
infinite: true,
cssEase: "linear",
adaptiveHeight: true,
},
},
],
});
})
.catch((error) => console.error("Error loading PR data:", error));
function shuffle(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]]; // ES6 destructuring assignment for swapping
}
return array;
}
fetch("users.json")
.then((response) => response.json())
.then((data) => {
const logoCards = [];
for (const [category, users] of Object.entries(data)) {
for (const user of users) {
logoCards.push({
name: user.name,
image: user.image,
link: user.link, // Assuming each user object has a 'link' property
});
}
}
const sortedLogoCards = shuffle(logoCards);
const logoCarousel = document.getElementById("userCarousel");
let carouselHtml = "";
for (const logoCard of sortedLogoCards) {
carouselHtml += `
<div class="carousel-item">
<a href="${logoCard.link}" target="_blank">
<img src="${logoCard.image}" alt="${logoCard.name} Logo" class="logo-img">
<br>
<p class="logo-name">${logoCard.name}</p>
</a>
</div>
`;
}
logoCarousel.innerHTML = carouselHtml;
// Initialize carousel (example using Slick Carousel as in your PR carousel)
$("#userCarousel").slick({
slidesToShow: 3,
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 1,
speed: 5000,
infinite: true,
cssEase: "linear",
adaptiveHeight: false,
variableWidth: true,
responsive: [
{
breakpoint: 1200,
settings: {
slidesToShow: 2,
slidesToScroll: 1,
infinite: true,
autoplaySpeed: 1,
speed: 8000,
infinite: true,
cssEase: "linear",
adaptiveHeight: true,
},
},
],
});
})
.catch((error) => console.error("Error loading user data:", error));
});
</script>
<script
crossorigin="anonymous"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
></script>
<script
type="text/javascript"
src="https://cdn.jsdelivr.net/npm/[email protected]/slick/slick.min.js"
></script>
<script
crossorigin="anonymous"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
></script>
<script
crossorigin="anonymous"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
></script>
</html>