service-worker, gestion des erreurs de réception

This commit is contained in:
2026-02-09 23:00:34 +01:00
parent 24d20ab228
commit 3cee135fd1
5 changed files with 283 additions and 85 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
tchap.py
.venv/

106
cat-lol.svg Normal file
View File

@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.1.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
<g>
<g>
<path style="fill:#FFC022;" d="M110.47,59.02c9.51-24.83,3.65-43.83,0.29-49.28c-1.33-2.16-3.89-2.76-6.25-2.02
C98.29,9.68,81.5,23.4,74.08,42.6"/>
</g>
<path style="fill:#FFC022;" d="M17.53,59.02c-9.51-24.83-3.65-43.83-0.29-49.28c1.33-2.16,3.89-2.76,6.25-2.02
C29.71,9.68,46.5,23.4,53.92,42.6"/>
<path style="fill:#FFC022;" d="M114.11,70.76C112.31,44.78,94.44,26.3,64,26.3S15.69,44.78,13.89,70.76
c-1.05,15.14,5.05,28.01,17.09,36.21c0,0,12.21,9.88,33.02,10.14c20.81-0.26,33.02-10.14,33.02-10.14
C109.05,98.77,115.16,85.9,114.11,70.76z"/>
<path style="opacity:0.47;fill:#FF7043;" d="M54.12,45.02c1.13,0.96,3.42,0.82,4.75-0.72c1.61-1.87,3.29-8.17,2.24-17.91
c-4.67,0.17-9.09,0.84-13.21,1.97C51.23,33.82,52.03,43.24,54.12,45.02z"/>
<path style="opacity:0.47;fill:#FF7043;" d="M73.88,45.02c-1.13,0.96-3.42,0.82-4.75-0.72c-1.61-1.87-3.29-8.17-2.24-17.91
c4.67,0.17,9.09,0.84,13.21,1.97C76.77,33.82,75.97,43.24,73.88,45.02z"/>
<g>
<g>
<line style="fill:none;stroke:#9E9E9E;stroke-width:3;stroke-linecap:round;stroke-miterlimit:10;" x1="6.09" y1="64.82" x2="21.19" y2="72.26"/>
<line style="fill:none;stroke:#9E9E9E;stroke-width:3;stroke-linecap:round;stroke-miterlimit:10;" x1="3.99" y1="77.03" x2="22.14" y2="80.18"/>
</g>
<g>
<line style="fill:none;stroke:#9E9E9E;stroke-width:3;stroke-linecap:round;stroke-miterlimit:10;" x1="121.91" y1="64.82" x2="106.81" y2="72.26"/>
<line style="fill:none;stroke:#9E9E9E;stroke-width:3;stroke-linecap:round;stroke-miterlimit:10;" x1="124.01" y1="77.03" x2="105.86" y2="80.18"/>
</g>
</g>
<g>
<g>
<path d="M32.56,70.26c-0.3,0-0.6-0.06-0.89-0.19c-1.12-0.49-1.64-1.8-1.14-2.92c0.35-0.8,3.6-7.85,9.35-7.85
c5.68,0,9.17,6.74,9.55,7.51c0.54,1.1,0.09,2.43-1.01,2.97c-1.1,0.54-2.17-0.12-2.97-1.01c-0.97-1.08-3.08-3.5-5.57-3.5
c-2.5,0-4.58,2.59-5.28,3.65C34.09,69.69,33.41,70.26,32.56,70.26z"/>
</g>
<g>
<path d="M95.44,70.26c0.3,0,0.6-0.06,0.89-0.19c1.12-0.49,1.64-1.8,1.14-2.92c-0.35-0.8-3.6-7.85-9.35-7.85
c-5.68,0-9.17,6.74-9.55,7.51c-0.54,1.1-0.09,2.43,1.01,2.97c1.1,0.54,2.17-0.12,2.97-1.01c0.97-1.08,3.08-3.5,5.57-3.5
c2.5,0,4.58,2.59,5.28,3.65C93.91,69.69,94.59,70.26,95.44,70.26z"/>
</g>
</g>
<path d="M55.96,76.98c-0.05-2.86,4.06-4.24,7.95-4.3c3.89-0.07,8.07,1.2,8.12,4.06s-4.86,6.64-7.95,6.64S56.01,79.84,55.96,76.98z"
/>
<path style="fill:#FFFFFF;" d="M90.06,90.38c-1.64-1.67-4.29-2.16-6.75-1.24c-2.71,1.02-11,4.13-15.22,1.45
c-3.71-2.35-3.51-7.13-3.51-7.13h-1.57c0,0,0.25,5.21-3.11,7.13c-4.35,2.5-12.51-0.44-15.22-1.45c-2.45-0.92-5.1-0.43-6.75,1.24
c-1.55,1.57-1.82,3.82-0.72,5.88c2.32,4.35,10.58,11.71,26.78,11.77c16.2-0.05,24.46-7.42,26.78-11.77
C91.88,94.2,91.61,91.95,90.06,90.38z"/>
<path d="M91.58,88.8c-1.74-1.89-4.54-2.44-7.14-1.4c-2.87,1.15-11.64,4.68-16.11,1.64c-3.93-2.66-2.33-6.8-2.33-6.8h-4
c0,0,1.22,4.62-2.33,6.8c-4.61,2.83-13.24-0.5-16.11-1.64c-2.6-1.04-5.4-0.49-7.14,1.4c-1.64,1.78-1.93,4.33-0.76,6.66
c2.46,4.92,11.2,13.26,28.34,13.32c17.15-0.06,25.88-8.4,28.34-13.32C93.51,93.13,93.22,90.58,91.58,88.8z M89.66,94.12
c-2.01,4.01-9.95,11.61-25.66,11.66c-15.71-0.06-23.65-7.65-25.66-11.66c-0.61-1.23-0.51-2.43,0.28-3.29
c0.57-0.62,1.4-0.95,2.3-0.95c0.49,0,1.01,0.1,1.52,0.3c5.61,2.25,13.68,4.83,18.89,1.36c1.2-0.8,2.04-1.46,2.64-2
c0.01,0.01,0.02,0.02,0.03,0.02c0.01-0.01,0.02-0.02,0.03-0.02c0.6,0.54,1.45,1.2,2.64,2c5.21,3.47,13.28,0.89,18.89-1.36
c0.51-0.2,1.02-0.3,1.52-0.3c0.9,0,1.73,0.33,2.3,0.95C90.17,91.7,90.27,92.89,89.66,94.12z"/>
<g>
<line style="fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;" x1="42.93" y1="89.54" x2="42.93" y2="101.87"/>
<line style="fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;" x1="53.47" y1="91.5" x2="53.47" y2="105.15"/>
<line style="fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;" x1="64" y1="86.8" x2="64" y2="106.71"/>
<line style="fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;" x1="85.07" y1="88.39" x2="85.07" y2="100.72"/>
<line style="fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;" x1="74.53" y1="90.48" x2="74.53" y2="104.66"/>
</g>
<g>
<g>
<g>
<g>
<g>
<path style="fill:#28B3F2;" d="M99.01,75.05c-0.25-0.56,0.2-1.18,0.82-1.11c3.71,0.4,13.83,2.22,20,10.38
c3.52,4.65,4.72,13.12-0.49,17c-6.36,4.73-13.99,0.35-15.15-5.36c-0.88-4.33-1.38-8.5-2.13-11.49
C100.82,79.51,99.67,76.54,99.01,75.05z"/>
</g>
</g>
<path style="fill:#0277BD;" d="M120.9,98.21c-6.44,4.61-13.12,1.04-14.58-5.32c0,0-1.65-7.51-2.75-10.71
c-1.75-5.13-4.42-7.98-4.42-7.98s-0.36,0.36-0.14,0.86c0.66,1.5,1.81,4.46,3.05,9.42c0.75,2.99,1.25,7.16,2.13,11.49
c1.16,5.72,8.79,10.09,15.15,5.36c1.78-1.32,2.79-3.18,3.24-5.24C122.18,96.94,121.63,97.68,120.9,98.21z"/>
<path style="fill:#81D4FA;" d="M113.51,83.7c1.88-0.94,5.42,0.81,7.06,5.49c1.68,4.83-1.6,7.81-4.9,4.1
C113.26,90.6,111.6,84.66,113.51,83.7z"/>
</g>
</g>
<g>
<g>
<g>
<g>
<path style="fill:#28B3F2;" d="M28.99,75.05c0.25-0.56-0.2-1.18-0.82-1.11c-3.71,0.4-13.83,2.22-20,10.38
c-3.52,4.65-4.72,13.12,0.49,17c6.36,4.73,13.99,0.35,15.15-5.36c0.88-4.33,1.38-8.5,2.13-11.49
C27.18,79.51,28.33,76.54,28.99,75.05z"/>
</g>
</g>
<path style="fill:#0277BD;" d="M7.1,98.21c6.44,4.61,13.12,1.04,14.58-5.32c0,0,1.65-7.51,2.75-10.71
c1.75-5.13,4.42-7.98,4.42-7.98s0.36,0.36,0.14,0.86c-0.66,1.5-1.81,4.46-3.05,9.42c-0.75,2.99-1.25,7.16-2.13,11.49
c-1.16,5.72-8.79,10.09-15.15,5.36c-1.78-1.32-2.79-3.18-3.24-5.24C5.82,96.94,6.37,97.68,7.1,98.21z"/>
<path style="fill:#81D4FA;" d="M14.49,83.7c-1.88-0.94-5.42,0.81-7.06,5.49c-1.68,4.83,1.6,7.81,4.9,4.1
C14.74,90.6,16.4,84.66,14.49,83.7z"/>
</g>
</g>
</g>
<g>
<path style="fill:#FFD1D1;" d="M92.16,36.23c-1.54-1.29-1.5-3.37-0.6-5.16c2.16-4.31,7.33-8.78,9.16-10.23
c3-2.38,5.32-3.18,6.21,0.65c1.65,7.08,1.52,16.69-0.25,21.99c-0.62,1.87-2.54,2.86-4.02,1.57L92.16,36.23z"/>
</g>
<path style="fill:#FFD1D1;" d="M35.84,36.23c1.54-1.29,1.5-3.37,0.6-5.16c-2.16-4.31-7.33-8.78-9.16-10.23
c-3-2.38-5.32-3.18-6.21,0.65c-1.65,7.08-1.52,16.69,0.25,21.99c0.62,1.87,2.54,2.86,4.02,1.57L35.84,36.23z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@@ -4,11 +4,6 @@
viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve"> viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
<g> <g>
<g> <g>
<path style="fill:#FFC022;" d="M110.47,59.02c9.51-24.83,3.65-43.83,0.29-49.28c-1.33-2.16-3.89-2.76-6.25-2.02
C98.29,9.68,81.5,23.4,74.08,42.6"/>
</g>
<path style="fill:#FFC022;" d="M17.53,59.02c-9.51-24.83-3.65-43.83-0.29-49.28c1.33-2.16,3.89-2.76,6.25-2.02
C29.71,9.68,46.5,23.4,53.92,42.6"/>
<path style="fill:#FFC022;" d="M114.11,70.76C112.31,44.78,94.44,26.3,64,26.3S15.69,44.78,13.89,70.76 <path style="fill:#FFC022;" d="M114.11,70.76C112.31,44.78,94.44,26.3,64,26.3S15.69,44.78,13.89,70.76
c-1.05,15.14,5.05,28.01,17.09,36.21c0,0,12.21,9.88,33.02,10.14c20.81-0.26,33.02-10.14,33.02-10.14 c-1.05,15.14,5.05,28.01,17.09,36.21c0,0,12.21,9.88,33.02,10.14c20.81-0.26,33.02-10.14,33.02-10.14
C109.05,98.77,115.16,85.9,114.11,70.76z"/> C109.05,98.77,115.16,85.9,114.11,70.76z"/>
@@ -16,91 +11,76 @@
c-4.67,0.17-9.09,0.84-13.21,1.97C51.23,33.82,52.03,43.24,54.12,45.02z"/> c-4.67,0.17-9.09,0.84-13.21,1.97C51.23,33.82,52.03,43.24,54.12,45.02z"/>
<path style="opacity:0.47;fill:#FF7043;" d="M73.88,45.02c-1.13,0.96-3.42,0.82-4.75-0.72c-1.61-1.87-3.29-8.17-2.24-17.91 <path style="opacity:0.47;fill:#FF7043;" d="M73.88,45.02c-1.13,0.96-3.42,0.82-4.75-0.72c-1.61-1.87-3.29-8.17-2.24-17.91
c4.67,0.17,9.09,0.84,13.21,1.97C76.77,33.82,75.97,43.24,73.88,45.02z"/> c4.67,0.17,9.09,0.84,13.21,1.97C76.77,33.82,75.97,43.24,73.88,45.02z"/>
<path d="M55.96,74.54c-0.05-2.86,4.06-4.24,7.95-4.3s8.07,1.2,8.12,4.06c0.05,2.86-4.86,6.64-7.95,6.64
C61,80.94,56.01,77.4,55.96,74.54z"/>
<g> <g>
<g> <g>
<path style="fill:none;stroke:#9E9E9E;stroke-width:3;stroke-linecap:round;stroke-miterlimit:10;" d="M4.12,74.76
<line style="fill:none;stroke:#9E9E9E;stroke-width:3;stroke-linecap:round;stroke-miterlimit:10;" x1="6.09" y1="64.82" x2="21.19" y2="72.26"/> c0,0,6.65-5.17,17.94-5.07"/>
<path style="fill:none;stroke:#9E9E9E;stroke-width:3;stroke-linecap:round;stroke-miterlimit:10;" d="M5.58,89.09
<line style="fill:none;stroke:#9E9E9E;stroke-width:3;stroke-linecap:round;stroke-miterlimit:10;" x1="3.99" y1="77.03" x2="22.14" y2="80.18"/> c0,0,4.63-10.06,17.75-12.32"/>
<path style="fill:none;stroke:#9E9E9E;stroke-width:3;stroke-linecap:round;stroke-miterlimit:10;" d="M15.04,98.29
c0,0,3.31-10.47,10.24-14.73"/>
</g> </g>
<g> <g>
<path style="fill:none;stroke:#9E9E9E;stroke-width:3;stroke-linecap:round;stroke-miterlimit:10;" d="M123.88,74.76
<line style="fill:none;stroke:#9E9E9E;stroke-width:3;stroke-linecap:round;stroke-miterlimit:10;" x1="121.91" y1="64.82" x2="106.81" y2="72.26"/> c0,0-6.65-5.17-17.94-5.07"/>
<path style="fill:none;stroke:#9E9E9E;stroke-width:3;stroke-linecap:round;stroke-miterlimit:10;" d="M122.42,89.09
<line style="fill:none;stroke:#9E9E9E;stroke-width:3;stroke-linecap:round;stroke-miterlimit:10;" x1="124.01" y1="77.03" x2="105.86" y2="80.18"/> c0,0-4.63-10.06-17.75-12.32"/>
<path style="fill:none;stroke:#9E9E9E;stroke-width:3;stroke-linecap:round;stroke-miterlimit:10;" d="M112.96,98.29
c0,0-3.31-10.47-10.24-14.73"/>
</g> </g>
</g> </g>
<g> <g>
<g> <path d="M33.78,61.77c0.33-1.63,1.45-3.65,3.63-4.37c3.75-1.25,6.53-2.5,7.94-3.18c0.58-0.28,1.26,0.02,1.45,0.63
<path d="M32.56,70.26c-0.3,0-0.6-0.06-0.89-0.19c-1.12-0.49-1.64-1.8-1.14-2.92c0.35-0.8,3.6-7.85,9.35-7.85 c0.36,1.17,0.88,3.13,1.13,5.49c0.57,5.25-3.06,8.44-6.99,8.68C36.34,69.3,33.06,65.37,33.78,61.77z"/>
c5.68,0,9.17,6.74,9.55,7.51c0.54,1.1,0.09,2.43-1.01,2.97c-1.1,0.54-2.17-0.12-2.97-1.01c-0.97-1.08-3.08-3.5-5.57-3.5 <path d="M94.22,61.77c-0.33-1.63-1.45-3.65-3.63-4.37c-3.75-1.25-6.53-2.5-7.94-3.18c-0.58-0.28-1.26,0.02-1.45,0.63
c-2.5,0-4.58,2.59-5.28,3.65C34.09,69.69,33.41,70.26,32.56,70.26z"/> c-0.36,1.17-0.88,3.13-1.13,5.49c-0.57,5.25,3.06,8.44,6.99,8.68C91.66,69.3,94.94,65.37,94.22,61.77z"/>
</g> </g>
<path d="M65.98,83.98v-4.45h-4v4.44c0,2.41-1.29,4.59-3.31,5.91c-4.03,2.63-6.07,4.8-7.95,7.01c-1.18,1.38-0.67,3.51,1.01,4.2h0
c1.23,0.51,2.65,0.05,3.32-1.11c1.76-3.05,5.07-7.3,8.94-7.3c3.76,0,7,4.03,8.79,7.06c0.74,1.24,2.32,1.67,3.58,0.98l0.18-0.1
c1.52-0.84,1.85-2.88,0.67-4.16c-1.85-2.01-4.71-4.39-7.9-6.58C67.32,88.52,65.98,86.39,65.98,83.98z"/>
<g> <g>
<path d="M95.44,70.26c0.3,0,0.6-0.06,0.89-0.19c1.12-0.49,1.64-1.8,1.14-2.92c-0.35-0.8-3.6-7.85-9.35-7.85 <g>
c-5.68,0-9.17,6.74-9.55,7.51c-0.54,1.1-0.09,2.43,1.01,2.97c1.1,0.54,2.17-0.12,2.97-1.01c0.97-1.08,3.08-3.5,5.57-3.5 <g>
c2.5,0,4.58,2.59,5.28,3.65C93.91,69.69,94.59,70.26,95.44,70.26z"/> <path style="fill:#28B3F2;" d="M34.78,73.43c0.66-1.34,2.53-1.33,3.18,0.01c2.21,4.59,6.11,13.13,7.45,19.02
c2.01,8.81-2.13,17.11-9.19,16.95c-8.86-0.19-12.26-10.61-8.85-19.71C29.04,85.27,32.68,77.71,34.78,73.43z"/>
</g> </g>
</g> </g>
<path d="M55.96,76.98c-0.05-2.86,4.06-4.24,7.95-4.3c3.89-0.07,8.07,1.2,8.12,4.06s-4.86,6.64-7.95,6.64S56.01,79.84,55.96,76.98z" <path style="fill:#0277BD;" d="M40.15,107.38c-8.86,0.59-12.97-9.19-10.19-18.3c1.35-4.43,4.47-12.07,6.27-16.39
/> c0.04-0.1,0.1-0.17,0.15-0.26c-0.63,0-1.27,0.33-1.6,1c-2.1,4.28-5.74,11.84-7.4,16.27c-3.41,9.1-0.01,19.52,8.85,19.71
<path style="fill:#FFFFFF;" d="M90.06,90.38c-1.64-1.67-4.29-2.16-6.75-1.24c-2.71,1.02-11,4.13-15.22,1.45 c2.39,0.05,4.44-0.88,6.03-2.46C41.59,107.17,40.9,107.33,40.15,107.38z"/>
c-3.71-2.35-3.51-7.13-3.51-7.13h-1.57c0,0,0.25,5.21-3.11,7.13c-4.35,2.5-12.51-0.44-15.22-1.45c-2.45-0.92-5.1-0.43-6.75,1.24 <path style="fill:#81D4FA;" d="M39.27,85.81c2.04-0.03,3.51,4.44,3.77,9.56c0.31,6.08-4.78,7.54-6.05,1.85
c-1.55,1.57-1.82,3.82-0.72,5.88c2.32,4.35,10.58,11.71,26.78,11.77c16.2-0.05,24.46-7.42,26.78-11.77 C36.06,93.07,37.18,85.84,39.27,85.81z"/>
C91.88,94.2,91.61,91.95,90.06,90.38z"/>
<path d="M91.58,88.8c-1.74-1.89-4.54-2.44-7.14-1.4c-2.87,1.15-11.64,4.68-16.11,1.64c-3.93-2.66-2.33-6.8-2.33-6.8h-4
c0,0,1.22,4.62-2.33,6.8c-4.61,2.83-13.24-0.5-16.11-1.64c-2.6-1.04-5.4-0.49-7.14,1.4c-1.64,1.78-1.93,4.33-0.76,6.66
c2.46,4.92,11.2,13.26,28.34,13.32c17.15-0.06,25.88-8.4,28.34-13.32C93.51,93.13,93.22,90.58,91.58,88.8z M89.66,94.12
c-2.01,4.01-9.95,11.61-25.66,11.66c-15.71-0.06-23.65-7.65-25.66-11.66c-0.61-1.23-0.51-2.43,0.28-3.29
c0.57-0.62,1.4-0.95,2.3-0.95c0.49,0,1.01,0.1,1.52,0.3c5.61,2.25,13.68,4.83,18.89,1.36c1.2-0.8,2.04-1.46,2.64-2
c0.01,0.01,0.02,0.02,0.03,0.02c0.01-0.01,0.02-0.02,0.03-0.02c0.6,0.54,1.45,1.2,2.64,2c5.21,3.47,13.28,0.89,18.89-1.36
c0.51-0.2,1.02-0.3,1.52-0.3c0.9,0,1.73,0.33,2.3,0.95C90.17,91.7,90.27,92.89,89.66,94.12z"/>
<g>
<line style="fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;" x1="42.93" y1="89.54" x2="42.93" y2="101.87"/>
<line style="fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;" x1="53.47" y1="91.5" x2="53.47" y2="105.15"/>
<line style="fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;" x1="64" y1="86.8" x2="64" y2="106.71"/>
<line style="fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;" x1="85.07" y1="88.39" x2="85.07" y2="100.72"/>
<line style="fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;" x1="74.53" y1="90.48" x2="74.53" y2="104.66"/>
</g>
<g>
<g>
<g>
<g>
<g>
<path style="fill:#28B3F2;" d="M99.01,75.05c-0.25-0.56,0.2-1.18,0.82-1.11c3.71,0.4,13.83,2.22,20,10.38
c3.52,4.65,4.72,13.12-0.49,17c-6.36,4.73-13.99,0.35-15.15-5.36c-0.88-4.33-1.38-8.5-2.13-11.49
C100.82,79.51,99.67,76.54,99.01,75.05z"/>
</g>
</g>
<path style="fill:#0277BD;" d="M120.9,98.21c-6.44,4.61-13.12,1.04-14.58-5.32c0,0-1.65-7.51-2.75-10.71
c-1.75-5.13-4.42-7.98-4.42-7.98s-0.36,0.36-0.14,0.86c0.66,1.5,1.81,4.46,3.05,9.42c0.75,2.99,1.25,7.16,2.13,11.49
c1.16,5.72,8.79,10.09,15.15,5.36c1.78-1.32,2.79-3.18,3.24-5.24C122.18,96.94,121.63,97.68,120.9,98.21z"/>
<path style="fill:#81D4FA;" d="M113.51,83.7c1.88-0.94,5.42,0.81,7.06,5.49c1.68,4.83-1.6,7.81-4.9,4.1
C113.26,90.6,111.6,84.66,113.51,83.7z"/>
</g> </g>
</g> </g>
<g> <g>
<g> <g>
<g> <g>
<g> <g>
<path style="fill:#28B3F2;" d="M28.99,75.05c0.25-0.56-0.2-1.18-0.82-1.11c-3.71,0.4-13.83,2.22-20,10.38 <path style="fill:#FFC022;" d="M19.91,58.62C5.73,40.06,4.92,22.48,6.11,16.64c0.51-2.49,2.71-3.93,5.17-4.05
c-3.52,4.65-4.72,13.12,0.49,17c6.36,4.73,13.99,0.35,15.15-5.36c0.88-4.33,1.38-8.5,2.13-11.49 c5.59-0.26,20.9,4.06,34.85,16.48L19.91,58.62z"/>
C27.18,79.51,28.33,76.54,28.99,75.05z"/>
</g>
</g>
<path style="fill:#0277BD;" d="M7.1,98.21c6.44,4.61,13.12,1.04,14.58-5.32c0,0,1.65-7.51,2.75-10.71
c1.75-5.13,4.42-7.98,4.42-7.98s0.36,0.36,0.14,0.86c-0.66,1.5-1.81,4.46-3.05,9.42c-0.75,2.99-1.25,7.16-2.13,11.49
c-1.16,5.72-8.79,10.09-15.15,5.36c-1.78-1.32-2.79-3.18-3.24-5.24C5.82,96.94,6.37,97.68,7.1,98.21z"/>
<path style="fill:#81D4FA;" d="M14.49,83.7c-1.88-0.94-5.42,0.81-7.06,5.49c-1.68,4.83,1.6,7.81,4.9,4.1
C14.74,90.6,16.4,84.66,14.49,83.7z"/>
</g>
</g> </g>
</g> </g>
<g> <g>
<path style="fill:#FFD1D1;" d="M92.16,36.23c-1.54-1.29-1.5-3.37-0.6-5.16c2.16-4.31,7.33-8.78,9.16-10.23 <path style="fill:#FFD1D1;" d="M15.22,23.77c-0.65-0.2-1.3,0.3-1.29,0.97c0.06,5.09,0.64,11.37,6.85,20.03
c3-2.38,5.32-3.18,6.21,0.65c1.65,7.08,1.52,16.69-0.25,21.99c-0.62,1.87-2.54,2.86-4.02,1.57L92.16,36.23z"/> c0.95,1.33,2.08,3.09,4.77,0.13c1.49-1.64,5.92-6.36,5.92-6.36c1.19-1.07,3.61-2.94,1.86-4.58
C33.25,33.89,26.71,27.3,15.22,23.77z"/>
</g>
</g>
<g>
<g>
<g>
<path style="fill:#FFC022;" d="M108.09,58.62c14.18-18.56,14.99-36.15,13.8-41.98c-0.51-2.49-2.71-3.93-5.17-4.05
c-5.59-0.26-20.9,4.06-34.85,16.48L108.09,58.62z"/>
</g>
</g>
<g>
<path style="fill:#FFD1D1;" d="M112.78,23.77c0.65-0.2,1.3,0.3,1.29,0.97c-0.06,5.09-0.64,11.37-6.85,20.03
c-0.95,1.33-2.08,3.09-4.77,0.13c-1.49-1.64-5.92-6.36-5.92-6.36c-1.19-1.07-3.61-2.94-1.86-4.58
C94.75,33.89,101.29,27.3,112.78,23.77z"/>
</g>
</g>
</g> </g>
<path style="fill:#FFD1D1;" d="M35.84,36.23c1.54-1.29,1.5-3.37,0.6-5.16c-2.16-4.31-7.33-8.78-9.16-10.23
c-3-2.38-5.32-3.18-6.21,0.65c-1.65,7.08-1.52,16.69,0.25,21.99c0.62,1.87,2.54,2.86,4.02,1.57L35.84,36.23z"/>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@@ -193,17 +193,37 @@ formulaire.addEventListener('submit', async (e) => {
conversation.appendChild(citation); conversation.appendChild(citation);
formulaire.reset(); formulaire.reset();
const paragraphe = document.createElement('p'); let paragraphe = document.createElement('p');
paragraphe.setAttribute("aria-busy", "true"); paragraphe.setAttribute("aria-busy", "true");
conversation.appendChild(paragraphe); conversation.appendChild(paragraphe);
conversation.scrollTop = conversation.scrollHeight; conversation.scrollTop = conversation.scrollHeight;
paragraphe.setAttribute('aria-busy', 'true');
let reponse
try {
const requete = await fetch(formulaire.action, { const requete = await fetch(formulaire.action, {
method: formulaire.method, method: formulaire.method,
body: formulaireData body: formulaireData
}); });
paragraphe.setAttribute('aria-busy', 'true'); reponse = await requete.text();
const reponse = await requete.text(); } catch (error) {
paragraphe.setAttribute('aria-busy', 'false');
paragraphe = document.createElement('p');
paragraphe.innerHTML = "😿 <em>Je ne suis pas disponible pour le moment. Merci de laisser un message !</em>";
favicon.href = 'cat-tears.svg';
conversation.appendChild(paragraphe);
document.scrollingElement.scrollBy({top: window.visualViewport.height, behavior: 'smooth'});
bouton_envoyer.disabled = false;
bouton_envoyer.setAttribute("aria-busy", false);
bouton_envoyer.innerHTML = bouton_envoyer_innerHTML;
question.focus();
question.onfocus();
return
}
paragraphe.setAttribute('aria-busy', 'false'); paragraphe.setAttribute('aria-busy', 'false');
nb_reponses++; nb_reponses++;
@@ -214,6 +234,8 @@ formulaire.addEventListener('submit', async (e) => {
let t = 0; let t = 0;
Array.from(reponse).forEach((lettre, i) => { Array.from(reponse).forEach((lettre, i) => {
t += 100 * Math.random()
if (lettre == " ") t += 100
setTimeout(() => { setTimeout(() => {
if (lettre == "\n") { if (lettre == "\n") {
paragraphe.innerHTML += "<br>"; paragraphe.innerHTML += "<br>";
@@ -222,12 +244,12 @@ formulaire.addEventListener('submit', async (e) => {
} }
document.scrollingElement.scrollBy({top: window.visualViewport.height, behavior: 'smooth'}); document.scrollingElement.scrollBy({top: window.visualViewport.height, behavior: 'smooth'});
}, t += 100 * Math.random()); }, t);
}); });
setTimeout(() => { setTimeout(() => {
const paragraphe = document.createElement('p'); const paragraphe = document.createElement('p');
paragraphe.innerHTML = (nb_reponses % 5 ? '😸' : '😹') + ' Voulez-vous que je réponde à une autre question ?'; paragraphe.innerHTML = (nb_reponses % 5 ? '😸' : '😹') + ' Voulez-vous que je réponde à une autre question ?';
favicon.href = (nb_reponses % 5 ? 'cat-troll.svg' : 'cat-tears.svg'); favicon.href = (nb_reponses % 5 ? 'cat-troll.svg' : 'cat-lol.svg');
conversation.appendChild(paragraphe); conversation.appendChild(paragraphe);
document.scrollingElement.scrollBy({top: window.visualViewport.height, behavior: 'smooth'}); document.scrollingElement.scrollBy({top: window.visualViewport.height, behavior: 'smooth'});
@@ -335,6 +357,8 @@ window.onresize = function() {
} }
window.visualViewport?.addEventListener('resize', window.onresize); window.visualViewport?.addEventListener('resize', window.onresize);
window.onresize(); window.onresize();
navigator?.serviceWorker.register('service-worker.js')
</script> </script>
</body> </body>

86
service-worker.js Normal file
View File

@@ -0,0 +1,86 @@
/*
Copyright 2015, 2019, 2020 Google LLC. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Incrementing OFFLINE_VERSION will kick off the install event and force
// previously cached resources to be updated from the network.
const OFFLINE_VERSION = 1;
const CACHE_NAME = "offline";
// Customize this with a different URL if needed.
const OFFLINE_URL = "index.html";
self.addEventListener("install", (event) => {
event.waitUntil(
(async () => {
const cache = await caches.open(CACHE_NAME);
// Setting {cache: 'reload'} in the new request will ensure that the
// response isn't fulfilled from the HTTP cache; i.e., it will be from
// the network.
await cache.add(new Request(OFFLINE_URL, { cache: "reload" }));
})()
);
// Force the waiting service worker to become the active service worker.
self.skipWaiting();
});
self.addEventListener("activate", (event) => {
event.waitUntil(
(async () => {
// Enable navigation preload if it's supported.
// See https://developers.google.com/web/updates/2017/02/navigation-preload
if ("navigationPreload" in self.registration) {
await self.registration.navigationPreload.enable();
}
})()
);
// Tell the active service worker to take control of the page immediately.
self.clients.claim();
});
self.addEventListener("fetch", (event) => {
// We only want to call event.respondWith() if this is a navigation request
// for an HTML page.
if (event.request.mode === "navigate") {
event.respondWith(
(async () => {
try {
// First, try to use the navigation preload response if it's supported.
const preloadResponse = await event.preloadResponse;
if (preloadResponse) {
return preloadResponse;
}
// Always try the network first.
const networkResponse = await fetch(event.request);
return networkResponse;
} catch (error) {
// catch is only triggered if an exception is thrown, which is likely
// due to a network error.
// If fetch() returns a valid HTTP response with a response code in
// the 4xx or 5xx range, the catch() will NOT be called.
console.log("Fetch failed; returning offline page instead.", error);
const cache = await caches.open(CACHE_NAME);
const cachedResponse = await cache.match(OFFLINE_URL);
return cachedResponse;
}
})()
);
}
// If our if() condition is false, then this fetch handler won't intercept the
// request. If there are any other fetch handlers registered, they will get a
// chance to call event.respondWith(). If no fetch handlers call
// event.respondWith(), the request will be handled by the browser as if there
// were no service worker involvement.
});