|
37 | 37 | } |
38 | 38 | })(); |
39 | 39 | }); |
40 | | - promise.skip = skip; |
41 | 40 | return { promise: promise, skip: skip }; |
42 | 41 | } |
43 | 42 |
|
| 43 | + // sessionStorage helpers — silently degrade when storage is blocked/sandboxed. |
| 44 | + function booted() { try { return sessionStorage.getItem('mkcertos_booted') === '1'; } catch (e) { return false; } } |
| 45 | + function markBooted() { try { sessionStorage.setItem('mkcertos_booted', '1'); } catch (e) {} } |
| 46 | + |
44 | 47 | // --- Boot sequence --- |
45 | 48 | function runBoot() { |
46 | 49 | var boot = document.getElementById('boot'); |
|
53 | 56 | window.removeEventListener('click', onSkip); |
54 | 57 | } |
55 | 58 | var t; |
56 | | - function onSkip() { if (t) t.skip(); sessionStorage.setItem('mkcertos_booted', '1'); dismiss(); } |
| 59 | + function onSkip() { if (t) t.skip(); markBooted(); dismiss(); } |
57 | 60 |
|
58 | 61 | // Skip entirely if already booted this session or reduced motion. |
59 | | - if (sessionStorage.getItem('mkcertos_booted') === '1' || reduceMotion) { |
| 62 | + if (booted() || reduceMotion) { |
60 | 63 | return; |
61 | 64 | } |
62 | 65 |
|
|
79 | 82 | window.addEventListener('click', onSkip); |
80 | 83 | t = typeLines(textEl, lines, { speed: 14, linePause: 160 }); |
81 | 84 | t.promise.then(function () { |
82 | | - sessionStorage.setItem('mkcertos_booted', '1'); |
| 85 | + markBooted(); |
83 | 86 | setTimeout(dismiss, 650); |
84 | 87 | }); |
85 | 88 | } |
|
146 | 149 | window.MKCERTOS = { typeLines: typeLines, reduceMotion: reduceMotion }; |
147 | 150 |
|
148 | 151 | document.addEventListener('DOMContentLoaded', function () { |
149 | | - runBoot(); |
150 | | - var tagline = document.getElementById('hero-tagline'); |
151 | | - if (tagline) { |
152 | | - window.MKCERTOS.typeLines(tagline, ['Local TLS, minus the pain.'], |
153 | | - { speed: 38, linePause: 0 }); |
154 | | - } |
155 | | - initCopyButtons(); |
156 | | - initConsole(); |
| 152 | + try { runBoot(); } catch (e) {} |
| 153 | + try { |
| 154 | + var tagline = document.getElementById('hero-tagline'); |
| 155 | + if (tagline) { |
| 156 | + window.MKCERTOS.typeLines(tagline, ['Local TLS, minus the pain.'], |
| 157 | + { speed: 38, linePause: 0 }); |
| 158 | + } |
| 159 | + } catch (e) {} |
| 160 | + try { initCopyButtons(); } catch (e) {} |
| 161 | + try { initConsole(); } catch (e) {} |
157 | 162 | }); |
158 | 163 | })(); |
0 commit comments