Skip to content

Commit 072739c

Browse files
authored
style: update index page (doocs#1651)
1 parent ae06fba commit 072739c

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

index.html

+18-19
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
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">
1414
<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"/>
15+
<link rel="stylesheet" href="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/katex@latest/dist/katex.min.css">
1616
<link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32x32.png">
1717
<link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png">
1818
<style>
@@ -26,7 +26,7 @@
2626
<div id="app">LeetCode & Coding Interview Guide @Doocs</div>
2727
<script>
2828
const isEn = () => location.hash.includes('README_EN');
29-
const isRoot = () => ['', '#/', '#/README', '#/README_EN'].includes(location.hash);
29+
const isRoot = () => ['', '#/', '#/README', '#/README_EN'].includes(location.hash);
3030
const sidebar = () => isRoot() ? false : (isEn() ? 'summary_en.md' : 'summary.md');
3131
const cleanedHtml = (html) => {
3232
return html.replace(/<pre>([\s\S]*?)<\/pre>/g, function (match, group) {
@@ -130,21 +130,21 @@
130130
},
131131
(hook, vm) => {
132132
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())
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())
148148
.then(data => {
149149
const date = data[0].commit.committer.date
150150
const commitUrl = `https://github.com/${$docsify.repo}/commits/main/${file}`
@@ -155,14 +155,13 @@
155155
<a href="${commitUrl}" target="_blank" style="color: #858585">${prompt + lastModified}</a>
156156
</blockquote>
157157
`
158-
document.getElementById('last-modified').innerHTML = lastModifiedContent
158+
document.getElementById('last-modified').innerHTML = lastModifiedContent
159159
})
160160
return (
161161
html + '<span id="last-modified"></span>'
162162
);
163163
});
164164
},
165-
166165
]
167166
}
168167
</script>

0 commit comments

Comments
 (0)