forked from qiangmzsx/Software-Engineering-at-Google
-
Notifications
You must be signed in to change notification settings - Fork 48
/
index.html
153 lines (129 loc) · 5.3 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">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/dark.css">
</head>
<body>
<div id="app"></div>
<script>
window.$docsify = {
name: 'Software Engineering at Google',
repo: 'doggy8088/Software-Engineering-at-Google',
auto2top: true,
// 側邊欄
loadSidebar: true,
alias: {
'/.*/_sidebar.md': '/_sidebar.md'
},
subMaxLevel: 3,
// 自動為每個頁面增加標題
// autoHeader: true,
// 封面
coverpage: false,
// 搜尋支援
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>
<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>