Layout + SW: Tab-Leiste sichtbar + kein veralteter Cache
- main-content padding-top auf calc(var(--nav-h) + 0.75rem) erhöht damit die Tab-Leiste (Radio/Focus/Podcasts/Books) sicher unterhalb der fixed Navbar liegt — auf Desktop und Mobile - SW v10: sendet SW_ACTIVATED an alle offenen Tabs wenn ein neuer SW übernimmt; app.js lädt daraufhin neu (außer wenn ein Buch geöffnet ist) — verhindert dass der Browser eine uralte HTTP-gecachte Version ausliefert Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
aa562f8b4d
commit
d7a27b188d
3 changed files with 18 additions and 4 deletions
|
|
@ -149,8 +149,8 @@ a:hover {
|
|||
.main-content {
|
||||
max-width: 1100px;
|
||||
margin: 0 auto;
|
||||
padding: 1rem 1.5rem calc(var(--bar-h) + 2rem);
|
||||
height: calc(100% - var(--nav-h));
|
||||
padding: calc(var(--nav-h) + 0.75rem) 1.5rem calc(var(--bar-h) + 2rem);
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
|
|
@ -736,7 +736,7 @@ a:hover {
|
|||
|
||||
@media (max-width: 600px) {
|
||||
.main-content {
|
||||
padding: 0.75rem 0.75rem calc(var(--bar-h) + 1.5rem);
|
||||
padding: calc(var(--nav-h) + 0.5rem) 0.75rem calc(var(--bar-h) + 1.5rem);
|
||||
}
|
||||
|
||||
.now-playing-bar {
|
||||
|
|
|
|||
|
|
@ -2213,6 +2213,13 @@ if ('serviceWorker' in navigator) {
|
|||
console.warn('Service worker registration failed:', err);
|
||||
});
|
||||
});
|
||||
// When a new SW activates it sends SW_ACTIVATED — reload to get fresh assets,
|
||||
// but only if the reader isn't open (would interrupt reading).
|
||||
navigator.serviceWorker.addEventListener('message', e => {
|
||||
if (e.data?.type === 'SW_ACTIVATED' && !currentBookId) {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* diora service worker — caches the app shell for offline use.
|
||||
*/
|
||||
|
||||
const CACHE = 'diora-v9';
|
||||
const CACHE = 'diora-v10';
|
||||
const PODCAST_CACHE = 'diora-podcast-v1';
|
||||
const SHELL = [
|
||||
'/static/css/app.css',
|
||||
|
|
@ -31,6 +31,13 @@ self.addEventListener('activate', function (event) {
|
|||
);
|
||||
}).then(function () {
|
||||
return self.clients.claim();
|
||||
}).then(function () {
|
||||
// Tell all open tabs to reload so they get the latest cached assets
|
||||
return self.clients.matchAll({type: 'window'}).then(function (clients) {
|
||||
clients.forEach(function (client) {
|
||||
client.postMessage({type: 'SW_ACTIVATED'});
|
||||
});
|
||||
});
|
||||
})
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue