|
12 | 12 | content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
13 | 13 | <link rel="stylesheet" href="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify@4.13.0/lib/themes/vue.css">
|
14 | 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"/> |
| 15 | + <link rel="stylesheet" href="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/katex@latest/dist/katex.min.css"> |
16 | 16 | <link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32x32.png">
|
17 | 17 | <link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png">
|
18 | 18 | <style>
|
|
26 | 26 | <div id="app">LeetCode & Coding Interview Guide @Doocs</div>
|
27 | 27 | <script>
|
28 | 28 | 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); |
30 | 30 | const sidebar = () => isRoot() ? false : (isEn() ? 'summary_en.md' : 'summary.md');
|
31 | 31 | const cleanedHtml = (html) => {
|
32 | 32 | return html.replace(/<pre>([\s\S]*?)<\/pre>/g, function (match, group) {
|
|
130 | 130 | },
|
131 | 131 | (hook, vm) => {
|
132 | 132 | 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()) |
148 | 148 | .then(data => {
|
149 | 149 | const date = data[0].commit.committer.date
|
150 | 150 | const commitUrl = `https://github.com/${$docsify.repo}/commits/main/${file}`
|
|
155 | 155 | <a href="${commitUrl}" target="_blank" style="color: #858585">${prompt + lastModified}</a>
|
156 | 156 | </blockquote>
|
157 | 157 | `
|
158 |
| - document.getElementById('last-modified').innerHTML = lastModifiedContent |
| 158 | + document.getElementById('last-modified').innerHTML = lastModifiedContent |
159 | 159 | })
|
160 | 160 | return (
|
161 | 161 | html + '<span id="last-modified"></span>'
|
162 | 162 | );
|
163 | 163 | });
|
164 | 164 | },
|
165 |
| - |
166 | 165 | ]
|
167 | 166 | }
|
168 | 167 | </script>
|
|
0 commit comments