Changeset 76f0e61 in Klonkt
- Timestamp:
- 06/26/2026 03:32:31 PM (2 months ago)
- Branches:
- main
- Children:
- b8bbe77
- Parents:
- a036251
- Location:
- src
- Files:
-
- 2 edited
-
server.js (modified) (1 diff)
-
views/shell.ejs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/server.js
ra036251 r76f0e61 395 395 res.set('Cache-Control', 'no-cache'); 396 396 res.send(` 397 const CACHE_VERSION = 'pcms-v1 1-' + new Date().toISOString().split('T')[0];397 const CACHE_VERSION = 'pcms-v12-' + new Date().toISOString().split('T')[0]; 398 398 self.addEventListener('install', e => { 399 399 e.waitUntil(caches.open(CACHE_VERSION).then(c => c.addAll(['/']))); -
src/views/shell.ejs
ra036251 r76f0e61 200 200 <link rel="stylesheet" href="/assets/css/style.css?v=54"> 201 201 <script> 202 /* iOS safe-area, built by hand: env(safe-area-inset-top) resolves to 0 in some iOS 203 states (Safari + standalone) even with viewport-fit=cover. Measure it directly, and 204 if it comes back empty on a notch/Dynamic-Island iPhone, fall back to a fixed inset. 205 The masthead reads --ios-safe-top. */ 202 /* iOS safe-area, built by hand. env(safe-area-inset-top) resolves to 0 on this iOS in 203 BOTH Safari and the installed PWA (standalone), even with viewport-fit=cover, so the 204 masthead can't clear the camera. We measure env directly and, when it comes back empty 205 on a notched iPhone, fall back to a fixed inset (a bit larger in standalone for the 206 Dynamic Island). We set --ios-safe-top AND force the masthead padding inline — the 207 latter survives a stale cached stylesheet that lacks the var. Re-applied after htmx 208 chrome swaps (the top-nav is out-of-band swapped on navigation). */ 206 209 (function(){ 207 210 var ua = navigator.userAgent || ''; 208 211 var isIOS = /iP(hone|od|ad)/.test(ua) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1); 209 212 if (!isIOS) return; 210 function setInset(){ 213 var standalone = (window.matchMedia && window.matchMedia('(display-mode: standalone)').matches) || navigator.standalone === true; 214 function apply(){ 211 215 if (!document.body) return; 212 216 var p = document.createElement('div'); … … 215 219 var i = parseFloat(getComputedStyle(p).paddingTop) || 0; 216 220 p.remove(); 217 // env() gave nothing but this looks like a notched iPhone (logical height >= 812) 218 // -> use a fixed status-bar inset so the masthead clears the camera anyway. 219 if (i < 20 && Math.max(screen.width, screen.height) >= 812) i = 50; 221 if (i < 20 && Math.max(screen.width, screen.height) >= 812) i = standalone ? 59 : 47; 220 222 document.documentElement.style.setProperty('--ios-safe-top', i + 'px'); 221 } 222 if (document.body) setInset(); else document.addEventListener('DOMContentLoaded', setInset); 223 window.addEventListener('orientationchange', function(){ setTimeout(setInset, 250); }); 223 var mh = document.querySelector('.masthead'); 224 if (mh) mh.style.paddingTop = 'calc(.55rem + ' + i + 'px)'; 225 } 226 if (document.body) apply(); else document.addEventListener('DOMContentLoaded', apply); 227 document.addEventListener('htmx:afterSettle', apply); 228 window.addEventListener('orientationchange', function(){ setTimeout(apply, 250); }); 224 229 })(); 225 230 </script>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)