Skip to content

Commit 71e11e1

Browse files
committed
分享按钮
1 parent 57040ae commit 71e11e1

File tree

7 files changed

+74
-49
lines changed

7 files changed

+74
-49
lines changed

_config.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ info:
99
version: 1.0-beta11
1010
docs: https://xaoxuu.com/wiki/material-x/
1111
# 主题的CDN地址。如需启用CDN,请在主目录的config中设置,详见文档。
12-
cdn: https://cdn.jsdelivr.net/gh/xaoxuu/[email protected].37/
12+
cdn: https://cdn.jsdelivr.net/gh/xaoxuu/[email protected].38/
1313

1414

1515
############################### 主题样式 ###############################
@@ -26,11 +26,11 @@ services:
2626
nodewaves: true
2727
busuanzi: true
2828
# fastclick: true
29-
leancloud_visitors: true
29+
# leancloud_visitors: true
3030
recommended_posts: true # 需要安装"hexo-recommended-posts": "^1.0.3",
3131
comments: true
3232
music: true
33-
33+
share: true
3434

3535

3636
############################### 杂项 ###############################

layout/_partial/article.ejs

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,17 @@
77
</div>
88
<% if(post.layout == 'post'){ %>
99
<section class='meta' id="footer-meta">
10-
<time class="time" itemprop="dateUpdated" datetime="<%- moment(post.updated).format() %>" content="<%- date(post.updated, config.date_format) %>">
11-
<i class="fas fa-pencil-alt fa-fw" aria-hidden="true"></i>&nbsp;本文最后更新于:<%- date(post.updated, config.date_format) %>
12-
</time>
10+
<time class="metatag time" itemprop="dateUpdated" datetime="<%- moment(post.updated).format() %>" content="<%- date(post.updated, config.date_format) %>"><i class="fas fa-pencil-alt fa-fw" aria-hidden="true"></i>&nbsp;本文最后更新于:<%- date(post.updated, config.date_format) %></time>
1311
<% if (post.tags && post.tags.length && post.tags.each) { %>
1412
<%
1513
var items = [];
1614
post.tags.each(function(item){
17-
items.push('<div class="tags"><a class="tag" href="'+url_for(item.path)+'"><i class="fas fa-hashtag fa-fw" aria-hidden="true"></i>&nbsp;' + item.name + '</a></div>');
15+
items.push('<div class="metatag tags"><a class="tag" href="'+url_for(item.path)+'"><i class="fas fa-hashtag fa-fw" aria-hidden="true"></i>&nbsp;' + item.name + '</a></div>');
1816
});
1917
%>
2018
<%- items.join(' ') %>
2119
<% } %>
20+
<%- partial('../_third-party/share') %>
2221
</section>
2322
<% } %>
2423

layout/_partial/categories.ejs

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
cats.push('<a class="categories" href="'+url_for(cat.path)+'">' + cat.name + '</a>');
66
});
77
%>
8-
<div class='cats'>
9-
<i class="fas fa-folder-open fa-fw" aria-hidden="true"></i>
10-
<%- cats.join(' / ') %>
8+
<div class='metatag cats'>
9+
<i class="fas fa-folder-open fa-fw" aria-hidden="true"></i>&nbsp;<%- cats.join(' / ') %>
1110
</div>
1211
<% } %>

layout/_partial/meta.ejs

+6-7
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@
3030
<% } %>
3131

3232
<% if(post.date){ %>
33-
<time class="time">
34-
<i class="fas fa-calendar-alt fa-fw" aria-hidden="true"></i>
35-
<%= date(post.date, config.date_format) %>
33+
<time class="metatag time">
34+
<i class="fas fa-calendar-alt fa-fw" aria-hidden="true"></i>&nbsp;<%= date(post.date, config.date_format) %>
3635
</time>
3736
<% } %>
3837

@@ -42,14 +41,14 @@
4241

4342
<% if(!isPostList && theme.services){ %>
4443
<% if (theme.services.leancloud_visitors == true && config.leancloud_visitors && config.leancloud_visitors.app_id && config.leancloud_visitors.app_key) { %>
45-
<div class="browse leancloud"><i class="fas fa-eye fa-fw" aria-hidden="true"></i>
44+
<div class="metatag browse leancloud"><i class="fas fa-eye fa-fw" aria-hidden="true"></i>
4645
<span id="<%= url_for(page.path) %>" class="leancloud_visitors" data-flag-title="<%= page.title %>">
47-
<span class="leancloud-visitors-count"><i class="fas fa-spinner fa-spin fa-fw" aria-hidden="true"></i></span>
46+
&nbsp;<span class="leancloud-visitors-count"><i class="fas fa-spinner fa-spin fa-fw" aria-hidden="true"></i></span>
4847
</span>
4948
</div>
5049
<% } else if (theme.services.busuanzi == true) { %>
51-
<div class="browse busuanzi"><i class="fas fa-eye fa-fw" aria-hidden="true"></i>
52-
<span id="busuanzi_value_page_pv"><i class="fas fa-spinner fa-spin fa-fw" aria-hidden="true"></i></span>
50+
<div class="metatag browse busuanzi"><i class="fas fa-eye fa-fw" aria-hidden="true"></i>
51+
&nbsp;<span id="busuanzi_value_page_pv"><i class="fas fa-spinner fa-spin fa-fw" aria-hidden="true"></i></span>
5352
</div>
5453
<% } %>
5554
<% } %>

layout/_partial/scripts.ejs

+5
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@
5353
}, false)
5454
</script>
5555
<% } %>
56+
<% if (theme.services.share == true && config.mob && config.mob.appkey) { %>
57+
<script id="-mob-share" src="http://f1.webshare.mob.com/code/mob-share.js?appkey=<%- config.mob.appkey %>"></script>
58+
<% } %>
59+
60+
5661
<% if (theme.services.leancloud_visitors == true) { %>
5762
<!-- leancloud_visitors -->
5863
<% if (config.leancloud_visitors && config.leancloud_visitors.app_id && config.leancloud_visitors.app_key) { %>

layout/_third-party/share.ejs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<% if (theme.services && theme.services.share == true && config.mob && config.mob.appkey && config.mob.list) { %>
2+
<div class='metatag share -mob-share-list'>
3+
<i class="left fas fa-share-alt fa-fw" aria-hidden="true"></i>
4+
<div class="-mob-share-list share-body">
5+
<% (config.mob.list||[]).forEach(function(item){ %>
6+
<a class="-mob-share-<%- item.key %>" title="<%- item.name %>">
7+
<% if (item.icon){ %>
8+
<i class="<%- item.icon %> fa-fw"></i>
9+
<% } else if (item.img){ %>
10+
<img src="<%- item.img %>">
11+
<% } %>
12+
</a>
13+
<% }) %>
14+
</div>
15+
</div>
16+
<% } %>

source/less/_main.less

+39-32
Original file line numberDiff line numberDiff line change
@@ -312,43 +312,38 @@
312312
}
313313
}
314314
.tags{
315-
display: inline-block;
315+
display: inline-flex;
316316
background: transparent;
317317
word-spacing: normal;
318318
}
319-
.time,
320-
.cats,
321-
.browse,
322-
.tags {
319+
@cellH: 28px;
320+
.metatag {
323321
.enable-trans();
324322
font-size: @fontsize_small * .95;
325-
line-height: 25px;
323+
line-height: @cellH + 1px;
324+
height: @cellH;
326325
color: fade(@color_text_main, 70%);
327-
display: inline-block;
326+
display: inline-flex;
328327
background: @theme_background;
329328
margin: 4px 4px 4px 0px;
330329
padding: 0px 8px 0px 2px;
331330
border-radius: 0.5*@border_radius_code_block;
332331
border-left: 25px solid lighten(@theme_main, 10%);
333-
padding-top: 1px;
334-
@media(max-width: @on_phone) {
335-
padding-bottom: 1px;
336-
}
337332
&:hover {
338333
background: lighten(@theme_main, 10%);
339334
color: @color_text_in_header;
340335
a{
341336
color: @color_text_in_header;
342337
}
343-
.fa-spinner{
338+
.fas, .fab{
344339
color: @color_text_in_header;
345340
}
346341
border-left-width: 30px;
347342
padding-right: 10px;
348343
}
349344
i{
350345
width: 28px;
351-
line-height: 24px;
346+
line-height: @cellH;
352347
color: @color_text_in_header;
353348
margin-left: -28px;
354349
}
@@ -359,37 +354,49 @@
359354
color: @color_text_highlight;
360355
color: @color_text_in_header;
361356
}
362-
&:active {
363-
// color: darken(@color_text_highlight, 25%);
364-
}
365357
}
366358
.categories {
367359
font-weight: normal;
368360
color: fade(@color_text_main, 70%);
369-
// color: @color_text_link;
370361
}
371-
.tag{
362+
.tag,{
372363
color: fade(@color_text_main, 70%);
373364
}
374365
.fa-spinner{
375366
color: fade(@color_text_main, 70%);
376367
margin-left: 2px;
377368
}
369+
370+
}
371+
.share{
372+
// border-color: @color_md_orange;
373+
// &:hover {
374+
// background: @color_md_orange;
375+
// }
376+
.share-body{
377+
display: flex;
378+
a{
379+
img{
380+
margin: 2px;
381+
height: @cellH - 4px;
382+
width: auto;
383+
}
384+
i{
385+
display: inline-block;
386+
margin: 0;
387+
padding: 0;
388+
color: fade(@color_text_main, 70%);
389+
}
390+
padding-bottom: 0;
391+
margin-bottom: 0;
392+
&:hover{
393+
// background: darken(@color_md_orange, 10%);
394+
text-decoration: none;
395+
}
396+
}
397+
398+
}
378399
}
379-
// .cats {
380-
// a {
381-
// font-weight: bold;
382-
// color: @color_text_link;
383-
// .enable-trans();
384-
// &:hover {
385-
// color: @color_text_highlight;
386-
// }
387-
// &:active {
388-
// color: darken(@color_text_highlight, 25%);
389-
// }
390-
// }
391-
//
392-
// }
393400

394401
}
395402
.full-width,.highlight{

0 commit comments

Comments
 (0)