forked from dcloudio/hbuilderx-extension-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
227 lines (209 loc) · 10 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HBuilderX 文档</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="HBuilderX:极客开发工具, HBuilderX用户文档和插件开发文档">
<meta name="keywords"
content="DCloud,数字天堂,数字天堂网络,数字天堂(北京)网络技术有限公司,HBuilder,HBuilderX Document,Doc,CLI,HBuilderX教程,使用文档,HX,HBX,HBuilderX插件开发指南,插件开发,插件,插件市场,插件开发指南,插件API,HBuilderX API,Extension API">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="//hx.dcloud.net.cn/static/favicon/favicon.png">
<link rel="stylesheet" href="/static/vue.css">
<link rel="stylesheet" href="/static/index.css?v=1644914929200">
<link rel="stylesheet" type="text/css" href="/static/css/footnavbar.css" />
</head>
<body>
<div id="app">Please wait...</div>
<script src="/static/js/footnavbar.js?v=20211216" type="text/javascript" charset="utf-8"></script>
<script>
// 获取浏览器语言
var lan = getLang();
// 设置title
if (lan.substr(0, 2) != 'zh') {
document.getElementsByTagName('title')[0].innerText = 'HBuilderX Doc';
};
// var Search = lan.includes('zh') ? "搜索" : "Search";
var Search = 'Search';
var basePath = `/${lan}/`;
var loadSidebar = true;
var loadNavbar = true;
let alias = {
'/.*/_navbar.md': '/_navbar.md',
'/(.*)/.*/_sidebar.md': '/$1/_sidebar.md',
'/Tutorial/_sidebar.md': '/_sidebar.md',
};
console.log('欢迎使用HBuilderX');
console.log('------- HBuilderX文档 语言设置 -------', basePath, lan);
// 设置底部导航
let FootLeftNavBar, FootRightNavBar,CompanyInformation = '';
try{
FootLeftNavBar = initFootLeftNavBar(lan);
FootRightNavBar = initFootRightNavBar(lan);
CompanyInformation = getCompanyInformation(lan);
CertInfomation = getCertInfomation(lan);
}catch(e){};
// docsify config start
window.$docsify = {
alias: alias,
basePath: basePath,
name: 'HBuilderX Docs',
// TODO 如需提交,必须改为 history 模式
routerMode: 'history',
// routerMode: 'hash',
repo: false,
coverpage: false,
loadSidebar: loadSidebar,
loadNavbar: loadNavbar,
auto2top: true,
mdCache: 100,
search: {
maxAge: 7200000,
paths: 'auto',
placeholder: {
'/': Search,
},
noData: '没有结果',
depth: 6
},
maxLevel: 4,
subMaxLevel: 3,
banner: ['/case'],
notFoundPage: {
'/': '_404.md'
},
requestHeaders: {
'cache-control': 'max-age=1800',
},
plugins: [
function(hook, vm) {
hook.afterEach(function(html) {
var url = '//github.com/dcloudio/hbuilderx-extension-docs/tree/master' + vm
.route.file;
if (lan.substr(0, 2) != 'zh') {
return html +
'<hr align=center color=#987cb9 size=1>Found mistake? Want to participate in editing?<a href=' +
url + ' target=_blank> Edit this page on GitHub</a>' +
'<br/><br/><span>HBuilderX plug-in development document, not translated into English, welcome to contribute. <span>' +
'<a href="https://github.com/dcloudio/hbuilderx-extension-docs/tree/master/en" target="_blank">Translate this document on github</a>';
};
return html + '<hr align=center color=#987cb9 size=1>发现错误?想参与编辑?<a href=' +
url + ' target=_blank> 在 GitHub 上编辑此页面!</a>' +
'<br/><br/><span>HBuilderX插件开发文档尚未翻译,欢迎参与贡献。<span>' +
'<a href="https://github.com/dcloudio/hbuilderx-extension-docs/tree/master/en" target="_blank">在 Github 上翻译页面!</a>' +
`
<div id="footNavBox">
<div class="footNav">
<div id="footNavClassify">${FootLeftNavBar}</div>
<div id="aboutusBox">${FootRightNavBar}</div>
</div>
<div class="hbLogo"></div>
<div class="companyBox">
${CompanyInformation}
</div>
<div class="beianBox">
${CertInfomation}
</div>
</div>
`;
});
}
]
};
function getLang() {
// 获取浏览器语言
var lan = (navigator.systemLanguage || navigator.language).toLowerCase();
try {
if (lan.substr(0, 2) == 'zh') {
lan = 'zh-cn';
} else {
lan = 'en';
};
} catch (e) {
lan = 'zh-cn';
};
var user_set_language = getCookie('user_set_language');
if (['en', 'zh-cn', 'zh-hant'].includes(user_set_language)) {
lan = user_set_language;
};
// 以防万一,获取的语言没有相应的目录
if (!['en', 'zh-cn', 'zh-hant'].includes(lan)) {
lan = 'zh-cn';
};
return lan;
}
// 切换语言
function setLang(param) {
lan = param;
setCookie('user_set_language', param);
location.reload();
};
// 设置cookies
function setCookie(name, value) {
var Days = 365;
var exp = new Date();
exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
document.cookie = name + '=' + escape(value) + ';expires=' + exp.toGMTString();
};
//获取指定名称的cookie的值
function getCookie(name) {
let arr, reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)');
if (arr = document.cookie.match(reg)) {
return unescape(arr[2]);
} else {
return null;
};
};
</script>
<script src="/static/docsify.js?v=20211206"></script>
<script src="/static/search.js?v=20211221"></script>
<script src="/static/preview.min.js?v=1586316635415"></script>
<script src="/static/emoji.js"></script>
<script src="/static/external-script.js"></script>
<script src="/static/docsify-copy-code.min.js"></script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement('script');
hm.src = 'https://hm.baidu.com/hm.js?6f4a415d4c67e59e4d5f5e8546092f14';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(hm, s);
window.addEventListener('click', function(e) {
var target = e.target;
if (target.className === 'chapter') { //左侧导航的折叠
var chapterParent = target.parentElement;
var summary = localStorage.getItem('summary') ? JSON.parse(localStorage.getItem(
'summary')) : {};
var level = chapterParent.dataset.level;
if (chapterParent.classList.contains('close')) {
summary[level] = false;
chapterParent.classList.remove('close');
} else {
summary[level] = true;
chapterParent.classList.add('close');
}
localStorage.setItem('summary', JSON.stringify(summary));
return;
}
if (target.tagName === 'IMG' && target.className !== 'preview-img') {
var src = target.src,
showImg = true;
while (target && target !== document) {
if (target.tagName == 'A') {
showImg = false;
break;
}
target = target.parentNode;
}
if (showImg && src) {
var preview = new $docsify.Preview(src);
preview.show();
return;
}
}
}, true);
})();
</script>
</body>
</html>