Files
test-map-distance/public/index.html
2026-01-09 23:14:45 +08:00

207 lines
5.6 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>地图距离计算工具 - 使用说明</title>
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Highlight.js -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-dark.min.css" rel="stylesheet">
<style>
body {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 40px 0;
}
.card {
border: none;
border-radius: 16px;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.card-header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border-radius: 16px 16px 0 0 !important;
padding: 25px 30px;
}
.card-header h1 {
margin: 0;
font-size: 1.8rem;
}
.card-body {
padding: 30px;
}
#content {
font-size: 1rem;
line-height: 1.8;
}
#content h1 {
color: #667eea;
border-bottom: 2px solid #667eea;
padding-bottom: 10px;
margin-top: 0;
}
#content h2 {
color: #764ba2;
margin-top: 30px;
padding-bottom: 8px;
border-bottom: 1px solid #eee;
}
#content h3 {
color: #555;
margin-top: 20px;
}
#content h4 {
color: #666;
margin-top: 15px;
}
#content p {
margin-bottom: 1rem;
}
#content ul, #content ol {
margin-bottom: 1rem;
padding-left: 25px;
}
#content li {
margin-bottom: 8px;
}
#content a {
color: #667eea;
text-decoration: none;
}
#content a:hover {
text-decoration: underline;
}
#content pre {
border-radius: 10px;
margin: 15px 0;
}
#content code:not(pre code) {
background: #f3f4f6;
color: #e91e63;
padding: 2px 6px;
border-radius: 4px;
font-size: 0.9em;
}
#content table {
margin: 15px 0;
width: 100%;
}
#content th, #content td {
border: 1px solid #dee2e6;
padding: 12px;
text-align: left;
}
#content th {
background: #f8f9fa;
font-weight: 600;
}
#content tr:hover {
background: #f8f9fa;
}
#content blockquote {
border-left: 4px solid #667eea;
padding-left: 20px;
margin: 15px 0;
color: #666;
background: #f8f9fa;
padding: 15px 20px;
border-radius: 0 8px 8px 0;
}
#content img {
max-width: 100%;
border-radius: 8px;
margin: 15px 0;
}
.loading {
text-align: center;
padding: 50px;
color: #666;
}
.spinner-border {
width: 3rem;
height: 3rem;
}
</style>
</head>
<body>
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-10">
<div class="card">
<div class="card-header">
<h1>地图距离计算工具 - 使用说明</h1>
<!-- 文档切换导航 -->
<div class="mt-3">
<div class="btn-group" role="group">
<button type="button" class="btn btn-light btn-sm" id="btn-docs" onclick="loadDoc('docs.md', this)">脚本执行</button>
<button type="button" class="btn btn-light btn-sm active" id="btn-web-docs" onclick="loadDoc('docs-web.md', this)">网页版</button>
</div>
</div>
</div>
<div class="card-body" id="content">
<div class="loading">
<div class="spinner-border text-primary" role="status">
<span class="visually-hidden">加载中...</span>
</div>
<p class="mt-3">文档加载中...</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Bootstrap Bundle JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<!-- Marked JS -->
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<!-- Highlight.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script>
// 文档切换功能
async function loadDoc(docFile, btn) {
// 更新按钮状态
document.querySelectorAll('.btn-group .btn').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
// 显示加载状态
document.getElementById('content').innerHTML = `
<div class="loading">
<div class="spinner-border text-primary" role="status">
<span class="visually-hidden">加载中...</span>
</div>
<p class="mt-3">文档加载中...</p>
</div>
`;
try {
const response = await fetch('./' + docFile);
if (!response.ok) {
throw new Error('文档加载失败');
}
const markdown = await response.text();
document.getElementById('content').innerHTML = marked.parse(markdown);
// 代码高亮
document.querySelectorAll('pre code').forEach((block) => {
hljs.highlightElement(block);
});
} catch (error) {
document.getElementById('content').innerHTML = `
<div class="alert alert-danger" role="alert">
<h4 class="alert-heading">加载失败</h4>
<p>${error.message}</p>
</div>
`;
}
}
// 默认加载网页版文档
loadDoc('docs-web.md', document.getElementById('btn-web-docs'));
</script>
</body>
</html>