Skip to content
This repository was archived by the owner on Apr 20, 2020. It is now read-only.

Commit 15f382d

Browse files
committed
Merge branch 'develop' of https://github.com/cryptape/Microscope into develop
2 parents af39fce + f91784a commit 15f382d

File tree

6 files changed

+121
-57
lines changed

6 files changed

+121
-57
lines changed

docs/index.html

Lines changed: 75 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,84 @@
66
<html lang="en">
77

88
<head>
9-
<meta charset="UTF-8">
10-
<title>Microscope Documents</title>
11-
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
12-
<meta name="description" content="Description">
13-
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
14-
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
15-
<script src="//unpkg.com/lodash/lodash.min.js"></script>
16-
<script src="script/utils.js"></script>
17-
<script src="script/customization-value.js"></script>
18-
<script src="script/common-setting.js"></script>
19-
<script src="script/customization-setting.js"></script>
20-
<script src="script/main.js"></script>
9+
<meta charset="UTF-8">
10+
<title>Microscope Document</title>
11+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
12+
<meta name="description" content="Description">
13+
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
14+
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
15+
2116
</head>
2217

2318
<body>
24-
<nav></nav>
25-
<div id="app">Loading</div>
26-
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
27-
<script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
28-
<script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
29-
<script src="//unpkg.com/[email protected]/index.js"></script>
30-
<script src="https://unpkg.com/docsify-copy-code@2"></script>
19+
20+
21+
<nav class="app-nav no-badge">
22+
<ul>
23+
<li>
24+
<a href="https://cryptape.github.io/Nervos-Docs">Nervos</a>
25+
<ul>
26+
<li>
27+
<a href="https://cryptape.github.io/Nervos-AppChain-Docs/">AppChain</a>
28+
</li>
29+
<li>
30+
<a href="https://cryptape.github.io/cita/">CITA</a>
31+
</li>
32+
<li>
33+
<a href="https://cryptape.github.io/Neuron-Android/#/">Neuron</a>
34+
</li>
35+
<li>
36+
<a href="https://cryptape.github.io/Microscope/">Microscope</a>
37+
</li>
38+
</ul>
39+
</li>
40+
<!-- <li id="tag_language">Language
41+
<ul>
42+
<li>
43+
<a href="" onclick="setLang('en-US');">EN</a>
44+
</li>
45+
<li>
46+
<a href="" onclick="setLang('zh-CN');">中文</a>
47+
</li>
48+
</ul>
49+
</li> -->
50+
</ul>
51+
</nav>
52+
53+
<script>
54+
function setLang(language) {
55+
sessionStorage.setItem("language", language);
56+
}
57+
58+
</script>
59+
60+
<div id="app">Loading</div>
61+
62+
<script src="//unpkg.com/lodash/lodash.min.js"></script>
63+
<script src="script/customization-value.js"></script>
64+
<script src="script/utils.js"></script>
65+
<script src="script/common-setting.js"></script>
66+
<script src="script/customization-setting.js"></script>
67+
<script src="script/main.js"></script>
68+
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
69+
<script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
70+
<script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
71+
<script src="//unpkg.com/[email protected]/index.js"></script>
72+
<script src="https://unpkg.com/docsify-copy-code@2"></script>
73+
<!-- Global site tag (gtag.js) - Google Analytics -->
74+
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-122001869-5"></script>
75+
<script>
76+
window.dataLayer = window.dataLayer || [];
77+
78+
function gtag() {
79+
dataLayer.push(arguments);
80+
}
81+
gtag('js', new Date());
82+
83+
gtag('config', 'UA-122001869-5');
84+
85+
</script>
3186

3287
</body>
3388

34-
</html>
89+
</html>

docs/script/common-setting.js

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,53 @@
22
// these are the default settings for all the Nervos Documents
33
// you can overwrite settings in this page by set them again in customization.js
44

5+
// add language variable to session storage, if it's not existed
6+
if (sessionStorage.getItem("language")) {
7+
var language = sessionStorage.getItem("language");
8+
} else {
9+
sessionStorage.setItem("language", default_language);
10+
var language = default_language;
11+
}
12+
13+
// add version variable to session storage, if it's not existed
14+
if (sessionStorage.getItem("version")) {
15+
var version = sessionStorage.getItem("version");
16+
} else {
17+
sessionStorage.setItem("version", "latest");
18+
var version = "latest";
19+
}
20+
521
var common = {
622

723
loadSidebar: true,
824
autoHeader: true,
925
subMaxLevel: 2,
10-
loadNavbar: true,
11-
basePath: './',
26+
basePath: versionIsSupported ? `./${language}/${version}/` : `./${language}/`,
1227

13-
// search: 'auto',
14-
15-
// the default
16-
alias: {
17-
'/_sidebar.md': `/${default_language}/_sidebar.md`,
18-
'/_navbar.md': `/${default_language}/_navbar.md`,
19-
},
2028

2129
// configuration for searching plugin
2230
search: {
2331
maxAge: 86400000, // expiration time in milliseconds, one day by default
24-
// paths: [
25-
// '/',
26-
// ], // or 'auto'
27-
28-
// localization
29-
placeholder: {
30-
'/zh-CN/': '搜索',
31-
'/': 'Type to search',
32-
},
33-
34-
35-
// localization
36-
noData: {
37-
'/zh-CN/': '找不到结果',
38-
'/': 'No Results',
39-
},
4032

4133
// depth of the maximum searching title levels
4234
depth: 6,
4335
},
4436

37+
plugins: [
38+
function (hook, vm) {
39+
hook.afterEach(function (html, next) {
40+
if (versionIsSupported) {
41+
var url = github_url + language + '/' + version + '/' + vm.route.file
42+
} else {
43+
var url = github_url + language + '/' + vm.route.file
44+
}
4545

46-
}
46+
var editHtml = `<hr> If you find any mistakes on this page, feel free to <a target='_blank' href="${url}">edit this document on GitHub</a>`
47+
48+
next(html + editHtml)
49+
})
50+
}
51+
]
52+
53+
54+
}

docs/script/customization-setting.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ var customization = {
66

77
name: 'Microscope', // name of this document
88

9-
homepage: `${default_language}/microscope.md`,// the home page, extension name '.md' cannot be omitted.
9+
homepage: 'microscope.md',// the home page, extension name '.md' cannot be omitted.
10+
11+
1012
}

docs/script/customization-value.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
// This file is for you to customize.
22
// It defines some of the key values.
33

4-
// the default language for the site
5-
const default_language = 'zh-CN';
4+
// the default language for the site;
5+
const default_language = 'zh-CN';
6+
7+
// define is the document supports version
8+
const versionIsSupported = false;
9+
10+
//github url for enabling Edit on GitHub
11+
const github_url = 'https://github.com/cryptape/Microscope/blob/master/docs/';

docs/zh-CN/_navbar.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/zh-CN/_sidebar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
- [Microscope 简介](zh-CN/microscope.md)
1+
- [Microscope 简介](microscope.md)

0 commit comments

Comments
 (0)