Skip to content

Commit ae8d596

Browse files
committed
style: update index page
1 parent ae06fba commit ae8d596

File tree

1 file changed

+29
-24
lines changed

1 file changed

+29
-24
lines changed

index.html

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
<meta name="viewport"
1212
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
1313
<link rel="stylesheet" href="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify@4.13.0/lib/themes/vue.css">
14-
<link rel="stylesheet" href="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-darklight-theme@latest/dist/style.min.css">
15-
<link rel="stylesheet" href="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/katex@latest/dist/katex.min.css"/>
14+
<link rel="stylesheet"
15+
href="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-darklight-theme@latest/dist/style.min.css">
16+
<link rel="stylesheet" href="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/katex@latest/dist/katex.min.css">
1617
<link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32x32.png">
1718
<link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png">
1819
<style>
@@ -26,7 +27,7 @@
2627
<div id="app">LeetCode & Coding Interview Guide @Doocs</div>
2728
<script>
2829
const isEn = () => location.hash.includes('README_EN');
29-
const isRoot = () => ['', '#/', '#/README', '#/README_EN'].includes(location.hash);
30+
const isRoot = () => ['', '#/', '#/README', '#/README_EN'].includes(location.hash);
3031
const sidebar = () => isRoot() ? false : (isEn() ? 'summary_en.md' : 'summary.md');
3132
const cleanedHtml = (html) => {
3233
return html.replace(/<pre>([\s\S]*?)<\/pre>/g, function (match, group) {
@@ -130,21 +131,21 @@
130131
},
131132
(hook, vm) => {
132133
hook.beforeEach((html) => {
133-
function formatDateTime(dateTimeString) {
134-
const date = new Date(dateTimeString);
135-
const year = date.getFullYear();
136-
const month = String(date.getMonth() + 1).padStart(2, '0');
137-
const day = String(date.getDate()).padStart(2, '0');
138-
const hours = String(date.getHours()).padStart(2, '0');
139-
const minutes = String(date.getMinutes()).padStart(2, '0');
140-
const seconds = String(date.getSeconds()).padStart(2, '0');
141-
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
142-
}
143-
const file = vm.route.file
144-
const lastIndex = file.lastIndexOf("/");
145-
const filePath = vm.route.path === '/' ? '/README.md' : file.substring(0, lastIndex);
146-
const apiUrl = `https://api.github.com/repos/${$docsify.repo}/commits?path=${filePath}`;
147-
fetch(apiUrl, {method: 'GET'}).then(response => response.json())
134+
function formatDateTime(dateTimeString) {
135+
const date = new Date(dateTimeString);
136+
const year = date.getFullYear();
137+
const month = String(date.getMonth() + 1).padStart(2, '0');
138+
const day = String(date.getDate()).padStart(2, '0');
139+
const hours = String(date.getHours()).padStart(2, '0');
140+
const minutes = String(date.getMinutes()).padStart(2, '0');
141+
const seconds = String(date.getSeconds()).padStart(2, '0');
142+
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
143+
}
144+
const file = vm.route.file
145+
const lastIndex = file.lastIndexOf("/");
146+
const filePath = vm.route.path === '/' ? '/README.md' : file.substring(0, lastIndex);
147+
const apiUrl = `https://api.github.com/repos/${$docsify.repo}/commits?path=${filePath}`;
148+
fetch(apiUrl, { method: 'GET' }).then(response => response.json())
148149
.then(data => {
149150
const date = data[0].commit.committer.date
150151
const commitUrl = `https://github.com/${$docsify.repo}/commits/main/${file}`
@@ -155,14 +156,14 @@
155156
<a href="${commitUrl}" target="_blank" style="color: #858585">${prompt + lastModified}</a>
156157
</blockquote>
157158
`
158-
document.getElementById('last-modified').innerHTML = lastModifiedContent
159+
document.getElementById('last-modified').innerHTML = lastModifiedContent
159160
})
160161
return (
161162
html + '<span id="last-modified"></span>'
162163
);
163164
});
164165
},
165-
166+
166167
]
167168
}
168169
</script>
@@ -182,13 +183,17 @@
182183
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-nim.min.js"></script>
183184
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-ruby.min.js"></script>
184185
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-rust.min.js"></script>
185-
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-copy-code@2.1.1/dist/docsify-copy-code.min.js"></script>
186+
<script
187+
src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-copy-code@2.1.1/dist/docsify-copy-code.min.js"></script>
186188
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify/lib/plugins/search.min.js"></script>
187189
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify/lib/plugins/zoom-image.min.js"></script>
188190
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-tabs@1/dist/docsify-tabs@1.js"></script>
189-
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-pagination/dist/docsify-pagination.min.js"></script>
190-
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-darklight-theme@latest/dist/index.min.js"></script>
191-
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-contributors@latest/dist/index.min.js"></script>
191+
<script
192+
src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-pagination/dist/docsify-pagination.min.js"></script>
193+
<script
194+
src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-darklight-theme@latest/dist/index.min.js"></script>
195+
<script
196+
src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-contributors@latest/dist/index.min.js"></script>
192197
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-katex@latest/dist/docsify-katex.js"></script>
193198
</body>
194199

0 commit comments

Comments
 (0)