-
Notifications
You must be signed in to change notification settings - Fork 0
/
officers.html
391 lines (369 loc) · 14.6 KB
/
officers.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
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<meta name="theme-color" content="#71a598" />
<meta
name="description"
content="The Official Website for the Japanese Language and Culture Club at the University of Houston"
/>
<meta property="og:title" content="UH Japanese Language and Culture Club" />
<meta property="og:type" content="website" />
<meta
property="og:image"
content="https://www.jlcc-uh.org/img/JLCC-Landing-Banner-New.png"
/>
<meta property="og:url" content="https://www.jlcc-uh.org" />
<meta
property="og:description"
content="The Official Website for the Japanese Language and Culture Club at the University of Houston"
/>
<title>Officers | UH Japanese Language and Culture Club</title>
<link rel="icon" href="./public/favicon.ico" type="image/x-icon" />
<link rel="apple-touch-icon" href="./public/logo192.png" />
<link rel="manifest" href="./public/manifest.json" />
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="officers-style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="officerList.js"></script>
<!-- Google tag (gtag.js) -->
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-NHFFQ4KL74"
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "G-NHFFQ4KL74");
</script>
</head>
<body>
<!-- Header -->
<secion id="header">
<div class="header container">
<div class="nav-bar">
<div class="brand">
<a href="/">
<img src="./public/logo192.png" />
</a>
<a href="/">
<img
class="banner-text"
src="./img/JLCC-UH-Banner-Text-2023-v2.png"
/>
</a>
</div>
<div class="nav-list">
<div class="hamburger">
<div class="bar"></div>
</div>
<ul>
<li><a href="/#about" data-after="About">About</a></li>
<li><a href="/#events" data-after="Events">Events</a></li>
<li>
<a
href="#officers"
data-after="Officers"
style="
color: #f7a088;
font-weight: 600;
background-color: rgba(0, 0, 0, 15%);
"
>Officers</a
>
</li>
<li>
<a href="/#membership" data-after="Membership">Membership</a>
</li>
<li>
<a href="/#community" data-after="Community">Community</a>
</li>
</ul>
</div>
</div>
</div>
</secion>
<!-- End of Header -->
<!-- Hero Section -->
<section id="hero">
<div class="hero container"></div>
</section>
<!-- End of Hero Section -->
<!-- Officers Section -->
<section id="officers">
<div class="officers container">
<script>
var officersContainer =
document.getElementsByClassName("officers container");
officersContainer[0].innerHTML = `<h1 class="events-loading">LOADING OFFICERS...</h1>`;
const API_KEY = "AIzaSyB--kBZheOdXiaXSmRaLzLDZ_nXQRs1crY";
const OFFICER_SHEET_ID =
"1jb5jnUxogVqEqsCCdd0AQQwhgCaiF-LV_vY-9Krm_dk";
fetch(
`https://sheets.googleapis.com/v4/spreadsheets/${OFFICER_SHEET_ID}?fields=sheets.properties.title&key=${API_KEY}`
)
.then(function (response) {
if (!response.ok) {
throw new Error(
`Error fetching sheet names: ${response.status} ${response.statusText}`
);
return;
}
officersContainer[0].innerHTML = "";
return response.json();
})
.then(function (data) {
const sheetNames = data.sheets.map(
(sheet) => sheet.properties.title
);
const officersHTML = {};
// Remove Fall 2022 Sheet due to legacy formatting (manual formatting below)
// sheetNames.splice(sheetNames.indexOf("Fall 2022 Officers"), 1);
function seasonSort(a, b) {
// The string "Officers" is always first
if (a === "Officers") return -1;
if (b === "Officers") return 1;
// Extract year and season from the strings
const [aSeason, aYear] = a
.match(/(Spring|Fall) (\d{4})/)
.slice(1);
const [bSeason, bYear] = b
.match(/(Spring|Fall) (\d{4})/)
.slice(1);
// Sort by year descending
const yearComparison = parseInt(bYear) - parseInt(aYear);
// Sort by season (Fall before Spring)
const seasonComparison =
aSeason === "Fall" && bSeason === "Spring"
? -1
: aSeason === "Spring" && bSeason === "Fall"
? 1
: 0;
// If years are the same, sort by season
if (yearComparison === 0) {
return seasonComparison;
}
// Otherwise, sort by year
return yearComparison;
}
sheetNames.sort(seasonSort);
console.log("Sheet names:", sheetNames);
sheetNames.forEach((sheetName) => {
fetch(
`https://sheets.googleapis.com/v4/spreadsheets/${OFFICER_SHEET_ID}/values/${sheetName}!A2:I20?key=${API_KEY}`
)
.then((response) => response.json())
.then((data) => {
console.log(`Data from sheet "${sheetName}":`, data);
if (sheetName === "Fall 2022 Officers") {
result = `<div class="officers-list">`;
resultLg = `<div class="officers-list lg">`;
// console.log(data);
// console.log(data.values);
// console.log(data.values[0]);
data.values.map((entry) => {
entry[2]
? (resultLg += `
<div class="officers-item lg">
<div class="officers-img-background">
<div class="officers-img lg">
<img class="officer-pic lg" src=${
entry[3]
} referrerPolicy="no-referrer" alt="${
entry[0]
}" onerror="this.src='./img/placeholderOfficer.png'">
</div>
</div>
<div class="officers-info lg">
<h1>${entry[0]}: ${entry[1]}</h1>
<p>${entry[2]}</p>
<div class="officers-socials lg">
${
entry[4]
? `<a target="_blank" href=${entry[4]}><img src="./img/JLCC-Instagram.png" alt="${entry[0]}'s Instagram" /></a>`
: ``
}
${
entry[7]
? `<a target="_blank" href=${entry[7]}><img src="./img/JLCC-LinkedIn.png" alt="${entry[0]}'s LinkedIn" /></a>`
: ``
}
</div>
</div>
</div>
`)
: (result += `
<div class="officers-item">
<div class="officers-img">
<div class="officers-img-top">
${
entry[4]
? `<a target="_blank" href=${entry[4]}><img src="./img/JLCC-Instagram.png" alt="${entry[0]}'s Instagram" /></a>`
: ``
}
${
entry[7]
? `<a target="_blank" href=${entry[7]}><img src="./img/JLCC-LinkedIn.png" alt="${entry[0]}'s LinkedIn" /></a>`
: ``
}
</div>
<img class="officer-pic" src=${entry[3]} referrerPolicy="no-referrer" alt="${
entry[0]
}" onerror="this.src='./img/placeholderOfficer.png'">
</div>
<div class="officers-info">
<h1>${entry[0]}</h1>
<h2>${entry[1]}</h2>
</div>
</div>
`);
});
} else {
result = `<div class="officers-list">`;
resultLg = `<div class="officers-list lg">`;
data.values.map((entry) => {
entry[3]
? (resultLg += `
<div class="officers-item lg">
<div class="officers-img-background">
<div class="officers-img lg">
<img class="officer-pic lg" src=${
entry[4]
} referrerPolicy="no-referrer" alt="${
entry[0]
}" onerror="this.src='./img/placeholderOfficer.png'">
</div>
</div>
<div class="officers-info lg">
<h1>${entry[0]}
${entry[1] ? `(${entry[1]})` : ``}
: ${entry[2]}
</h1>
<p>${entry[3]}</p>
<div class="officers-socials lg">
${
entry[5]
? `<a target="_blank" href=${entry[5]}><img src="./img/JLCC-Instagram.png" alt="${entry[0]}'s Instagram" /></a>`
: ``
}
${
entry[7]
? `<a target="_blank" href="https://discord.com/users/${entry[7]}""><img src="./img/JLCC-Discord-Alt.png" alt="${entry[0]}'s Discord" /></a>`
: ``
}
${
entry[8]
? `<a target="_blank" href=${entry[8]}><img src="./img/JLCC-LinkedIn.png" alt="${entry[0]}'s LinkedIn" /></a>`
: ``
}
</div>
</div>
</div>
`)
: (result += `
<div class="officers-item">
<div class="officers-img">
<div class="officers-img-top">
${
entry[5]
? `<a target="_blank" href=${entry[5]}><img src="./img/JLCC-Instagram.png" alt="${entry[0]}'s Instagram" /></a>`
: ``
}
${
entry[7]
? `<a target="_blank" href="https://discord.com/users/${entry[7]}""><img src="./img/JLCC-Discord-Alt.png" alt="${entry[0]}'s Discord" /></a>`
: ``
}
${
entry[8]
? `<a target="_blank" href=${entry[8]}><img src="./img/JLCC-LinkedIn.png" alt="${entry[0]}'s LinkedIn" /></a>`
: ``
}
</div>
<img class="officer-pic" src=${
entry[4]
} referrerPolicy="no-referrer" alt="${
entry[0]
}" onerror="this.src='./img/placeholderOfficer.png'">
</div>
<div class="officers-info">
<h1>${entry[0]}</h1>
<h2>${entry[2]}</h2>
</div>
</div>
`);
});
}
officersHTML[sheetName] = `<div class="officers-top">
<h1 class="section-title">${
sheetName !== "Officers" ? sheetName : "Meet The Officers"
}</h1>
</div>
<div class="officers-bottom ${sheetName}">
${resultLg != `<div class="officers-list lg">` ? resultLg : ``}
${result != `<div class="officers-list">` ? result : ``}
</div>`;
})
.catch((error) => {
console.error(
`Error fetching data from sheet "${sheetName}":`,
error
);
});
});
// Wait for all sheets to be fetched before rendering, wait another 100ms if any are undefined
const renderOfficers = () => {
if (Object.keys(officersHTML).length !== sheetNames.length) {
setTimeout(renderOfficers, 100);
return;
}
sheetNames.forEach((sheetName) => {
officersContainer[0].innerHTML += officersHTML[sheetName];
});
};
renderOfficers();
});
</script>
</div>
</section>
<!-- End of Officers Section -->
<!-- Footer Section -->
<section id="footer">
<div class="footer container">
<div class="brand">
<a href="/">
<img src="./public/logo192.png" />
</a>
<a href="/">
<img
class="banner-text"
src="./img/JLCC-UH-Banner-Text-2023-v2.png"
/>
</a>
</div>
<h2>Japanese Language and Culture Club, University of Houston</h2>
<div class="social-icon">
<!-- <div class="social-item"> <a href="https://www.instagram.com/jlccuh/"> <img src="./img/JLCC-Instagram.png"
alt="JLCC UH Instagram"></a></div> -->
<div class="social-item">
<a href="mailto:[email protected]">
<img src="./img/JLCC-Mail.png" alt="Email JLCC UH"
/></a>
</div>
</div>
<p>
Created by
<a href="https://mitchellsharma.com/?utm_source=jlcc-uh"
>Mitchell Sharma</a
>
in 2023.
</p>
</div>
</section>
<!-- End of Footer Section -->
<script src="script.js"></script>
</body>
</html>