-
Notifications
You must be signed in to change notification settings - Fork 525
/
index.html
153 lines (131 loc) · 5.32 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Software Engineering at Google</title>
<link rel="icon" href="assets/images/swe_at_google.2.cover.jpg">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="description" content="Description">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css">
<!-- gitalk -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/gitalk/dist/gitalk.css">
</head>
<body>
<div id="app"></div>
<script>
window.$docsify = {
name: 'Software Engineering at Google',
repo: 'qiangmzsx/Software-Engineering-at-Google',
auto2top: true,
// 侧边栏
loadSidebar: true,
alias: {
'/.*/_sidebar.md': '/_sidebar.md'
},
subMaxLevel: 3,
// 自动为每个页面增加标题
// autoHeader: true,
// 封面
coverpage: true,
// 搜索支持
search: {
maxAge: 86400000, // 过期时间,单位毫秒,默认一天
paths: 'auto', // or 'auto'
// 支持本地化
placeholder: {
'/zh-cn/': '搜索',
'/': 'Type to search'
},
// 支持本地化
noData: {
'/zh-cn/': '找不到结果',
'/': 'No Results'
},
// 避免搜索索引冲突
// 同一域下的多个网站之间
namespace: 'Software-Engineering-at-Google',
// 使用不同的索引作为路径前缀(namespaces)
// 注意:仅适用于 paths: 'auto' 模式
//
// 初始化索引时,我们从侧边栏查找第一个路径
// 如果它与列表中的前缀匹配,我们将切换到相应的索引
pathNamespaces: ['/zh-cn'],
},
plugins: [
function (hook, vm) {
hook.beforeEach(function (html) {
if (/githubusercontent\.com/.test(vm.route.file)) {
url = vm.route.file
.replace('raw.githubusercontent.com', 'github.com')
.replace(/\/master/, '/blob/master');
} else if (/jsdelivr\.net/.test(vm.route.file)) {
url = vm.route.file
.replace('cdn.jsdelivr.net/gh', 'github.com')
.replace('@master', '/blob/master');
} else {
url =
'https://github.com/qiangmzsx/Software-Engineering-at-Google/blob/main/' +
vm.route.file;
}
var editHtml = '[:memo: Edit Document](' + url + ')\n';
return (
editHtml +
html
);
})
},
function (i) {
// 加载 Gitalk 元素
var e = Docsify.dom;
i.mounted(function (i) {
var n = e.create("div");
n.id = "gitalk-container";
var t = e.getNode("#main");
n.style = "width: " + t.clientWidth + "px; margin: 0 auto 20px;", e.appendTo(e.find(".content"), n)
}), i.doneEach(function (i) {
for (var n = document.getElementById("gitalk-container"); n.hasChildNodes();) n.removeChild(n.firstChild);
})
},
function (hook, vm) {
hook.doneEach(function () {
// remove gitalk-container
document.getElementById('gitalk-container').innerHTML = "";
// 渲染
NewGitalk().render('gitalk-container');
})
}
],
}
</script>
<!-- Docsify v4 -->
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/search.min.js"></script>
<!-- Pagination -->
<script src="//cdn.jsdelivr.net/npm/docsify-pagination/dist/docsify-pagination.min.js"></script>
<!-- gitalk -->
<script src="//cdn.jsdelivr.net/npm/gitalk/dist/gitalk.min.js"></script>
<!-- Medium's 风格的图片缩放插件 -->
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/zoom-image.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/[email protected]/crypto-js.js"></script>
<script>
function NewGitalk() {
// 除去param
const hashPath = location.hash.indexOf("?id=") === -1 ? location.hash : location.hash.substring(0, location.hash.indexOf("?id="));
const hrefPath = location.hash.indexOf("?id=") === -1 ? location.href : location.href.substring(0, location.href.indexOf("?id="));
// id 50字符限制
const md5Id = CryptoJS.MD5(hashPath).toString();
return new Gitalk({
clientID: '92436d65d807aaf80fcd',
clientSecret: '8df80f61b0d3e4389747e74616c3fd7ad7d359d5',
repo: 'SwEAtGoogleTalk',
owner: 'suixinio',
admin: ['suixinio'],
id: md5Id,
body: hrefPath,
distractionFreeMode: false
});
}
</script>
</body>
</html>