parent
d3669ee665
commit
fc723dcc11
21 changed files with 369 additions and 290 deletions
@ -1,46 +1,44 @@ |
||||
<% if (theme.widgets){ %> |
||||
<% if (theme.widgets.author.enable){ %> |
||||
<%- partial('../_widget/author') %> |
||||
<% } %> |
||||
<% if (config.widgets){ %> |
||||
<% (config.widgets||[]).forEach(function(item){ %> |
||||
<section class='mywidget' id='<%- item.type ? item.type : '' %>'> |
||||
<% if(item.icon && item.title) { %> |
||||
<header class='header <%= theme.style %>'> |
||||
<div><i class="<%= item.icon %> fa-fw" aria-hidden="true"></i> <%= item.title %></div> |
||||
<% if(item.more && item.more.url) { %> |
||||
<a class="rightBtn" target="_blank" rel="external nofollow noopener noreferrer" href="<%= url_for(item.more.url) %>"> |
||||
<i class="<%= item.more.icon?item.more.icon:'fas fa-question-circle' %> fa-fw"></i></a> |
||||
<%} %> |
||||
</header> |
||||
<%} %> |
||||
<div class='content <%= theme.style %>'> |
||||
<% if(item.type == 'list') { %> |
||||
<ul class="entry"> |
||||
<% (item.rows||[]).forEach(function(row){ %> |
||||
<li><a class="flat-box" href="<%= url_for(row.url) %>"><i class="<%= row.icon %> fa-fw"></i><div class='name'><%= row.name %></div></a> |
||||
<% }) %> |
||||
</ul> |
||||
<% } else { %> |
||||
<%- item.body %> |
||||
<% if (config.widgets){ %> |
||||
<% (config.widgets||[]).forEach(function(item){ %> |
||||
<% if (item.enable != false){ %> |
||||
<% |
||||
let widget_name = item.widget ? item.widget : 'plain'; |
||||
var needDisplay = true; |
||||
if (needDisplay == true && widget_name == 'toc') { |
||||
if (page.layout != 'post' || !page.content || page.toc == false || toc(page.content).length == 0) { |
||||
needDisplay = false; |
||||
} |
||||
} |
||||
if (needDisplay == true && widget_name == 'music') { |
||||
if (page.layout != 'post' || !page.content || page.toc == false || toc(page.content).length == 0) { |
||||
needDisplay = false; |
||||
} |
||||
} |
||||
if (needDisplay) { |
||||
needDisplay = ((widget_name != 'toc') || (page.layout == 'post' && page.content && page.toc!==false && toc(page.content).length > 0)); |
||||
} |
||||
%> |
||||
<% if (needDisplay){ %> |
||||
<section class='<%- widget_name == 'toc' ? 'toc-wrapper' : widget_name %>'> |
||||
<% if (widget_name != 'author'){ %> |
||||
<header class='<%= theme.style %>'> |
||||
<div><i class="<%- item.icon %> fa-fw" aria-hidden="true"></i> <%- item.title %></div> |
||||
<% if (widget_name == 'toc') { %> |
||||
<div class='wrapper'><a class="s-toc rightBtn" title="固定到顶部" rel="external nofollow noopener noreferrer" href="javascript:void(0)"><i class="fas fa-thumbtack fa-fw"></i></a></div> |
||||
<% } else if(item.more && item.more.url) { %> |
||||
<a class="rightBtn<%- item.more.animation ? ' ' + item.more.animation : '' %>" target="_blank" |
||||
rel="external nofollow noopener noreferrer" |
||||
href="<%- url_for(item.more.url) %>" |
||||
title="<%- item.more.url %>"> |
||||
<i class="<%- item.more.icon?item.more.icon:'fas fa-question-circle' %> fa-fw"></i></a> |
||||
<% } %> |
||||
</div> |
||||
</header> |
||||
<% } %> |
||||
<div class='content <%= theme.style %>'> |
||||
<%- partial('../_widget/' + widget_name, {item: item}) %> |
||||
</div> |
||||
</section> |
||||
<% }) %> |
||||
<% } %> |
||||
<% if (theme.widgets.categories.enable){ %> |
||||
<%- partial('../_widget/categories') %> |
||||
<% } %> |
||||
<% if (theme.widgets.tagcloud.enable){ %> |
||||
<%- partial('../_widget/tagcloud') %> |
||||
<% } %> |
||||
<% if (theme.widgets.toc.enable){ %> |
||||
<%- partial('../_widget/toc') %> |
||||
<% } %> |
||||
<% if (theme.widgets.music.enable){ %> |
||||
<%- partial('../_widget/music') %> |
||||
<% } %> |
||||
<% if (theme.widgets.links.enable){ %> |
||||
<%- partial('../_widget/links') %> |
||||
<% } %> |
||||
<% } %> |
||||
<% }) %> |
||||
<% } %> |
||||
|
@ -0,0 +1,28 @@ |
||||
<% if(theme.widgets.author.enable != false) { %> |
||||
<section class='author'> |
||||
<% if(theme.widgets.author.avatar) { %> |
||||
<div class='header'> |
||||
<img class='avatar' src='<%= url_for(config.avatar ? config.avatar : "https://img.vim-cn.com/a4/87a96e2e01b1180bba1e76e190df5220378c1a.png") %>'/> |
||||
</div> |
||||
<%} %> |
||||
<% if (theme.widgets.author.title == true || theme.widgets.author.motto == true){ %> |
||||
<div class='content'> |
||||
<% if (theme.widgets.author.title == true){ %> |
||||
<h2><%= config.title %></h2> |
||||
<% } %> |
||||
<% if (theme.widgets.author.motto){ %> |
||||
<p><%= config.motto %></p> |
||||
<% } %> |
||||
</div> |
||||
<% } %> |
||||
<% if (theme.widgets.author.social == true && config.social){ %> |
||||
<div class="social-wrapper"> |
||||
<% (config.social||[]).forEach(function(value){ %> |
||||
<% if (value.url && value.icon) { %> |
||||
<a href="<%= url_for(value.url) %>" class="social flat-btn" target="_blank" rel="external"><i class="social <%= value.icon %>" aria-hidden="true"></i></a> |
||||
<%}%> |
||||
<%})%> |
||||
</div> |
||||
<% } %> |
||||
</section> |
||||
<% } %> |
@ -0,0 +1,59 @@ |
||||
<% |
||||
var needDisplay = false; |
||||
if (theme.widgets.music && theme.widgets.music.display) { |
||||
let display = theme.widgets.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; |
||||
} |
||||
} |
||||
} |
||||
%> |
||||
|
||||
<% if (needDisplay == true) { %> |
||||
<section class='music'> |
||||
<header class='header <%= theme.style %>'> |
||||
<div><i class="<%= theme.widgets.music.icon %> fa-fw" aria-hidden="true"></i> <%= theme.widgets.music.title %></div> |
||||
<a class="rightBtn" target="_blank" rel="external nofollow noopener noreferrer" href="<%= url_for(theme.widgets.music.link) %>"><i class="far fa-heart fa-fw"></i></a> |
||||
</header> |
||||
<div class='content <%= theme.style %>'> |
||||
<div class="aplayer" data-theme="<%= theme.widgets.music.color %>" |
||||
data-mode="<%= theme.widgets.music.mode %>" |
||||
data-server="<%= theme.widgets.music.server %>" |
||||
data-type="<%= theme.widgets.music.type %>" |
||||
data-id="<%= theme.widgets.music.id %>" |
||||
data-volume="<%= theme.widgets.music.volume %>"></div> |
||||
</div> |
||||
</section> |
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer@1.7.0/dist/APlayer.min.css"> |
||||
<script src="https://cdn.jsdelivr.net/npm/aplayer@1.7.0/dist/APlayer.min.js"></script> |
||||
<script src="https://cdn.jsdelivr.net/npm/meting@1.1.0/dist/Meting.min.js"></script> |
||||
<% } %> |
@ -0,0 +1,16 @@ |
||||
<% if (site.tags.length){ %> |
||||
<section class='tagcloud'> |
||||
<header class="header <%= theme.style %>"> |
||||
<div><i class="<%= theme.widgets.tagcloud.icon %> fa-fw" aria-hidden="true"></i> <%= theme.widgets.tagcloud.title %></div> |
||||
</header> |
||||
<div class='content <%= theme.style %>'> |
||||
<%- tagcloud(site.tags, { |
||||
min_font: 14, |
||||
max_font: 24, |
||||
color: true, |
||||
start_color: '#999', |
||||
end_color: '#555', |
||||
}) %> |
||||
</div> |
||||
</section> |
||||
<% } %> |
@ -0,0 +1,11 @@ |
||||
<% if(page.layout == 'post' && page.content && page.toc!==false && toc(page.content).length > 0){ %> |
||||
<section class='toc-wrapper'> |
||||
<header class="header <%= theme.style %>"> |
||||
<div><i class="<%= theme.widgets.toc.icon %> fa-fw" aria-hidden="true"></i> <%= theme.widgets.toc.title %></div> |
||||
<div class='wrapper'><a class="s-toc rightBtn" title="固定到顶部" rel="external nofollow noopener noreferrer" href="javascript:void(0)"><i class="fas fa-thumbtack fa-fw"></i></a></div> |
||||
</header> |
||||
<div class='content <%= theme.style %>'> |
||||
<%- toc(page.content, {list_number: false}) %> |
||||
</div> |
||||
</section> |
||||
<% } %> |
@ -1,28 +1,24 @@ |
||||
<% if(theme.widgets.author.enable != false) { %> |
||||
<section class='author'> |
||||
<% if(theme.widgets.author.avatar) { %> |
||||
<div class='header'> |
||||
<img class='avatar' src='<%= url_for(config.avatar ? config.avatar : "https://img.vim-cn.com/a4/87a96e2e01b1180bba1e76e190df5220378c1a.png") %>'/> |
||||
</div> |
||||
<%} %> |
||||
<% if (theme.widgets.author.title == true || theme.widgets.author.motto == true){ %> |
||||
<div class='content'> |
||||
<% if (theme.widgets.author.title == true){ %> |
||||
<h2><%= config.title %></h2> |
||||
<% } %> |
||||
<% if (theme.widgets.author.motto){ %> |
||||
<p><%= config.motto %></p> |
||||
<% } %> |
||||
</div> |
||||
<% if(item.avatar) { %> |
||||
<div class='avatar'> |
||||
<img class='avatar' src='<%- url_for(item.avatar) %>'/> |
||||
</div> |
||||
<%} %> |
||||
<% if (item.title || item.body) { %> |
||||
<div class='text'> |
||||
<% if (item.title){ %> |
||||
<h2><%- item.title %></h2> |
||||
<% } %> |
||||
<% if (theme.widgets.author.social == true && config.social){ %> |
||||
<div class="social-wrapper"> |
||||
<% (config.social||[]).forEach(function(value){ %> |
||||
<% if (value.url && value.icon) { %> |
||||
<a href="<%= url_for(value.url) %>" class="social flat-btn" target="_blank" rel="external"><i class="social <%= value.icon %>" aria-hidden="true"></i></a> |
||||
<%}%> |
||||
<%})%> |
||||
</div> |
||||
<% if (item.body){ %> |
||||
<%- markdown(item.body) %> |
||||
<% } %> |
||||
</section> |
||||
</div> |
||||
<% } %> |
||||
<% if (item.social == true && config.social) { %> |
||||
<div class="social-wrapper"> |
||||
<% (config.social||[]).forEach(function(value){ %> |
||||
<% if (value.url && value.icon) { %> |
||||
<a href="<%- url_for(value.url) %>" class="social flat-btn" target="_blank" rel="external"><i class="social <%- value.icon %>" aria-hidden="true"></i></a> |
||||
<%}%> |
||||
<%})%> |
||||
</div> |
||||
<% } %> |
||||
|
@ -0,0 +1,7 @@ |
||||
<% if (site.categories.length){ %> |
||||
<ul class="entry"> |
||||
<% site.categories.sort('name').each(function(category){ %> |
||||
<li><a class="flat-box" title="<%- url_for(category.path) %>" href="<%- url_for(category.path) %>"><div class='name'><%- category.name %></div><div class='badge'>(共<%- category.posts.length %>篇)</div></a></li> |
||||
<% }) %> |
||||
</ul> |
||||
<% } %> |
@ -0,0 +1,19 @@ |
||||
<ul class="entry"> |
||||
<% (item.rows||[]).forEach(function(row){ %> |
||||
<li><a class="flat-box" title="<%- row.url %>" href="<%= url_for(row.url) %>"> |
||||
<div class='name'> |
||||
<% if(row.img) { %> |
||||
<img src="<%- row.img %>"> |
||||
<% } else if(row.avatar) { %> |
||||
<img src="<%- row.avatar %>" id="round"> |
||||
<% } else { %> |
||||
<i class="<%= row.icon %>" aria-hidden="true"></i> |
||||
<% } %> |
||||
<%- row.name %> |
||||
</div> |
||||
<% if(row.desc) { %> |
||||
<div class='badge'>(<%- row.desc %>)</div> |
||||
<% } %> |
||||
</a></li> |
||||
<% }) %> |
||||
</ul> |
@ -0,0 +1 @@ |
||||
<%- markdown(item.body) %> |
@ -1,16 +1,7 @@ |
||||
<% if (site.tags.length){ %> |
||||
<section class='tagcloud'> |
||||
<header class="header <%= theme.style %>"> |
||||
<div><i class="<%= theme.widgets.tagcloud.icon %> fa-fw" aria-hidden="true"></i> <%= theme.widgets.tagcloud.title %></div> |
||||
</header> |
||||
<div class='content <%= theme.style %>'> |
||||
<%- tagcloud(site.tags, { |
||||
min_font: 14, |
||||
max_font: 24, |
||||
color: true, |
||||
start_color: '#999', |
||||
end_color: '#555', |
||||
}) %> |
||||
</div> |
||||
</section> |
||||
<% } %> |
||||
<%- tagcloud(site.tags, { |
||||
min_font: 14, |
||||
max_font: 24, |
||||
color: true, |
||||
start_color: '#999', |
||||
end_color: '#555', |
||||
}) %> |
||||
|
@ -1,11 +1,5 @@ |
||||
<% if(page.layout == 'post' && page.content && page.toc!==false && toc(page.content).length > 0){ %> |
||||
<section class='toc-wrapper'> |
||||
<header class="header <%= theme.style %>"> |
||||
<div><i class="<%= theme.widgets.toc.icon %> fa-fw" aria-hidden="true"></i> <%= theme.widgets.toc.title %></div> |
||||
<div class='wrapper'><a class="s-toc rightBtn" title="固定到顶部" rel="external nofollow noopener noreferrer" href="javascript:void(0)"><i class="fas fa-thumbtack fa-fw"></i></a></div> |
||||
</header> |
||||
<div class='content <%= theme.style %>'> |
||||
<%- toc(page.content, {list_number: false}) %> |
||||
</div> |
||||
</section> |
||||
<div class='content <%= theme.style %>'> |
||||
<%- toc(page.content, {list_number: false}) %> |
||||
</div> |
||||
<% } %> |
||||
|
Loading…
Reference in new issue