File tree Expand file tree Collapse file tree 3 files changed +59
-4
lines changed Expand file tree Collapse file tree 3 files changed +59
-4
lines changed Original file line number Diff line number Diff line change 1- const cacheName = "cache2 " ;
1+ const cacheName = "cache7 " ;
22
33self . addEventListener ( "install" , ( event ) => {
44 self . skipWaiting ( ) ;
@@ -9,6 +9,8 @@ self.addEventListener("install", (event) => {
99 "/" ,
1010 "favicon.ico" ,
1111 "index.html" ,
12+ "schedule/talks/index.html" ,
13+ "schedule/speakers/index.html" ,
1214 "main.js" ,
1315 "manifest.json" ,
1416 "style.css" ,
Original file line number Diff line number Diff line change 1+ ---
2+
3+ ---
4+ <div id =" offline-icon" class =" offline-icon" >
5+ <i class =" fas plug-circle-xmark" ></i > Offline
6+ </div >
7+ <script is:inline >
8+
9+ document.addEventListener('DOMContentLoaded', () => {
10+ const offlineIcon = document.getElementById('offline-icon');
11+
12+ function updateOnlineStatus() {
13+ console.log('offline');
14+ offlineIcon.classList.toggle('show', !navigator.onLine);
15+ }
16+
17+ window.addEventListener('online', updateOnlineStatus);
18+ window.addEventListener('offline', updateOnlineStatus);
19+
20+ // Initial check
21+ updateOnlineStatus();
22+ }
23+ );
24+ </script >
25+
26+ <style >
27+ .offline-icon {
28+ position: fixed;
29+ bottom: 10px;
30+ right: 10px;
31+ z-index: 9999;
32+ background: #ffe0e0;
33+ color: #a00;
34+ padding: 8px 12px;
35+ border-radius: 8px;
36+ border: 1px solid #a00;
37+ font-family: sans-serif;
38+ font-size: 14px;
39+ font-weight: bold;
40+ display: flex;
41+ align-items: center;
42+ gap: 6px;
43+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
44+ opacity: 0;
45+ pointer-events: none;
46+ transition: opacity 0.3s ease;
47+ }
48+
49+ .offline-icon.show {
50+ opacity: 1;
51+ pointer-events: auto;
52+ }
53+ </style >
Original file line number Diff line number Diff line change 22import BaseHead from " @components/BaseHead.astro" ;
33import Header from " @components/Header.astro" ;
44import Footer from " @components/Footer.astro" ;
5-
5+ import Offline from " @components/Offline.astro " ;
66
77import " @src/styles/global.css" ;
88import " @src/styles/search.css" ;
@@ -33,21 +33,21 @@ const externalDomain = new URL(Astro.site || "").hostname;
3333 <meta name =" theme-color" content =" #6200ee" />
3434 <link rel =" apple-touch-icon" href =" /icons/icon-192x192.png" />
3535 </Fragment >
36-
36+ </ head >
3737 <body >
3838 <header >
3939 <Header />
4040 </header >
4141
4242 <main class =" main pt-28" role =" main" >
43+ <Offline />
4344 <slot />
4445 </main >
4546
4647 <footer >
4748 <Footer />
4849 </footer >
4950
50-
5151 </body >
5252</html >
5353
You can’t perform that action at this time.
0 commit comments