-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdocs.html
More file actions
220 lines (179 loc) · 6.71 KB
/
Copy pathdocs.html
File metadata and controls
220 lines (179 loc) · 6.71 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta name="robots" content="noindex, nofollow">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FCL官方文档 < docs.html</title>
</head>
<body>
<div class="sidebar" id="sidebar">
<div>
<div class="diagonal window">
<div class="windowTitle">
<span>页面信息</span>
</div>
<table>
<tr>
<td>
文件
</td>
<td>
/docs .html
</td>
</tr>
<tr>
<td>
标题
</td>
<td>
FCL官方文档
</td>
</tr>
<tr>
<td>
创建时间
</td>
<td>
2025年3月24日20时06分
</td>
</tr>
</table>
</div>
</div>
<div class="yellow window" id="JStip">
<div class="yellowT windowTitle">
<span>启用 JavaScript</span>
</div>
<p>
请启用JavaScript以 获得此网站的最佳浏览体验。侧边栏无法显示,可手动查看:<a href="/page/content/sidebar.html">/page/content/sidebar.html</a>。
</p>
</div>
<div class="yellow window" id="windowOnloadtip">
<div class="yellowT windowTitle">
<span>等待 window.onload</span>
</div>
<p>
网页资源正在加载,可能导致侧边栏、图片等资源无显示。如此提示长时间未消失,请尝试启用JavaScript或绕过GFW。
</p>
</div>
<div class="yellow window" id="DOMtip">
<div class="yellowT windowTitle">
<span>等待 DOMContentLoaded</span>
</div>
<p>
网页正在加载,可能导致网页显示异常。如此提示长时间未消失,请尝试启用JavaScript或更换浏览器。
</p>
</div>
</div>
<div class="main">
<div class="window">
<div class="windowTitle">
<span>/docs.html > FCL官方文档</span>
</div>
<div class="window">
<div class="windowTitle level2">
<span>目录</span>
</div>
<div id="docsIndex">
</div>
</div>
<div class="window">
<div class="windowTitle level2">
<span>内容</span>
</div>
<div id="docsContent" class="markdown-body">
</div>
</div>
<div class="diagonal window">
<div class="windowTitle level2">
<span>debug</span>
</div>
<a href="/page/debug/elements.html">view all elements</a>
</div>
</div>
</div>
<link rel="stylesheet" href="/css/index.css">
<script src="/js/index.js"></script>
<link rel="stylesheet" href="/css/github-dark.min.css">
<script src="/js/libs/highlight.min.js"></script>
<script src="/js/libs/eruda.js"></script>
<script src="/js/libs/marked.min.js"></script>
<script>
fetch('https://raw.kkgithub.com/FCL-Team/FCL-Docs/refs/heads/main/index.json')
.then(response => response.json())
.then(data => {
const container = document.getElementById('docsIndex');
data.forEach(category => {
if (!category.visible) return;
const categoryDiv = document.createElement('div');
categoryDiv.className = 'category';
const categoryName = category.displayName.find(d => d.lang === 'en')?.name || category.displayName[0]?.name;
const heading = document.createElement('p');
heading.textContent = categoryName;
categoryDiv.appendChild(heading);
const itemsContainer = document.createElement('div');
itemsContainer.className = 'items';
category.item.forEach(item => {
const itemDiv = document.createElement('button');
itemDiv.onclick = () => {
loadDocs(`https://raw.kkgithub.com/FCL-Team/FCL-Docs/refs/heads/main${item.path}`);
};
const title = document.createElement('p');
title.textContent = item.title;
const subtitle = document.createElement('p');
subtitle.textContent = item.subtitle;
const author = document.createElement('p');
author.className = 'author';
author.textContent = `作者:${item.author}`;
itemDiv.appendChild(title);
itemDiv.appendChild(subtitle);
itemDiv.appendChild(author);
itemsContainer.appendChild(itemDiv);
});
categoryDiv.appendChild(itemsContainer);
container.appendChild(categoryDiv);
});
})
.catch(error => {
console.error('失败于获取文档索引', error);
document.getElementById('docsIndex').innerHTML = '<div class=\'diagonalRed\'>加载失败,请检查网络或绕过GFW。<br>${error}</div>';
});
function loadDocs(rawSrc) {
const container = document.getElementById('docsContent');
container.innerHTML = '<div>正在加载</div>';
fetch(rawSrc)
.then(response => {
if (!response.ok) throw new Error(`HTTP错误 ${response.status}`);
return response.text();
})
.then(markdownText => {
const processedMD = markdownText.replace(
/(!?\[.*?]\()((?!https?:\/\/)([./]*)([^)]+))(\))/gi,
(match, prefix, pathPart, prefixSlash, actualPath, suffix) => {
const baseURL = 'https://raw.kkgithub.com/FCL-Team/FCL-Docs/refs/heads/main';
let fullPath;
if (actualPath.startsWith('/')) {
fullPath = `${baseURL}${actualPath}`;
} else if (actualPath.startsWith('../')) {
fullPath = `${baseURL}/${actualPath.replace(/^(\.\.\/)+/, '')}`;
} else {
fullPath = `${baseURL}/${actualPath}`;
}
return `${prefix}${fullPath.replace(/([^:])\/+/g, '$1/')}${suffix}`;
}
);
let parsedHTML = marked.parse(processedMD);
if (window.DOMPurify) {
parsedHTML = DOMPurify.sanitize(parsedHTML);
}
container.innerHTML = parsedHTML;
})
.catch(err => {
console.error('失败于加载文档内容:', err);
container.innerHTML = `<div class="diagonalRed">加载失败,请检查网络或绕过GFW<br>错误类型: ${err.name}<br>详细信息: ${err.message}</div>`;
});
}
</script>
</body>
</html>