Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
345 lines (326 loc) · 13.3 KB
/
Copy pathindex.html
File metadata and controls
345 lines (326 loc) · 13.3 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
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Dataverse Talks</title>
<style>
:root {
--bg: #ffffff; --fg: #1f2328; --muted: #656d76; --line: #d8dee4;
--link: #0969da; --chip: #f6f8fa;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #0d1117; --fg: #e6edf3; --muted: #8d96a0; --line: #30363d;
--link: #4493f8; --chip: #161b22;
}
}
* { box-sizing: border-box; }
body {
margin: 0; background: var(--bg); color: var(--fg);
font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
main { max-width: 900px; margin: 0 auto; padding: 32px 16px 64px; }
h1 { margin: 0 0 4px; font-size: 1.8rem; }
.intro { margin: 0 0 20px; color: var(--muted); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
input[type=search] {
width: 100%; padding: 10px 12px; font: inherit; color: var(--fg);
background: var(--chip); border: 1px solid var(--line); border-radius: 8px;
}
.count { margin: 8px 0 24px; color: var(--muted); font-size: 0.9rem; }
h2 {
margin: 32px 0 0; padding-bottom: 4px; font-size: 1.2rem;
border-bottom: 1px solid var(--line);
}
ul { list-style: none; margin: 0; padding: 0; }
li { display: grid; grid-template-columns: 6.5em 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.date { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.title { font-weight: 600; }
.meta { color: var(--muted); font-size: 0.9rem; }
.tag {
display: inline-block; margin-left: 6px; padding: 0 6px; font-size: 0.75rem;
border: 1px solid var(--line); border-radius: 10px; background: var(--chip);
vertical-align: middle; font-weight: normal; color: var(--muted);
}
nav { display: flex; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
nav a {
padding: 6px 12px; color: var(--muted); border-bottom: 2px solid transparent;
margin-bottom: -1px;
}
nav a:hover { text-decoration: none; color: var(--fg); }
nav a[aria-current] { color: var(--fg); border-bottom-color: var(--link); font-weight: 600; }
.meta a { color: inherit; }
.meta a:hover { color: var(--link); }
.filter { margin: 0 0 12px; display: flex; align-items: center; gap: 14px; }
.filter[hidden] { display: none; }
.avatar.large { width: 64px; height: 64px; flex: none; font-size: 1.35rem; }
.filter strong { font-size: 1.2rem; }
li.speaker { grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; column-gap: 14px; }
.avatar {
width: 48px; height: 48px; border-radius: 50%; object-fit: cover;
background: var(--chip); border: 1px solid var(--line);
}
.avatar.initials {
display: flex; align-items: center; justify-content: center; border: 0;
color: #fff; font-weight: 600; font-size: 1.05rem; letter-spacing: 0.02em;
}
.who { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; }
.who > .handle, .who > .years { margin-left: 0; }
.who { min-width: 0; }
.who > .handle { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.n { font-variant-numeric: tabular-nums; font-weight: 600; }
.years { color: var(--muted); font-size: 0.9rem; margin-left: 8px; white-space: nowrap; }
.handle { margin-left: 8px; font-size: 0.9rem; white-space: nowrap; }
.n { white-space: nowrap; }
/* Talks: a grid of cards per year, first-slide image on top. */
main.wide { max-width: 1180px; }
ul.cards {
display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 28px 20px; padding-top: 16px;
}
li.talk { display: flex; flex-direction: column; gap: 8px; padding: 0; border: 0; min-width: 0; }
.thumb {
display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 8px;
border: 1px solid var(--line); background: var(--chip);
transition: transform 0.15s ease, box-shadow 0.15s ease;
}
a.thumb:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); }
.thumb img {
display: block; width: 100%; height: 100%;
object-fit: cover; object-position: top; /* 4:3 slides and posters show their top */
}
.thumb.placeholder {
display: flex; align-items: center; justify-content: center; padding: 16px;
text-align: center; color: var(--muted); font-size: 0.95rem; line-height: 1.3;
}
.thumb.placeholder span {
display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
li.talk .title { font-size: 1.02rem; line-height: 1.35; }
li.talk .meta { line-height: 1.4; }
li.talk .when { font-variant-numeric: tabular-nums; margin-top: 2px; }
@media (max-width: 520px) {
li { grid-template-columns: 1fr; gap: 2px; }
ul.cards { grid-template-columns: 1fr; gap: 24px; }
li.speaker { grid-template-columns: 48px minmax(0, 1fr) auto; }
}
</style>
</head>
<body>
<main>
<h1>Dataverse Talks</h1>
<p class="intro">Talks about <a href="https://dataverse.org">Dataverse</a>, newest first. Recordings are on <a href="https://github.com/IQSS/dataverse-tv">DataverseTV</a>. Missing a talk? <a href="https://github.com/gdcc/talks.dataverse.org">Let us know</a>.</p>
<nav>
<a href="#/" id="nav-talks">Talks</a>
<a href="#/speakers" id="nav-speakers">Speakers</a>
</nav>
<div id="filter" class="filter" hidden></div>
<input type="search" id="q" aria-label="Search">
<p class="count" id="count">Loading…</p>
<div id="list"></div>
</main>
<script>
const list = document.getElementById("list");
const count = document.getElementById("count");
const filter = document.getElementById("filter");
const q = document.getElementById("q");
let talks = [];
let speakers = [];
let people = {}; // speaker name -> GitHub username on people.dataverse.org
// "@username", linked to the person's page on people.dataverse.org.
function handle(name) {
const user = people[name];
if (!user) return "";
const a = el("a", "handle", "@" + user);
a.href = "https://people.dataverse.org/" + encodeURIComponent(user);
a.title = `${name} on Dataverse People`;
return a;
}
function el(tag, cls, text) {
const e = document.createElement(tag);
if (cls) e.className = cls;
if (text) e.textContent = text;
return e;
}
const speakerHref = name => "#/speaker/" + encodeURIComponent(name);
function plural(n, word) {
return `${n} ${word}${n === 1 ? "" : "s"}`;
}
// Which view the URL asks for: all talks, the speaker list, or one speaker's talks.
function route() {
const h = location.hash;
if (h === "#/speakers") return { view: "speakers" };
if (h.startsWith("#/speaker/")) {
return { view: "talks", speaker: decodeURIComponent(h.slice("#/speaker/".length)) };
}
return { view: "talks" };
}
function matches(text) {
const words = q.value.toLowerCase().split(/\s+/).filter(Boolean);
return words.every(w => text.includes(w));
}
function renderTalks(speaker) {
let pool = talks;
filter.hidden = !speaker;
if (speaker) {
pool = talks.filter(t => t.speakers.includes(speaker));
const all = el("a", "", "All talks");
all.href = "#/";
const pic = avatar(speaker);
pic.classList.add("large");
const text = el("div");
text.append(el("strong", "", speaker), handle(speaker), " · ", plural(pool.length, "talk"), " · ", all);
filter.replaceChildren(pic, text);
}
const shown = pool.filter(t => matches(t._text));
count.textContent = `${shown.length} of ${plural(pool.length, "talk")}`;
// A person's talks go in one grid; the full list is split by year.
let year, ul = speaker ? list.appendChild(el("ul", "cards")) : null;
for (const t of shown) {
if (!speaker && t.date.slice(0, 4) !== year) {
year = t.date.slice(0, 4);
list.append(el("h2", "", year));
ul = list.appendChild(el("ul", "cards"));
}
ul.append(card(t));
}
}
// One talk: first-slide image on top, then title, date and event, speakers.
function card(t) {
const li = el("li", "talk");
// The thumbnail, or a placeholder showing the title, linked to the slides.
const thumb = el(t.slides ? "a" : "div", "thumb");
if (t.slides) {
thumb.href = t.slides;
thumb.setAttribute("aria-hidden", "true");
thumb.tabIndex = -1;
}
if (t.thumb) {
const img = el("img");
img.src = t.thumb;
img.alt = "";
img.loading = "lazy";
img.decoding = "async";
thumb.append(img);
} else {
thumb.classList.add("placeholder");
thumb.append(el("span", "", t.title));
}
li.append(thumb);
const body = el("div", "body");
const title = el(t.slides ? "a" : "span", "title", t.title);
if (t.slides) title.href = t.slides;
body.append(title);
if (t.type && t.type !== "talk") body.append(el("span", "tag", t.type));
body.append(el("div", "meta when", [t.date, t.event].filter(Boolean).join(" · ")));
const who = el("div", "meta");
t.speakers.forEach((s, i) => {
if (i) who.append(", ");
const a = el("a", "", s);
a.href = speakerHref(s);
who.append(a);
});
if (t.video) {
const v = el("a", "", "📺 video");
v.href = t.video;
who.append(who.childNodes.length ? " · " : "", v);
}
if (who.childNodes.length) body.append(who);
li.append(body);
return li;
}
function renderSpeakers() {
filter.hidden = true;
const shown = speakers.filter(s => matches(s.key));
count.textContent = `${shown.length} of ${plural(speakers.length, "speaker")}`;
const ul = list.appendChild(el("ul"));
for (const s of shown) {
const li = el("li", "speaker");
li.append(avatar(s.name));
const name = el("div", "who");
const a = el("a", "title", s.name);
a.href = speakerHref(s.name);
name.append(a, handle(s.name));
name.append(el("span", "years", s.first === s.last ? s.first : `${s.first}–${s.last}`));
li.append(name, el("span", "n", plural(s.count, "talk")));
ul.append(li);
}
}
// GitHub profile picture for people on Dataverse People, loaded live;
// otherwise (or if it fails to load) a circle with their initials.
function avatar(name) {
const user = people[name];
if (!user) return initials(name);
const img = el("img", "avatar");
img.src = `https://github.com/${encodeURIComponent(user)}.png?size=96`;
img.alt = "";
img.width = img.height = 48;
img.loading = "lazy";
img.decoding = "async";
img.addEventListener("error", () => img.replaceWith(initials(name)), { once: true });
return img;
}
function initials(name) {
const words = name.replace(/\(.*?\)/g, "").split(/\s+/).filter(w => /^\p{L}/u.test(w));
const letters = words.length > 1
? words[0][0] + words[words.length - 1][0]
: (words[0] || "?").slice(0, 2);
// The same name always gets the same color.
let hash = 0;
for (const c of name) hash = (hash * 31 + c.codePointAt(0)) >>> 0;
const div = el("div", "avatar initials", letters.toUpperCase());
div.style.background = `hsl(${hash % 360} 45% 42%)`;
div.setAttribute("aria-hidden", "true");
return div;
}
function render() {
const r = route();
document.getElementById("nav-talks").toggleAttribute("aria-current", r.view === "talks");
document.getElementById("nav-speakers").toggleAttribute("aria-current", r.view === "speakers");
q.placeholder = r.view === "speakers" ? "Search speakers…" : "Search titles, speakers, events…";
list.replaceChildren();
// The talk cards use a wider page than the speaker list.
document.querySelector("main").classList.toggle("wide", r.view === "talks");
if (r.view === "speakers") renderSpeakers();
else renderTalks(r.speaker);
}
// One entry per person: how many talks, and the first and last year they spoke.
function buildSpeakers() {
const by = new Map();
for (const t of talks) {
const year = t.date.slice(0, 4);
for (const name of t.speakers) {
const s = by.get(name) ||
{ name, key: (name + " " + (people[name] || "")).toLowerCase(), count: 0, first: year, last: year };
s.count++;
if (year < s.first) s.first = year;
if (year > s.last) s.last = year;
by.set(name, s);
}
}
return [...by.values()].sort((a, b) => b.count - a.count || a.name.localeCompare(b.name));
}
// people.json is optional: without it, names just aren't linked.
const loadPeople = fetch("people.json")
.then(r => (r.ok ? r.json() : {}))
.catch(() => ({}))
.then(p => { people = p; });
Promise.all([fetch("talks.json").then(r => r.json()), loadPeople])
.then(([data]) => {
// Talks without slides stay in talks.json but aren't shown
// (hidden_talks.py lists them). They appear once a slides link is added.
talks = data
.filter(t => t.slides)
.map(t => ({ ...t, _text: [t.title, t.event, ...t.speakers].join(" ").toLowerCase() }))
.sort((a, b) => b.date.localeCompare(a.date) || a.title.localeCompare(b.title));
speakers = buildSpeakers();
render();
})
.catch(() => { count.textContent = "Couldn't load talks.json."; });
q.addEventListener("input", render);
window.addEventListener("hashchange", () => { q.value = ""; render(); window.scrollTo(0, 0); });
</script>
</body>
</html>