Repository with sources and generator of https://larlet.fr/david/ https://larlet.fr/david/
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

index.html 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. <!doctype html><!-- This is a valid HTML5 document. -->
  2. <!-- Screen readers, SEO, extensions and so on. -->
  3. <html lang="fr">
  4. <!-- Has to be within the first 1024 bytes, hence before the `title` element
  5. See: https://www.w3.org/TR/2012/CR-html5-20121217/document-metadata.html#charset -->
  6. <meta charset="utf-8">
  7. <!-- Why no `X-UA-Compatible` meta: https://stackoverflow.com/a/6771584 -->
  8. <!-- The viewport meta is quite crowded and we are responsible for that.
  9. See: https://codepen.io/tigt/post/meta-viewport-for-2015 -->
  10. <meta name="viewport" content="width=device-width,initial-scale=1">
  11. <!-- Required to make a valid HTML5 document. -->
  12. <title>Accueil — David Larlet</title>
  13. <meta name="description" content="Voici l’espace personnel de David Larlet sur le Web.">
  14. <!-- That good ol' feed, subscribe :). -->
  15. <link rel="alternate" type="application/atom+xml" title="Feed" href="/david/log/">
  16. <!-- Generated from https://realfavicongenerator.net/ such a mess. -->
  17. <link rel="apple-touch-icon" sizes="180x180" href="/static/david/icons2/apple-touch-icon.png">
  18. <link rel="icon" type="image/png" sizes="32x32" href="/static/david/icons2/favicon-32x32.png">
  19. <link rel="icon" type="image/png" sizes="16x16" href="/static/david/icons2/favicon-16x16.png">
  20. <link rel="manifest" href="/static/david/icons2/site.webmanifest">
  21. <link rel="mask-icon" href="/static/david/icons2/safari-pinned-tab.svg" color="#07486c">
  22. <link rel="shortcut icon" href="/static/david/icons2/favicon.ico">
  23. <meta name="msapplication-TileColor" content="#f7f7f7">
  24. <meta name="msapplication-config" content="/static/david/icons2/browserconfig.xml">
  25. <meta name="theme-color" content="#f7f7f7" media="(prefers-color-scheme: light)">
  26. <meta name="theme-color" content="#272727" media="(prefers-color-scheme: dark)">
  27. <!-- Documented, feel free to shoot an email. -->
  28. <link rel="stylesheet" href="/static/david/css/style_2021-01-20.css">
  29. <!-- See https://www.zachleat.com/web/comprehensive-webfonts/ for the trade-off. -->
  30. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  31. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  32. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  33. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  34. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  35. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  36. <script>
  37. function toggleTheme(themeName) {
  38. document.documentElement.classList.toggle(
  39. 'forced-dark',
  40. themeName === 'dark'
  41. )
  42. document.documentElement.classList.toggle(
  43. 'forced-light',
  44. themeName === 'light'
  45. )
  46. }
  47. const selectedTheme = localStorage.getItem('theme')
  48. if (selectedTheme !== 'undefined') {
  49. toggleTheme(selectedTheme)
  50. }
  51. </script>
  52. <body class="remarkdown h1-underline h2-underline h3-underline em-underscore hr-center ul-star pre-tick" data-instant-intensity="viewport-all">
  53. <article>
  54. <header>
  55. <h1>Bienvenue</h1>
  56. </header>
  57. <p>
  58. Voici l’espace personnel de David Larlet sur le Web.
  59. Il se veut modeste, accueillant et pérenne.
  60. Il fixe mes pensées et parfois engage des échanges.
  61. J’essaye de tenir et lier des propos bienveillants.
  62. Je vous souhaite une jolie promenade.
  63. </p>
  64. <p lang="en">
  65. For an English profile, check out
  66. <a href="http://larlet.com" data-instant>this page 🇨🇦</a>.
  67. </p>
  68. <h2>Publications 2023</h2>
  69. <p>Liste des publications récentes en ordre anté-chronologique :</p>
  70. <nav>
  71. <p>
  72. <a href="/david/2023/02/09/">Allumage</a>,
  73. <a href="/david/2023/02/08/">TextcAIst</a>,
  74. <a href="/david/2023/02/07/">Madeleine</a>,
  75. <a href="/david/2023/02/05/">Attente</a>,
  76. <a href="/david/2023/02/03/">Chargement</a>,
  77. <a href="/david/2023/02/02/">Moment</a>,
  78. <a href="/david/2023/02/01/">Ombres</a>,
  79. <a href="/david/2023/01/31/">Ennui</a>,
  80. <a href="/david/2023/01/30/">Lecture</a>,
  81. <a href="/david/2023/01/26/">Décentralisation</a>,
  82. <a href="/david/2023/01/24/">Capot</a>,
  83. <a href="/david/2023/01/23/">Déception</a>,
  84. <a href="/david/2023/01/22/">Jour&nbsp;2</a>,
  85. <a href="/david/2023/01/21/">Jour&nbsp;1</a>,
  86. <a href="/david/2023/01/20/">Lettres</a>,
  87. <a href="/david/2023/01/18/">Femmes</a>,
  88. <a href="/david/2023/01/17/">Populaire</a>,
  89. <a href="/david/2023/01/16/">Chasse</a>,
  90. <a href="/david/2023/01/15/">Snow&nbsp;Fall</a>,
  91. <a href="/david/2023/01/14/">Dépendances</a>,
  92. <a href="/david/2023/01/13/">Eaux&nbsp;grises</a>,
  93. <a href="/david/2023/01/12/">Masque</a>,
  94. <a href="/david/2023/01/11/">Suspendu</a>,
  95. <a href="/david/2023/01/10/">Qualité</a>,
  96. <a href="/david/2023/01/09/">Indépendant·e</a>,
  97. <a href="/david/2023/01/08/">Partage</a>,
  98. <a href="/david/2023/01/07/">Dette</a>,
  99. <a href="/david/2023/01/06/">Toile</a>,
  100. <a href="/david/2023/01/05/">Instanseul</a>,
  101. <a href="/david/2023/01/04/">Rétrospectives</a>,
  102. <a href="/david/2023/01/03/">Préparation</a>,
  103. <a href="/david/2023/01/02/">Lucidité</a>,
  104. <a href="/david/2023/01/01/">Alleeez</a>.
  105. </p>
  106. </nav>
  107. <p id="tags-2023">Ou par étiquettes :</p>
  108. <nav>
  109. <p>
  110. <a href="/david/2023/accompagnement/">#accompagnement (4)</a>,
  111. <a href="/david/2023/amadou/">#amadou (1)</a>,
  112. <a href="/david/2023/aventure/">#aventure (6)</a>,
  113. <a href="/david/2023/complexite/">#complexité (4)</a>,
  114. <a href="/david/2023/confiance/">#confiance (3)</a>,
  115. <a href="/david/2023/confidentialite/">#confidentialité (3)</a>,
  116. <a href="/david/2023/courage/">#courage (7)</a>,
  117. <a href="/david/2023/decentralisation/">#décentralisation (2)</a>,
  118. <a href="/david/2023/don/">#don (2)</a>,
  119. <a href="/david/2023/eau/">#eau (2)</a>,
  120. <a href="/david/2023/ecriture/">#écriture (2)</a>,
  121. <a href="/david/2023/foret/">#forêt (2)</a>,
  122. <a href="/david/2023/gafam/">#gafam (1)</a>,
  123. <a href="/david/2023/gratitude/">#gratitude (5)</a>,
  124. <a href="/david/2023/incompetence/">#incompétence (1)</a>,
  125. <a href="/david/2023/intimite/">#intimité (1)</a>,
  126. <a href="/david/2023/livre/">#livre (2)</a>,
  127. <a href="/david/2023/masque/">#masque (1)</a>,
  128. <a href="/david/2023/mastodon/">#mastodon (1)</a>,
  129. <a href="/david/2023/nostalgie/">#nostalgie (1)</a>,
  130. <a href="/david/2023/parentalite/">#parentalité (1)</a>,
  131. <a href="/david/2023/partage/">#partage (1)</a>,
  132. <a href="/david/2023/patriarcat/">#patriarcat (1)</a>,
  133. <a href="/david/2023/photographie/">#photographie (2)</a>,
  134. <a href="/david/2023/propriete/">#propriété (1)</a>,
  135. <a href="/david/2023/psychologie/">#psychologie (1)</a>,
  136. <a href="/david/2023/qualite/">#qualité (2)</a>,
  137. <a href="/david/2023/recherche/">#recherche (10)</a>,
  138. <a href="/david/2023/recyclage/">#recyclage (2)</a>,
  139. <a href="/david/2023/reponse/">#réponse (2)</a>,
  140. <a href="/david/2023/simplicite/">#simplicité (1)</a>,
  141. <a href="/david/2023/sociologie/">#sociologie (1)</a>,
  142. <a href="/david/2023/sport/">#sport (3)</a>,
  143. <a href="/david/2023/technique/">#technique (6)</a>,
  144. <a href="/david/2023/traces/">#traces (3)</a>,
  145. <a href="/david/2023/tristesse/">#tristesse (2)</a>,
  146. <a href="/david/2023/viande/">#viande (1)</a>,
  147. <a href="/david/2023/web/">#web (5)</a>.
  148. </p>
  149. </nav>
  150. <h2>Publications sporadiques 2022</h2>
  151. <p>Liste des publications en ordre chronologique :</p>
  152. <nav>
  153. <p>
  154. <a href="/david/2022/01/19/">Négatif</a>,
  155. <a href="/david/2022/02/17/">Envie</a>,
  156. <a href="/david/2022/03/04/">Régime</a>,
  157. <a href="/david/2022/03/18/">Temps</a>,
  158. <a href="/david/2022/03/23/">Open-source</a>,
  159. <a href="/david/2022/04/02/">Recherche</a>,
  160. <a href="/david/2022/04/14/">Ressenti</a>,
  161. <a href="/david/2022/04/23/">Quarantaine</a>,
  162. <a href="/david/2022/04/26/">R&amp;Day</a>,
  163. <a href="/david/2022/05/13/">Aurore</a>,
  164. <a href="/david/2022/05/15/">Rédemption</a>,
  165. <a href="/david/2022/05/17/">Outils</a>,
  166. <a href="/david/2022/05/30/">Méditation</a>,
  167. <a href="/david/2022/06/06/">Hommes</a>,
  168. <a href="/david/2022/06/24/">Bouddhisme</a>,
  169. <a href="/david/2022/06/30/">Valeur(s)</a>,
  170. <a href="/david/2022/07/06/">Regard</a>,
  171. <a href="/david/2022/07/08/">LudoviCovid</a>,
  172. <a href="/david/2022/07/14/">Vingt</a>,
  173. <a href="/david/2022/07/23/">Origines</a>,
  174. <a href="/david/2022/08/24/">Silence</a>,
  175. <a href="/david/2022/09/03/">Bifurquer</a>,
  176. <a href="/david/2022/10/18/">Esclavage</a>,
  177. <a href="/david/2022/11/12/">Mastodon</a>,
  178. <a href="/david/2022/11/27/">Neuf</a>,
  179. <a href="/david/2022/12/19/">Traces</a>,
  180. <a href="/david/2022/12/22/">Marcher</a>.
  181. </p>
  182. </nav>
  183. <p>
  184. J’ai aussi ouvert trois nouveaux espaces en 2022 :
  185. </p>
  186. <ul>
  187. <li><a href="https://media.larlet.fr/">Des photos/media plus ou moins récents</a></li>
  188. <li><a href="https://code.larlet.fr/">Des morceaux de code et d’apprentissages</a></li>
  189. <li><a href="https://nature.larlet.fr/">Des bribes/expériences de nature</a></li>
  190. </ul>
  191. <p>
  192. En plus de publier des bêtises
  193. <a href="https://fedi.larlet.fr/@david" rel="me">sur Mastodon</a>.
  194. </p>
  195. <h2 id="tags">
  196. Publications <a href="/david/2021/" title="Voir la liste de toutes les publications 2021">2021</a> par tags <svg class="icon icon-tags">
  197. <use xlink:href="/static/david/icons2/symbol-defs-2022-03.svg#icon-tags"></use>
  198. </svg>
  199. </h2>
  200. <nav>
  201. <p>
  202. <a href="/david/2021/accessibilite/">#accessibilité (17)</a>
  203. <a href="/david/2021/accompagnement/">#accompagnement (21)</a>
  204. <a href="/david/2021/allie/">#allié (12)</a>
  205. <a href="/david/2021/alterego/">#alterego (7)</a>
  206. <a href="/david/2021/anarchisme/">#anarchisme (5)</a>
  207. <a href="/david/2021/anxiete/">#anxiété (35)</a>
  208. <a href="/david/2021/capitalocene/">#capitalocène (21)</a>
  209. <a href="/david/2021/climat/">#climat (13)</a>
  210. <a href="/david/2021/contemplation/">#contemplation (7)</a>
  211. <a href="/david/2021/cooperative/">#coopérative (7)</a>
  212. <a href="/david/2021/design/">#design (11)</a>
  213. <a href="/david/2021/echecs/">#échecs (5)</a>
  214. <a href="/david/2021/ecole/">#école (8)</a>
  215. <a href="/david/2021/ecriture/">#écriture (15)</a>
  216. <a href="/david/2021/etiquette/">#étiquette (5)</a>
  217. <a href="/david/2021/exploration/">#exploration (5)</a>
  218. <a href="/david/2021/feminisme/">#féminisme (4)</a>
  219. <a href="/david/2021/foret/">#forêt (40)</a>
  220. <a href="/david/2021/frugalite/">#frugalité (6)</a>
  221. <a href="/david/2021/gafam/">#gafam (15)</a>
  222. <a href="/david/2021/gratitude/">#gratitude (18)</a>
  223. <a href="/david/2021/inclassable/">#inclassable (4)</a>
  224. <a href="/david/2021/incompetence/">#incompétence (35)</a>
  225. <a href="/david/2021/lecture/">#lecture (11)</a>
  226. <a href="/david/2021/materiel/">#matériel (4)</a>
  227. <a href="/david/2021/misanthropie/">#misanthropie (23)</a>
  228. <a href="/david/2021/neige/">#neige (7)</a>
  229. <a href="/david/2021/open-source/">#open-source (12)</a>
  230. <a href="/david/2021/pandemie/">#pandémie (44)</a>
  231. <a href="/david/2021/parentalite/">#parentalité (11)</a>
  232. <a href="/david/2021/partage/">#partage (23)</a>
  233. <a href="/david/2021/pharmakon/">#pharmakon (11)</a>
  234. <a href="/david/2021/poesie/">#poésie (5)</a>
  235. <a href="/david/2021/premieres-nations/">#premières-nations (4)</a>
  236. <a href="/david/2021/produit/">#produit (17)</a>
  237. <a href="/david/2021/protopie/">#protopie (5)</a>
  238. <a href="/david/2021/publication/">#publication (16)</a>
  239. <a href="/david/2021/recherche/">#recherche (29)</a>
  240. <a href="/david/2021/rythme/">#rythme (20)</a>
  241. <a href="/david/2021/scopyleft/">#scopyleft (5)</a>
  242. <a href="/david/2021/sociologie/">#sociologie (26)</a>
  243. <a href="/david/2021/technique/">#technique (47)</a>
  244. <a href="/david/2021/traces/">#traces (15)</a>
  245. <a href="/david/2021/transformation/">#transformation (49)</a>
  246. <a href="/david/2021/travail/">#travail (14)</a>
  247. <a href="/david/2021/utilisateur-ice/">#utilisateur·ice (5)</a>
  248. <a href="/david/2021/video/">#vidéo (21)</a>
  249. <a href="/david/2021/web/">#web (24)</a>
  250. </p>
  251. </nav>
  252. <h2>Publications hebdomadaires <a href="/david/2020/" title="Voir la liste de toutes les publications 2020">2020</a></h2>
  253. <p>Liste des publications en ordre chronologique :</p>
  254. <nav>
  255. <p>
  256. <a href="/david/2020/01/03/">Briques</a>,
  257. <a href="/david/2020/01/06/">Écriture</a>,
  258. <a href="/david/2020/01/10/">Travail</a>,
  259. <a href="/david/2020/01/15/">Futurs</a>,
  260. <a href="/david/2020/01/17/">Datagouv</a>,
  261. <a href="/david/2020/01/22/">Réponses</a>,
  262. <a href="/david/2020/01/29/">Sortie ski</a>,
  263. <a href="/david/2020/01/31/">Intentions</a>,
  264. <a href="/david/2020/02/07/">GAFAM+</a>,
  265. <a href="/david/2020/02/14/">Espoirs</a>,
  266. <a href="/david/2020/02/21/">Service</a>,
  267. <a href="/david/2020/03/13/">Technique</a>,
  268. <a href="/david/2020/03/20/">Rédemption</a>,
  269. <a href="/david/2020/03/27/">Exutoire</a>,
  270. <a href="/david/2020/04/03/">Patience</a>,
  271. <a href="/david/2020/04/10/">Résistance</a>,
  272. <a href="/david/2020/04/18/">Zam</a>,
  273. <a href="/david/2020/05/18/">Relance</a>,
  274. <a href="/david/2020/05/20/">Bikepacking</a>,
  275. <a href="/david/2020/05/26/">Covidoudou</a>,
  276. <a href="/david/2020/06/12/">Vrac</a>,
  277. <a href="/david/2020/06/18/">Mouvements</a>,
  278. <a href="/david/2020/06/25/">Ouvertance</a>,
  279. <a href="/david/2020/07/03/">Confetti</a>,
  280. <a href="/david/2020/07/13/">Bilan</a>,
  281. <a href="/david/2020/08/24/">Personnes</a>,
  282. <a href="/david/2020/09/01/">Rentrée</a>,
  283. <a href="/david/2020/09/07/">Rappels</a>,
  284. <a href="/david/2020/09/16/">Coupable</a>,
  285. <a href="/david/2020/10/08/">Parvenir</a>,
  286. <a href="/david/2020/10/22/">Grand-écart</a>,
  287. <a href="/david/2020/10/28/">Chaos</a>,
  288. <a href="/david/2020/11/27/">Perles</a>,
  289. <a href="/david/2020/12/01/">Compréhension</a>,
  290. <a href="/david/2020/12/13/">Publications</a>,
  291. <a href="/david/2020/12/15/">Vidéos</a>,
  292. <a href="/david/2020/12/18/">Arrakice</a>,
  293. <a href="/david/2020/12/21/">Livres</a>.
  294. </p>
  295. </nav>
  296. <h2>Recherche</h2>
  297. <p>Les contenus de ces dernières années sont indexés.</p>
  298. <form action="/david/recherche/" method="get">
  299. <label for="input-search">Termes de votre recherche :</label>
  300. <input type="search" name="s" required>
  301. <button>Chercher</button>
  302. </form>
  303. <h2>Publications archéologiques</h2>
  304. <p>
  305. Vous pouvez consulter les différents
  306. <a href="/david/blog/">billets de blog</a> qui ont été rédigés de 2004 à 2019
  307. ou les <a href="/david/stream/">entrées de journaux</a> relativement
  308. régulières entre 2009 et 2019.
  309. </p>
  310. <p>
  311. <em>
  312. Notez qu’avec un tel historique, certaines informations sont obsolètes et/ou
  313. plus cautionnées.
  314. </em>
  315. </p>
  316. <h2>Me contacter</h2>
  317. <p>
  318. Je réponds à <em>presque</em> tous les courriels reçus, exception faite de ceux que j’assimile à de la publicité ou du <code>spam</code>. Vous pouvez <a href="mailto:david%40larlet.fr" title="Envoyer un courriel">m’écrire</a> sans trop de civilités et me tutoyer, je répondrai probablement de même. Si vous souhaitez correspondre de manière chiffrée, voici <a href="/static/david/david-larlet-pgp-public-key-1359EA98.asc" title="Clé publique de chiffrement">ma clé publique</a>.
  319. </p>
  320. </article>
  321. <hr>
  322. <footer>
  323. <p>
  324. <nobr>
  325. <a href="/david/" title="Aller à l’accueil"
  326. ><svg class="icon icon-home">
  327. <use
  328. xlink:href="/static/david/icons2/symbol-defs-2022-03.svg#icon-home"
  329. ></use>
  330. </svg>
  331. Accueil</a
  332. >
  333. </nobr>
  334. <nobr>
  335. <a href="/david/log/" title="Accès au flux RSS"
  336. ><svg class="icon icon-rss2">
  337. <use xlink:href="/static/david/icons2/symbol-defs-2022-03.svg#icon-rss2"></use>
  338. </svg>
  339. Suivre</a
  340. >
  341. </nobr>
  342. <nobr>
  343. <a href="http://larlet.com" title="Go to my English profile" data-instant
  344. ><svg class="icon icon-user-tie">
  345. <use xlink:href="/static/david/icons2/symbol-defs-2022-03.svg#icon-user-tie"></use>
  346. </svg>
  347. Pro</a
  348. >
  349. </nobr>
  350. <nobr>
  351. <a href="mailto:david%40larlet.fr" title="Envoyer un courriel"
  352. ><svg class="icon icon-mail">
  353. <use xlink:href="/static/david/icons2/symbol-defs-2022-03.svg#icon-mail"></use>
  354. </svg>
  355. Email</a
  356. >
  357. </nobr>
  358. <nobr>
  359. <abbr
  360. class="nowrap"
  361. title="Hébergeur : Alwaysdata, 62 rue Tiquetonne 75002 Paris, +33184162340"
  362. ><svg class="icon icon-hammer2">
  363. <use xlink:href="/static/david/icons2/symbol-defs-2022-03.svg#icon-hammer2"></use>
  364. </svg>
  365. Légal</abbr
  366. >
  367. </nobr>
  368. </p>
  369. <template id="theme-selector">
  370. <form>
  371. <fieldset>
  372. <legend><svg class="icon icon-brightness-contrast">
  373. <use xlink:href="/static/david/icons2/symbol-defs-2022-03.svg#icon-brightness-contrast"></use>
  374. </svg> Thème</legend>
  375. <label>
  376. <input type="radio" value="auto" name="chosen-color-scheme" checked> Auto
  377. </label>
  378. <label>
  379. <input type="radio" value="dark" name="chosen-color-scheme"> Foncé
  380. </label>
  381. <label>
  382. <input type="radio" value="light" name="chosen-color-scheme"> Clair
  383. </label>
  384. </fieldset>
  385. </form>
  386. </template>
  387. </footer>
  388. <script src="/static/david/js/instantpage-5.1.0.min.js" type="module"></script>
  389. <script>
  390. function loadThemeForm(templateName) {
  391. const themeSelectorTemplate = document.querySelector(templateName)
  392. const form = themeSelectorTemplate.content.firstElementChild
  393. themeSelectorTemplate.replaceWith(form)
  394. form.addEventListener('change', (e) => {
  395. const chosenColorScheme = e.target.value
  396. localStorage.setItem('theme', chosenColorScheme)
  397. toggleTheme(chosenColorScheme)
  398. })
  399. const selectedTheme = localStorage.getItem('theme')
  400. if (selectedTheme && selectedTheme !== 'undefined') {
  401. form.querySelector(`[value="${selectedTheme}"]`).checked = true
  402. }
  403. }
  404. const prefersColorSchemeDark = '(prefers-color-scheme: dark)'
  405. window.addEventListener('load', () => {
  406. let hasDarkRules = false
  407. for (const styleSheet of Array.from(document.styleSheets)) {
  408. let mediaRules = []
  409. for (const cssRule of styleSheet.cssRules) {
  410. if (cssRule.type !== CSSRule.MEDIA_RULE) {
  411. continue
  412. }
  413. // WARNING: Safari does not have/supports `conditionText`.
  414. if (cssRule.conditionText) {
  415. if (cssRule.conditionText !== prefersColorSchemeDark) {
  416. continue
  417. }
  418. } else {
  419. if (cssRule.cssText.startsWith(prefersColorSchemeDark)) {
  420. continue
  421. }
  422. }
  423. mediaRules = mediaRules.concat(Array.from(cssRule.cssRules))
  424. }
  425. // WARNING: do not try to insert a Rule to a styleSheet you are
  426. // currently iterating on, otherwise the browser will be stuck
  427. // in a infinite loop…
  428. for (const mediaRule of mediaRules) {
  429. styleSheet.insertRule(mediaRule.cssText)
  430. hasDarkRules = true
  431. }
  432. }
  433. if (hasDarkRules) {
  434. loadThemeForm('#theme-selector')
  435. }
  436. })
  437. </script>
  438. </body>
  439. </html>