Skip to content

Commit fb70a72

Browse files
authored
refactor: unified style (doocs#793)
- 统一风格 - 去除不必要的标签 - 更换最新的 CDN src
1 parent 44532ca commit fb70a72

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

index.html

+15-13
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
'/basic/.*/summary.md': '/basic/summary.md'
4545
},
4646
contributors: {
47-
ignores: ['/README.md', "/README_EN.md", "/solution/README.md", "/solution/README_EN.md", "/summary.md"]
47+
ignores: ['/README.md', '/README_EN.md', '/solution/README.md', '/solution/README_EN.md', '/summary.md']
4848
},
4949
darklightTheme: {
5050
defaultTheme: 'light',
@@ -75,25 +75,27 @@
7575
tabHeadings: true
7676
},
7777
plugins: [
78-
function (hook, vm) {
79-
hook.beforeEach(function (html) {
80-
const en = vm.route.file.indexOf('README_EN') > -1
81-
const userContent = /githubusercontent\.com/.test(vm.route.file)
82-
const url = userContent ? vm.route.file
78+
(hook, vm) => {
79+
80+
const isEn = () => vm.route.file.includes('README_EN')
81+
82+
hook.beforeEach((html) => {
83+
const {file} = vm.route
84+
const userContent = /githubusercontent\.com/.test(file)
85+
const url = userContent ? file
8386
.replace('raw.githubusercontent.com', 'github.com')
84-
.replace(/\/main/, '/blob/main') : 'https://github.com/doocs/leetcode/blob/main/' + vm.route.file
87+
.replace(/\/main/, '/blob/main') : 'https://github.com/doocs/leetcode/blob/main/' + file
8588

8689
const github = `[GitHub](${url})`
8790
const gitee = `[Gitee](${url.replace("github", "gitee")})`
88-
const editHtml = en ? `:memo: Edit on ${github} / ${gitee}\n` : `:memo: 在 ${github} / ${gitee} 编辑\n`
91+
const editHtml = isEn() ? `:memo: Edit on ${github} / ${gitee}\n` : `:memo: 在 ${github} / ${gitee} 编辑\n`
8992
return editHtml + html
9093
})
9194

92-
hook.afterEach(function (html) {
93-
const en = vm.route.file.indexOf('README_EN') != -1
94-
const copyright = en ? '. All Rights Reserved' : ' 版权所有'
95+
hook.afterEach((html) => {
96+
const copyright = isEn() ? '. All Rights Reserved' : ' 版权所有'
9597
const currentYear = new Date().getFullYear()
96-
const footer = `<footer><span>Copyright © 2018-${currentYear} <a href="https://github.com/doocs" target="_blank">Doocs</a>${copyright}</footer>`
98+
const footer = `<footer>Copyright © 2018-${currentYear} <a href="https://github.com/doocs" target="_blank">Doocs</a>${copyright}</footer>`
9799
return html + footer
98100
})
99101
},
@@ -124,7 +126,7 @@
124126
<script src="//cdn.jsdelivr.net/npm/docsify-tabs@1/dist/docsify-tabs.min.js"></script>
125127
<script src="//cdn.jsdelivr.net/npm/docsify-pagination/dist/docsify-pagination.min.js"></script>
126128
<script src="//cdn.jsdelivr.net/npm/docsify-darklight-theme@latest/dist/index.min.js"></script>
127-
<script src="//cdn.jsdelivr.net/npm/docsify-contributors@latest/dist/contributors.min.js"></script>
129+
<script src="//cdn.jsdelivr.net/npm/docsify-contributors@latest/dist/index.min.js"></script>
128130
</body>
129131

130132
</html>

0 commit comments

Comments
 (0)