|
22 | 22 | <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
23 | 23 | <link href="https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;700&family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
24 | 24 | <title>Hora de Silêncio Interrompido</title>
|
| 25 | + <meta name="theme-color" content="#FFD700"> |
| 26 | + <meta name="apple-mobile-web-app-capable" content="yes"> |
| 27 | + <meta name="mobile-web-app-capable" content="yes"> |
| 28 | + <link rel="manifest" href="/manifest.json"> |
25 | 29 | </head>
|
26 | 30 | <body>
|
27 | 31 | <div id="root"></div>
|
28 | 32 | <script type="module" src="/src/main.tsx"></script>
|
| 33 | + <script> |
| 34 | + const icon = '/logo.png'; |
| 35 | + const color = '#FFD700'; |
| 36 | + const deviceWidth = screen.width; |
| 37 | + const deviceHeight = screen.height; |
| 38 | + const pixelRatio = window.devicePixelRatio || 1; |
| 39 | + const canvas = document.createElement('canvas'); |
| 40 | + const canvas2 = document.createElement('canvas'); |
| 41 | + const ctx = canvas.getContext('2d'); |
| 42 | + const ctx2 = canvas2.getContext('2d'); |
| 43 | + const iconImage = new Image(); |
| 44 | + iconImage.onerror = function () { |
| 45 | + throw new Error('Failed to load icon image'); |
| 46 | + }; |
| 47 | + iconImage.src = icon; |
| 48 | + iconImage.onload = function () { |
| 49 | + const iconSizew = iconImage.width / (3 / pixelRatio); |
| 50 | + const iconSizeh = iconImage.height / (3 / pixelRatio); |
| 51 | + canvas.width = deviceWidth * pixelRatio; |
| 52 | + canvas2.height = canvas.width; |
| 53 | + canvas.height = deviceHeight * pixelRatio; |
| 54 | + canvas2.width = canvas.height; |
| 55 | + ctx.fillStyle = color; |
| 56 | + ctx2.fillStyle = color; |
| 57 | + ctx.fillRect(0, 0, canvas.width, canvas.height); |
| 58 | + ctx2.fillRect(0, 0, canvas2.width, canvas2.height); |
| 59 | + const x = (canvas.width - iconSizew) / 2; |
| 60 | + const y = (canvas.height - iconSizeh) / 2; |
| 61 | + const x2 = (canvas2.width - iconSizew) / 2; |
| 62 | + const y2 = (canvas2.height - iconSizeh) / 2; |
| 63 | + ctx.drawImage(iconImage, x, y, iconSizew, iconSizeh); |
| 64 | + ctx2.drawImage(iconImage, x2, y2, iconSizew, iconSizeh); |
| 65 | + const imageDataURL = canvas.toDataURL('image/png'); |
| 66 | + const imageDataURL2 = canvas2.toDataURL('image/png'); |
| 67 | + const appleTouchStartupImageLink = document.createElement('link'); |
| 68 | + appleTouchStartupImageLink.setAttribute('rel', 'apple-touch-startup-image'); |
| 69 | + appleTouchStartupImageLink.setAttribute('media', "screen and (orientation: portrait)"); |
| 70 | + appleTouchStartupImageLink.setAttribute('href', imageDataURL); |
| 71 | + document.head.appendChild(appleTouchStartupImageLink); |
| 72 | + const appleTouchStartupImageLink2 = document.createElement('link'); |
| 73 | + appleTouchStartupImageLink2.setAttribute('rel', 'apple-touch-startup-image'); |
| 74 | + appleTouchStartupImageLink2.setAttribute('media', "screen and (orientation: landscape)"); |
| 75 | + appleTouchStartupImageLink2.setAttribute('href', imageDataURL2); |
| 76 | + document.head.appendChild(appleTouchStartupImageLink2); |
| 77 | + }; |
| 78 | + </script> |
| 79 | + <noscript id="noscript">This app works best with JavaScript enabled.</noscript> |
29 | 80 | </body>
|
30 | 81 | </html>
|
0 commit comments