|
24 | 24 |
|
25 | 25 | <body>
|
26 | 26 | <div id="app">LeetCode & Coding Interview Guide @Doocs</div>
|
27 |
| - <script> |
28 |
| - const isEn = () => location.hash.includes('README_EN'); |
29 |
| - const isRoot = () => ['', '#/', '#/README', '#/README_EN'].includes(location.hash); |
30 |
| - const sidebar = () => isRoot() ? false : (isEn() ? 'summary_en.md' : 'summary.md'); |
31 |
| - const cleanedHtml = (html) => { |
32 |
| - return html.replace(/<pre>([\s\S]*?)<\/pre>/g, function (match, group) { |
33 |
| - return "<pre>" + group.replace(/<code>([\s\S]*?)<\/code>/g, "$1") + "</pre>"; |
34 |
| - }); |
35 |
| - }; |
36 |
| - |
37 |
| - window.addEventListener('hashchange', () => { |
38 |
| - window.$docsify.loadSidebar = sidebar(); |
39 |
| - window.$docsify.pagination.previousText = isEn() ? 'PREVIOUS' : '上一题'; |
40 |
| - window.$docsify.pagination.nextText = isEn() ? 'NEXT' : '下一题'; |
41 |
| - }); |
42 |
| - |
43 |
| - window.$docsify = { |
44 |
| - name: 'leetcode', |
45 |
| - repo: 'doocs/leetcode', |
46 |
| - lastModifiedText: isEn() ? 'Last updated: ' : '最近更新时间:', |
47 |
| - logo: '/images/doocs-leetcode.png', |
48 |
| - search: { |
49 |
| - depth: 2, |
50 |
| - hideOtherSidebarContent: true, |
51 |
| - pathNamespaces: ['/', '/solution', '/lcof', '/lcof2', '/lcci', '/lcs', '/lcp', '/basic'] |
52 |
| - }, |
53 |
| - loadSidebar: sidebar(), |
54 |
| - auto2top: true, |
55 |
| - subMaxLevel: 2, |
56 |
| - alias: { |
57 |
| - '/lcs/.*/summary.md': '/lcs/summary.md', |
58 |
| - '/lcp/.*/summary.md': '/lcp/summary.md', |
59 |
| - '/lcci/.*/summary.md': '/lcci/summary.md', |
60 |
| - '/lcof/.*/summary.md': '/lcof/summary.md', |
61 |
| - '/lcof2/.*/summary.md': '/lcof2/summary.md', |
62 |
| - '/solution/.*/summary.md': '/solution/summary.md', |
63 |
| - '/basic/.*/summary.md': '/basic/summary.md', |
64 |
| - |
65 |
| - '/lcs/.*/summary_en.md': '/lcs/summary_en.md', |
66 |
| - '/lcp/.*/summary_en.md': '/lcp/summary_en.md', |
67 |
| - '/lcci/.*/summary_en.md': '/lcci/summary_en.md', |
68 |
| - '/lcof/.*/summary_en.md': '/lcof/summary_en.md', |
69 |
| - '/lcof2/.*/summary_en.md': '/lcof2/summary_en.md', |
70 |
| - '/solution/.*/summary_en.md': '/solution/summary_en.md', |
71 |
| - '/basic/.*/summary_en.md': '/basic/summary_en.md', |
72 |
| - }, |
73 |
| - contributors: { |
74 |
| - repo: 'doocs/leetcode', |
75 |
| - ignores: ['/README.md', '/README_EN.md', '/solution/README.md', '/solution/README_EN.md', '/summary.md'], |
76 |
| - image: { |
77 |
| - margin: '0.2em', |
78 |
| - isRound: true |
79 |
| - } |
80 |
| - }, |
81 |
| - darklightTheme: { |
82 |
| - defaultTheme: 'light', |
83 |
| - siteFont: 'Source Sans Pro,Helvetica Neue,Arial,sans-serif', |
84 |
| - codeFontFamily: 'Roboto Mono, Monaco, courier, monospace', |
85 |
| - bodyFontSize: '15px', |
86 |
| - dark: { |
87 |
| - background: '#191919', |
88 |
| - highlightColor: '#e96900', |
89 |
| - codeBackgroundColor: '#202020', |
90 |
| - codeTextColor: '#b4b4b4', |
91 |
| - }, |
92 |
| - light: { |
93 |
| - highlightColor: '#e96900', |
94 |
| - } |
95 |
| - }, |
96 |
| - pagination: { |
97 |
| - previousText: isEn() ? 'PREVIOUS' : '上一题', |
98 |
| - nextText: isEn() ? 'NEXT' : '下一题', |
99 |
| - crossChapter: true, |
100 |
| - crossChapterText: true |
101 |
| - }, |
102 |
| - tabs: { |
103 |
| - persist: true, |
104 |
| - sync: true, |
105 |
| - theme: 'classic', |
106 |
| - tabComments: true, |
107 |
| - tabHeadings: true |
108 |
| - }, |
109 |
| - plugins: [ |
110 |
| - (hook, vm) => { |
111 |
| - hook.beforeEach((html) => { |
112 |
| - const { file } = vm.route |
113 |
| - const userContent = /githubusercontent\.com/.test(file) |
114 |
| - const url = userContent ? file |
115 |
| - .replace('raw.githubusercontent.com', 'github.com') |
116 |
| - .replace(/\/main/, '/blob/main') : 'https://github.com/doocs/leetcode/blob/main/' + file |
117 |
| - |
118 |
| - const github = `[GitHub](${url})` |
119 |
| - const gitee = `[Gitee](${url.replace("github", "gitee")})` |
120 |
| - html = cleanedHtml(html); |
121 |
| - const editHtml = isEn() ? `:memo: Edit on ${github} / ${gitee}\n` : `:memo: 在 ${github} / ${gitee} 编辑\n` |
122 |
| - return editHtml + html |
123 |
| - }) |
124 |
| - |
125 |
| - hook.afterEach((html) => { |
126 |
| - const copyright = isEn() ? '. All Rights Reserved' : ' 版权所有' |
127 |
| - const currentYear = new Date().getFullYear() |
128 |
| - const footer = `<footer>Copyright © 2018-${currentYear} <a href="https://github.com/doocs" target="_blank">Doocs</a>${copyright}</footer>` |
129 |
| - return html + footer |
130 |
| - }) |
131 |
| - }, |
132 |
| - ] |
133 |
| - } |
134 |
| - </script> |
| 27 | + <script src="./main.js"></script> |
135 | 28 | <script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify@4.13.0/lib/docsify.min.js"></script>
|
136 | 29 | <!-- components -->
|
137 | 30 | <script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-c.min.js"></script>
|
|
0 commit comments