Skip to content

Commit 83b6928

Browse files
authored
feat/devquest.2025 (#22)
* feat(atl-day): starting point * feat(event): switching to devquest 2025 * feat(devquest.2025)[WIP]: first code-runner try * feat(devquest.2025)[WIP]: contenus OK → gérer JS et CSS * feat(devquest.2025): use IntersectionObserver to prevent playgrounds from runnning all the time * feat(devquest.2025): starting styles * fix(curri): responsive * chore(html-mutant): update to 0.0.3 * feat(devquest.2025): am I done? * fix(devquest.2025): mise en forme de l’exemple * feat(devquest.2025): tous les exemples fonctionnent 🚀
1 parent 4648f17 commit 83b6928

File tree

31 files changed

+5053
-82
lines changed

31 files changed

+5053
-82
lines changed

_src/_data/talks.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
[
2+
{
3+
"title": "L’invasion du HTML mutant",
4+
"event": "DevQuest Niort 2025",
5+
"date": "2025-06-06",
6+
"link": "https://www.devquest.fr/sessions/linvasion-du-html-mutant",
7+
"slides": "https://www.ffoodd.fr/devquest.2025"
8+
},
29
{
310
"title": "L’invasion du HTML mutant",
411
"event": "DevFest Nantes 2024",

_src/assets/cv.min.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ small {
168168
}
169169

170170
.w--site {
171-
width: 40em;
171+
width: min(100%, 40em);
172172
}
173173

174174
.mw--site {
175-
max-width: 40em;
175+
max-width: min(100%, 40em);
176176
}
177177

178178
.mt0,

_src/talks/a11y-paris/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<link rel="preconnect" href="https://cdn.jsdelivr.net">
1212
<link rel="preload" as="font" type="font/woff2" crossorigin="anonymous" href="../accesslide/fonts/bello-pro.woff2">
1313
<link rel="preload" as="font" type="font/woff2" crossorigin="anonymous" href="../accesslide/fonts/museo-slab-300.woff2">
14-
<link rel="stylesheet" href="../sliide/sliide.css?4" type="text/css" media="screen">
14+
<link rel="stylesheet" href="../sliide/sliide.css?5" type="text/css" media="screen">
1515
<link rel="stylesheet" href="../sliide/prism.min.css" type="text/css" media="screen">
1616
<style>.d-inline-block { display: inline-block; vertical-align: middle; }</style>
1717
</head>

_src/talks/devfest.2024/jeu/code-runner.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ class CodeRunner extends HTMLElement {
1515
}
1616

1717
connectedCallback() {
18-
this.level = document.querySelector('h1').innerText.split(' ')[1].split('\n')[0];
18+
this.level =
19+
this.closest('section')?.id?.split('-')[1] ||
20+
document.querySelector('h1')?.innerText?.split(' ')[1]?.split('\n')[0];
1921

2022
['options', 'condition', 'fonction']
2123
.map(field => {
@@ -26,6 +28,12 @@ class CodeRunner extends HTMLElement {
2628
});
2729
}
2830

31+
disconnectedCallback() {
32+
this.form.removeEventListener('submit', this);
33+
window.removeEventListener('error', this);
34+
document.removeEventListener('beforeunload', this);
35+
}
36+
2937
handleEvent(event) {
3038
switch (event.type) {
3139
case 'submit':
@@ -57,7 +65,7 @@ class CodeRunner extends HTMLElement {
5765
this.dispatchEvent(voightkampff);
5866
break;
5967
case 'error':
60-
console.error('Une erreur s’est glissée dans votre réponse.')
68+
console.error('Une erreur s’est glissée dans votre réponse.');
6169
break;
6270
default:
6371
break;

_src/talks/devfest.2024/jeu/index.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@
77
<meta name="description" content="L’invasion du HTML mutant — Atelier animé par Gaël Poupard lors du devFest Nantes 2024.">
88
<meta name="author" content="Gaël Poupard">
99
<link rel="icon" href="../../favicon.svg" type="image/svg+xml">
10-
<link rel="preload" as="font" href="/assets/fonts/ZillaSlab-Regular.woff2">
11-
<link rel="preload" as="font" href="/assets/fonts/LuckiestGuy-Regular.woff2">
12-
<link rel="preload" as="font" href="/assets/fonts/FontWithASyntaxHighlighter-Regular.woff2">
10+
<link rel="preload" as="font" href="./assets/fonts/ZillaSlab-Regular.woff2">
11+
<link rel="preload" as="font" href="./assets/fonts/LuckiestGuy-Regular.woff2">
12+
<link rel="preload" as="font" href="./assets/fonts/FontWithASyntaxHighlighter-Regular.woff2">
1313
<link rel="preload" as="font" href="./assets/fonts/Twemoji.woff2">
1414
<link rel="stylesheet" href="styles.css" media="screen">
1515
</head>
1616
<body class="splash">
1717
<header role="banner">
1818
<h1>L’invasion du HTML<br>mutant</h1>
19-
<!-- @todo Déplacer le jeu vers son propre dépôt et le récupérer via npm ? -->
2019
</header>
2120

2221
<main role="main">

_src/talks/devfest.2024/jeu/play-ground.js

Lines changed: 66 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,69 @@
11
class PlayGround extends HTMLElement {
22
static get observedAttributes() {
3-
return ['type'];
3+
return ['type', 'await', 'max'];
44
}
55

66
constructor() {
77
super();
88
document.addEventListener('voightkampff', this);
99
this.type = this.hasAttribute('type') ? this.getAttribute('type') : '';
10+
this.max = this.hasAttribute('max') ? this.getAttribute('max') : 100;
11+
this.async = this.hasAttribute('await');
1012
this.portal = document.getElementById('portal');
1113
this.over = document.getElementById('game-over');
1214
this.replay = document.getElementById('replay');
1315
}
1416

1517
connectedCallback() {
16-
this._invade();
17-
1818
this.spyer = new MutationObserver(mutations => {
1919
for (const mutation of mutations) {
20-
if (this.over && mutation.addedNodes.length && document.querySelectorAll('mu-tant').length >= 100) {
20+
if (this.over && mutation.addedNodes.length && this.querySelectorAll('mu-tant').length >= this.max) {
2121
this._gameOver();
2222
}
2323

2424
if (this.portal && mutation.removedNodes.length && this._isMutant(mutation.removedNodes[0])) {
25-
if (!document.querySelector('mu-tant')) {
25+
if (!this.querySelector('mu-tant')) {
2626
this._nextLevel();
27-
} else if ((this.type === 'all' && !document.querySelector('mu-tant:not([type=""])'))) {
27+
} else if ((this.type === 'all' && !this.querySelector('mu-tant:not([type=""])'))) {
2828
this._nextLevel();
2929
}
3030
}
3131
}
3232
});
33-
this.spyer.observe(this, { "childList": true });
33+
34+
if (this.async) {
35+
this.scout = new IntersectionObserver(entries => {
36+
if (entries[0].isIntersecting === true) {
37+
this._invade();
38+
this.spyer.observe(this, { "childList": true });
39+
} else {
40+
this.querySelectorAll('mu-tant').forEach(
41+
mutant => mutant.remove()
42+
);
43+
clearTimeout(this.invader);
44+
clearTimeout(this.timeout);
45+
this.spyer.disconnect();
46+
}
47+
}, {
48+
root: document.querySelector('main'),
49+
threshold: [1]
50+
});
51+
this.scout.observe(this);
52+
} else {
53+
this._invade();
54+
this.spyer.observe(this, { "childList": true });
55+
}
56+
}
57+
58+
disconnectedCallback() {
59+
this.scout.disconnect();
60+
this.spyer.disconnect();
61+
clearTimeout(this.invader);
62+
clearTimeout(this.timeout);
63+
document.removeEventListener('voightkampff', this);
64+
this.portal.removeEventListener('close', this);
65+
this.over.removeEventListener('close', this);
66+
this.replay.removeEventListener('close', this);
3467
}
3568

3669
handleEvent(event) {
@@ -43,15 +76,11 @@ class PlayGround extends HTMLElement {
4376
event.detail.type
4477
);
4578
if (this.replay) {
46-
if (event.detail.data.fonction === '') {
47-
this.timeout = setTimeout(() => this._replay(), 2000);
48-
} else {
49-
this.timeout = setTimeout(() => {
50-
if (this.querySelectorAll('mu-tant:not([type=""])').length) {
51-
this._replay();
52-
}
53-
}, 2000);
54-
}
79+
this.timeout = setTimeout(() => {
80+
if (this.querySelectorAll('mu-tant:not([type=""])').length > 0) {
81+
this._replay();
82+
}
83+
}, 2000);
5584
}
5685
break;
5786
case 'close':
@@ -111,6 +140,17 @@ class PlayGround extends HTMLElement {
111140
this._killMutant(leon, options, condition, fonction, watchTextNode, watchSubtree);
112141
}
113142
);
143+
144+
const observer = new MutationObserver(mutations => {
145+
for (const mutation of mutations) {
146+
for (const leon of mutation.addedNodes) {
147+
if (this._isMutant(leon)) {
148+
this._killMutant(leon, options, condition, fonction, watchTextNode, watchSubtree);
149+
}
150+
}
151+
}
152+
});
153+
observer.observe(this, { "childList": true });
114154
}
115155

116156
_killMutant(mutant, options, condition, fonction, watchTextNode, watchSubtree) {
@@ -151,13 +191,20 @@ class PlayGround extends HTMLElement {
151191
}
152192

153193
_nextLevel() {
154-
if (this.observer) this.observer.disconnect();
155194
this.portal.showModal();
156-
this.portal.addEventListener('close', this);
195+
if (this.async) {
196+
const level = this.closest('section')?.id?.split('-')[1];
197+
this.portal.addEventListener('close', () => {
198+
const target = document.getElementById(`slide-${(Number(level) + 1).toString()}`);
199+
target?.scrollIntoView({ inline: 'start' });
200+
target?.focus();
201+
});
202+
} else {
203+
this.portal.addEventListener('close', this);
204+
}
157205
}
158206

159207
_gameOver() {
160-
if (this.observer) this.observer.disconnect();
161208
clearTimeout(this.invader);
162209
this.over.showModal();
163210
this.over.addEventListener('close', this);

_src/talks/devfest/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<link rel="icon" href="../favicon.ico" type="image/x-icon">
1010
<link rel="preload" as="font" type="font/woff2" crossorigin="anonymous" href="../accesslide/fonts/bello-pro.woff2">
1111
<link rel="preload" as="font" type="font/woff2" crossorigin="anonymous" href="../accesslide/fonts/museo-slab-300.woff2">
12-
<link rel="stylesheet" href="../sliide/sliide.css?4" type="text/css" media="screen">
12+
<link rel="stylesheet" href="../sliide/sliide.css?5" type="text/css" media="screen">
1313
<link rel="stylesheet" href="../sliide/prism.min.css" type="text/css" media="screen">
1414
</head>
1515
<body>

0 commit comments

Comments
 (0)