-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.js
27 lines (24 loc) · 919 Bytes
/
index.js
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
hexo.extend.filter.register('after_post_render', function(data) {
var readmoreConfig = hexo.config.plugins.readmore;
if (readmoreConfig) {
data.content = '<div id="vip-container">' + data.content + '</div>';
var str = `
<script src="https://my.openwrite.cn/js/readmore.js" type="text/javascript"></script>
<script>
var isMobile = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
if (!isMobile) {
var btw = new BTWPlugin();
btw.init({
"id": "vip-container",
"blogId": "${readmoreConfig.blogId}",
"name": "${readmoreConfig.name}",
"qrcode": "${readmoreConfig.qrcode}",
"keyword": "${readmoreConfig.keyword}"
});
}
</script>
`;
data.content = data.content + '\n' + str;
}
return data;
});