Repository navigation
Expand file tree
/
Copy pathoffline.html
More file actions
173 lines (152 loc) · 4.15 KB
/
Copy pathoffline.html
File metadata and controls
173 lines (152 loc) · 4.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>离线 - WebUtils</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--bg: #0a0a0f;
--text: #e8e8ed;
--text-muted: #8888a0;
--accent: #00f5d4;
}
@media (prefers-color-scheme: light) {
:root {
--bg: #f5f5f7;
--text: #1a1a2e;
--text-muted: #666;
--accent: #06c;
}
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background: var(--bg);
color: var(--text);
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 20px;
text-align: center;
}
.container {
max-width: 400px;
}
.icon {
font-size: 4rem;
margin-bottom: 1.5rem;
animation: float 3s ease-in-out infinite;
}
@keyframes float {
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(-10px);
}
}
h1 {
font-size: 1.5rem;
margin-bottom: 1rem;
}
p {
color: var(--text-muted);
margin-bottom: 2rem;
line-height: 1.6;
}
.retry-btn {
background: var(--accent);
color: #000;
border: none;
padding: 12px 24px;
font-size: 1rem;
font-weight: 500;
border-radius: 8px;
cursor: pointer;
transition:
transform 0.2s,
opacity 0.2s;
}
.retry-btn:hover {
transform: scale(1.05);
}
.retry-btn:active {
transform: scale(0.98);
}
.cached-tools {
margin-top: 3rem;
padding-top: 2rem;
border-top: 1px solid rgba(136, 136, 160, 0.2);
}
.cached-tools h2 {
font-size: 1rem;
color: var(--text-muted);
margin-bottom: 1rem;
}
.cached-list {
display: flex;
flex-wrap: wrap;
gap: 8px;
justify-content: center;
}
.cached-link {
background: rgba(136, 136, 160, 0.1);
color: var(--text);
text-decoration: none;
padding: 8px 12px;
border-radius: 6px;
font-size: 0.875rem;
transition: background 0.2s;
}
.cached-link:hover {
background: rgba(136, 136, 160, 0.2);
}
</style>
</head>
<body>
<div class="container">
<div class="icon">📡</div>
<h1>您当前处于离线状态</h1>
<p>无法连接到网络。请检查您的网络连接后重试。</p>
<button class="retry-btn" onclick="location.reload()">重试连接</button>
<div class="cached-tools" id="cached-tools" style="display: none">
<h2>已缓存的工具</h2>
<div class="cached-list" id="cached-list"></div>
</div>
</div>
<script>
// Show cached tools if available
if ("caches" in window) {
caches.open("webutils-v1").then((cache) => {
cache.keys().then((requests) => {
const tools = requests
.map((req) => new URL(req.url))
.filter((url) => url.pathname.startsWith("/tools/") && url.pathname.endsWith(".html"))
.slice(0, 10);
if (tools.length > 0) {
const container = document.getElementById("cached-tools");
const list = document.getElementById("cached-list");
tools.forEach((url) => {
const name = url.pathname.split("/").pop().replace(".html", "").replace(/-/g, " ");
const link = document.createElement("a");
link.href = url.pathname;
link.className = "cached-link";
link.textContent = name;
list.appendChild(link);
});
container.style.display = "block";
}
});
});
}
</script>
</body>
</html>