Merge branch 'master' into myblog

i18n
xaoxuu 5 years ago
commit b8a9722f3b
  1. 10
      _config.yml
  2. 4
      languages/en.yml
  3. 4
      languages/zh-CN.yml
  4. 4
      languages/zh-HK.yml
  5. 4
      languages/zh-TW.yml
  6. 2
      layout/_partial/meta.ejs
  7. 143
      layout/_partial/scripts.ejs
  8. 2
      layout/_partial/side.ejs
  9. 70
      layout/_third-party/comments.ejs
  10. 39
      layout/_widget/music.ejs
  11. 8
      layout/_widget/related_posts.ejs
  12. 2
      layout/_widget/tagcloud.ejs
  13. 3
      layout/archive.ejs
  14. 6
      source/js/volantis.js
  15. 3
      source/less/_archive.less
  16. 2
      source/less/_color.less
  17. 81
      source/less/_widget.less

@ -8,7 +8,7 @@ info:
name: Material X
docs: https://xaoxuu.com/wiki/material-x/
# 主题的CDN地址。如需启用CDN,请在主目录的config中设置,详见文档。
cdn: https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.3.1/
cdn: https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.3.2/
############################### 主题样式 ###############################
@ -43,14 +43,6 @@ music:
id: 2615636388 # 歌曲/专辑/歌单 ID
volume: 0.7 # 音量, 0~1
autoplay: false # 自动播放
display: # 批量控制哪一类页面显示
home: true # 在主页是否显示
tag: false # 在标签页面是否显示
category: false # 在分类页面是否显示
archive: false # 在归档页面是否显示
page: false # layout: page 的页面是否显示
links: true # layout: links 的页面是否显示
post: true # layout: post 的页面是否显示
# 友链页头像占位图

@ -5,13 +5,13 @@ sidebar:
category: Categories
tagcloud: Hot Tags
toc: Table of Contents
related_posts: Related Posts
post:
top: Top
read_more: Read More
sticky: Sticky
comments: Comments
comments_placeholder: Unable to load comment system, please make sure your network can access
related_posts: Related Posts
comments_placeholder: Unable to load %s, please make sure your network can access.
copy_button: Copy
copy_success: Copied
copy_failure: Copy failed

@ -5,13 +5,13 @@ sidebar:
category: 所有分类
tagcloud: 热门标签
toc: 文章目录
related_posts: 相关文章
post:
top: 置顶
read_more: 阅读全文
sticky: 置顶
comments: 评论
comments_placeholder: 无法加载评论系统,请确保您的网络能够正常访问
related_posts: 相关文章
comments_placeholder: 无法加载%s评论系统,请确保您的网络能够正常访问。
copy_button: 复制
copy_success: 复制成功
copy_failure: 复制失败

@ -5,13 +5,13 @@ sidebar:
category: 所有分類
tagcloud: 熱門標籤
toc: 文章目錄
related_posts: 相關文章
post:
top: 置頂
read_more: 閱讀全文
sticky: 置頂
comments: 評論
comments_placeholder: 無法加載評論系統,請確保您的網絡能夠正常訪問
related_posts: 相關文章
comments_placeholder: 無法加載%s評論系統,請確保您的網絡能夠正常訪問。
copy_button: 複製
copy_success: 複製成功
copy_failure: 複製失敗

@ -5,13 +5,13 @@ sidebar:
category: 所有分類
tagcloud: 熱門標籤
toc: 文章目錄
related_posts: 相關文章
post:
top: 置頂
read_more: 閱讀全文
sticky: 置頂
comments: 評論
comments_placeholder: 無法加載評論系統,請確保您的網絡能夠正常訪問
related_posts: 相關文章
comments_placeholder: 無法加載%s評論系統,請確保您的網絡能夠正常訪問。
copy_button: 複製
copy_success: 複製成功
copy_failure: 複製失敗

@ -4,7 +4,7 @@
var isPostList = false;
} %>
<section class='meta'>
<% if((!isPostList && post.music && post.music.enable != false) || (isPostList && post.music && post.music.enable != false)){ %>
<% if(post.music && post.music.enable != false){ %>
<%- partial('../_third-party/aplayer',
{aplayer_theme: '', aplayer_mini: true, aplayer_mode: 'circulation',
aplayer_server: post.music.server, aplayer_type: post.music.type, aplayer_id: post.music.id,

@ -60,83 +60,86 @@
<% } %>
<%
var displayComments = false;
if (page && theme.services) {
if ((config.disqus_shortname || config.livere_uid || config.valine) && theme.services.comments == true && page.comments != false) {
displayComments = true;
var enableDisqus = false;
var enableLivere = false;
var enableValine = false;
if (page && theme.services && theme.services.comments == true && page.comments != false) {
if (config.disqus_shortname) {
enableDisqus = true;
}
if (config.livere_uid) {
enableLivere = true;
}
if (config.valine && config.valine.app_id && config.valine.app_key) {
enableValine = true;
}
}
%>
<% if (displayComments == true) { %>
<% if ((page.layout == 'post' && page.comments != false) || page.comments == true) { %>
<% if (config.disqus_shortname){ %>
<script>
var disqus_shortname = '<%= config.disqus_shortname %>';
<% if (page.permalink){ %>
var disqus_url = '<%= page.permalink %>';
<% } %>
(function(){
var dsq = document.createElement('script');
dsq.type = 'text/javascript';
dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/<% if (page.comments) { %>embed.js<% } else { %>count.js<% } %>';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<% } %>
<% if (config.livere_uid){ %>
<script type="text/javascript">
(function(d, s) {
var j, e = d.getElementsByTagName(s)[0];
if (typeof LivereTower === 'function') { return; }
j = d.createElement(s);
j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
j.async = true;
e.parentNode.insertBefore(j, e);
})(document, 'script');
</script>
<% if (enableDisqus){ %>
<script>
var disqus_shortname = '<%= config.disqus_shortname %>';
<% if (page.permalink){ %>
var disqus_url = '<%= page.permalink %>';
<% } %>
<% if (config.valine){ %>
<% if (config.valine.enable && config.valine.app_id && config.valine.app_key){ %>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<% if (theme.services.volantis == true) { %>
<% if (theme.services && theme.services.cdn == true) { %>
<script src="https://cdn.jsdelivr.net/gh/xaoxuu/volantis@1/js/volantis.min.js"></script>
<% } else { %>
<%- js('js/volantis.js') %>
<% } %>
<% } else { %>
<script src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-valine@1.3.4/js/valine.min.js"></script>
<% } %>
<script>
var GUEST_INFO = ['nick','mail','link'];
var guest_info = '<%= config.valine.guest_info %>'.split(',').filter(function(item){
return GUEST_INFO.indexOf(item) > -1
});
var notify = '<%= config.valine.notify %>' == true;
var verify = '<%= config.valine.verify %>' == true;
var valine = new Valine();
valine.init({
el: '#valine_container',
notify: notify,
verify: verify,
guest_info: guest_info,
<% if(page.valine && page.valine.path) { %>
path: "<%= page.valine.path %>",
<% } %>
appId: "<%= config.valine.app_id %>",
appKey: "<%= config.valine.app_key %>",
placeholder: "<%= (page.valine && page.valine.placeholder) ? page.valine.placeholder : config.valine.placeholder %>",
pageSize:'<%= config.valine.pageSize %>',
avatar:'<%= config.valine.avatar %>',
lang:'<%= config.valine.lang %>',
highlight:'<%= config.valine.highlight %>'
})
</script>
<% } %>
(function(){
var dsq = document.createElement('script');
dsq.type = 'text/javascript';
dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/<% if (page.comments) { %>embed.js<% } else { %>count.js<% } %>';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<% } %>
<% if (enableLivere){ %>
<script type="text/javascript">
(function(d, s) {
var j, e = d.getElementsByTagName(s)[0];
if (typeof LivereTower === 'function') { return; }
j = d.createElement(s);
j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
j.async = true;
e.parentNode.insertBefore(j, e);
})(document, 'script');
</script>
<% } %>
<% if (enableValine){ %>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<% if (theme.services.volantis == true) { %>
<% if (theme.services && theme.services.cdn == true) { %>
<script src="https://cdn.jsdelivr.net/gh/xaoxuu/volantis@1/js/volantis.min.js"></script>
<% } else { %>
<%- js('js/volantis.js') %>
<% } %>
<% } else { %>
<script src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-valine@1.3.4/js/valine.min.js"></script>
<% } %>
<script>
var GUEST_INFO = ['nick','mail','link'];
var guest_info = '<%= config.valine.guest_info %>'.split(',').filter(function(item){
return GUEST_INFO.indexOf(item) > -1
});
var notify = '<%= config.valine.notify %>' == true;
var verify = '<%= config.valine.verify %>' == true;
var valine = new Valine();
valine.init({
el: '#valine_container',
notify: notify,
verify: verify,
guest_info: guest_info,
<% if(page.valine && page.valine.path) { %>
path: "<%= page.valine.path %>",
<% } %>
appId: "<%= config.valine.app_id %>",
appKey: "<%= config.valine.app_key %>",
placeholder: "<%= (page.valine && page.valine.placeholder) ? page.valine.placeholder : config.valine.placeholder %>",
pageSize:'<%= config.valine.pageSize %>',
avatar:'<%= config.valine.avatar %>',
lang:'<%= config.valine.lang %>',
highlight:'<%= config.valine.highlight %>'
})
</script>
<% } %>
<% if (theme.services.cdn == true && config.theme_cdn) { %>
<% if (config.theme_cdn == true) { %>
<%- js([theme.info.cdn + 'js/app.js', theme.info.cdn + 'js/search.js']) %>

@ -1,6 +1,6 @@
<% if (config.widgets && config.widgets.length){ %>
<%
let supportWidgets = ['author', 'category', 'list', 'music', 'tagcloud', 'toc', 'plain'];
let supportWidgets = ['author', 'category', 'list', 'music', 'tagcloud', 'toc', 'plain', 'related_posts'];
%>
<% config.widgets.forEach(function(item){ %>
<% if (item.enable != false){ %>

@ -1,49 +1,51 @@
<!-- 显示推荐文章和评论 -->
<%
var displayRecommentedPosts = false;
var displayPopularPosts = false;
var displayComments = false;
if (page && theme.services) {
if ((config.disqus_shortname || config.livere_uid || config.valine) && theme.services.comments == true && page.comments != false) {
displayComments = true;
var enableDisqus = false;
var enableLivere = false;
var enableValine = false;
if (page && theme.services && theme.services.comments == true && page.comments != false) {
if (config.disqus_shortname) {
enableDisqus = true;
}
if (theme.services.popular_posts == true && page.layout == 'post' && page.popular_posts != false) {
displayPopularPosts = true;
if (config.livere_uid) {
enableLivere = true;
}
if (config.valine && config.valine.app_id && config.valine.app_key) {
enableValine = true;
}
}
%>
<% if (displayRecommentedPosts || displayPopularPosts || displayComments) { %>
<% if (enableDisqus || enableLivere || enableValine) { %>
<article class="post white-box comments">
<section class="article typo">
<% if (displayPopularPosts) { %>
<%- partial('popular_posts', {page: page, site: site}) %>
<% } %>
<% if (displayComments) { %>
<h4><i class="fas fa-comments fa-fw" aria-hidden="true"></i>&nbsp;<%- __('post.comments') %></h4>
<% if (config.disqus_shortname) { %>
<section id="comments">
<div id="disqus_thread">
<%- __('post.comments_placeholder') %> <a href="https://disqus.com">Disqus</a> 。
</div>
</section>
<% } %>
<% if (config.livere_uid){ %>
<section id="comments">
<div id="lv-container" data-id="city" data-uid="<%= config.livere_uid %>">
<noscript>⚠ <%- __('post.comments_placeholder') %></noscript>
</div>
</section>
<% } %>
<% if (config.valine){ %>
<% if (config.valine.enable && config.valine.app_id && config.valine.app_key){ %>
<section id="comments">
<h4><i class="fas fa-comments fa-fw" aria-hidden="true"></i>&nbsp;<%- __('post.comments') %></h4>
<% if (enableDisqus) { %>
<section id="comments">
<div id="disqus_thread">
<div><i class='fas fa-exclamation-triangle'>&nbsp;<%- __('post.comments_placeholder', 'Disqus') %></div>
<% if (enableValine) { %>
<div id="valine_container" class="valine_thread">
<i class="fas fa-spinner fa-spin fa-fw"></i>
</div>
</section>
<% } %>
<% } %>
<% } else { %>
<% } %>
</div>
</section>
<% } %>
<% if (enableLivere){ %>
<section id="comments">
<div id="lv-container" data-id="city" data-uid="<%= config.livere_uid %>">
<noscript><div><i class='fas fa-exclamation-triangle'>&nbsp;<%- __('post.comments_placeholder', 'Livere') %></div></noscript>
</div>
</section>
<% } %>
<% if (!enableDisqus && enableValine){ %>
<section id="comments">
<div id="valine_container" class="valine_thread">
<i class="fas fa-spinner fa-spin fa-fw"></i>
</div>
</section>
<% } %>
</section>
</article>

@ -1,40 +1,7 @@
<%
var needDisplay = false;
if (theme.music && theme.music.display) {
let display = theme.music.display;
if (page.layout == 'page') {
if (display.page != false) {
needDisplay = true;
}
} else if (page.layout == 'post') {
if (display.post != false && (!page.music || page.music.enable == false)) {
needDisplay = true;
}
} else if (page.layout == 'links') {
if (display.links != false) {
needDisplay = true;
}
} else {
if (is_home()) {
if (display.home != false) {
needDisplay = true;
}
} else if (is_tag()) {
if (display.tag != false) {
needDisplay = true;
}
} else if (is_category()) {
if (display.category != false) {
needDisplay = true;
}
} else if (is_archive()) {
if (display.archive != false) {
needDisplay = true;
}
} else {
needDisplay = true;
}
}
var needDisplay = true;
if (page.music && page.music.autoplay) {
needDisplay = false;
}
%>

@ -0,0 +1,8 @@
<% if(page.layout == 'post' && page.content && page.path){ %>
<section class='<%- item.widget %>'>
<%- partial('header', {item: item, defIcon: 'fas fa-bookmark', defTitle: __('sidebar.related_posts')}) %>
<div class="content <%= theme.style %>">
<%- popular_posts( { maxCount: 10 , ulClass: 'popular-posts' , PPMixingRate: 0.2 } , page ) %>
</div>
</section>
<% } %>

@ -1,6 +1,6 @@
<% if (site.tags.length){ %>
<section class='<%- item.widget %>'>
<%- partial('header', {item: item, defIcon: 'fas fa-fire', defTitle: __('sidebar.tagcloud')}) %>
<%- partial('header', {item: item, defIcon: 'fas fa-hashtag', defTitle: __('sidebar.tagcloud')}) %>
<div class='content <%= theme.style %>'>
<%- tagcloud(site.tags, {
min_font: 14,

@ -24,6 +24,9 @@
<% } else if (post.date) { %>
<%= date(post.date, config.date_format) %>
<% } %>
<% if((post.music && post.music.autoplay) || (post.video)){ %>
&nbsp;<i class="music fas fa-headphones-alt" aria-hidden="true"></i>
<% } %>
</span>
</a>
</div>

@ -203,7 +203,7 @@ function(e, t) {
head: {
nick: "昵称(必填)",
mail: "邮箱(必填)",
link: "你的博客链接"
link: "链接"
},
tips: {
comments: "评论",
@ -682,6 +682,10 @@ function(e, t) {
alert('请输入昵称!');
return void _.nick.focus();
}
if (h.mail == "") {
alert('请输入邮箱!');
return void _.mail.focus();
}
if ("" == h.comment) {
alert('请输入内容!');
return void _.comment.focus();

@ -44,6 +44,9 @@
padding: .5em;
font-size: @fontsize_small;
color: fade(@color_text_main,80%);
i.music{
color: @theme_main;
}
}
}
}

@ -19,7 +19,7 @@
// 代码的背景色
@color_bg_code: fade(@theme_main, 10%);
// 代码块的背景色
@color_bg_code_block: #EFEFEF;
@color_bg_code_block: #F8F8F8;
// 引用的颜色
@color_bg_quote: @theme_main;
// 选中部分文字的背景颜色

@ -65,35 +65,37 @@
text-align: justify;
padding: @gap/2;
max-height: ~"calc(100% - @{height_navbar} - 12.5 * @{gap})";
ul > li > a{
padding: 0 @gap;
line-height: @height_cell;
height: @height_cell;
display: flex;
justify-content: space-between;
align-content: center;
border-left: 2px solid transparent;
.enable-trans();
.name{
flex:auto;
&:extend(.txt-ellipsis);
ul > li{
a{
color: fade(@color_text_main, 80%);
}
.badge{
flex:none;
font-weight: normal;
font-size: @fontsize_small;
color: fade(@color_text_main, 70%);
}
&:hover{
border-left: 4px solid @theme_main;
background: fade(@theme_main, 10%);
}
&:active{
border-left: 8px solid @theme_main;
}
&.child{
padding-left: @gap*2;
padding: 0 @gap;
line-height: @height_cell;
display: flex;
justify-content: space-between;
align-content: center;
border-left: 2px solid transparent;
.enable-trans();
.name{
flex:auto;
&:extend(.txt-ellipsis);
color: fade(@color_text_main, 80%);
}
.badge{
flex:none;
font-weight: normal;
font-size: @fontsize_small;
color: fade(@color_text_main, 70%);
}
&:hover{
border-left: 4px solid @theme_main;
background: fade(@theme_main, 10%);
}
&:active{
border-left: 8px solid @theme_main;
}
&.child{
padding-left: @gap*2;
}
}
}
}
@ -285,4 +287,27 @@
}
}
}
&.related_posts{
.content{
padding: @gap/2 0;
font-size: @fontsize_small;
font-weight: bold;
&.pure{
padding-top: 0; // 适合白色导航栏背景
}
h3{
font-size: @fontsize_small;
font-weight: bold;
margin: 0;
a{
// line-height: @fontsize_small*1.7;
line-height: inherit;
padding-top: 4px;
padding-bottom: 4px;
}
}
}
}
}

Loading…
Cancel
Save