Skip to content

Commit

Permalink
feat: 高级设置:是否在底部显示最近访客
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanDecode committed Apr 20, 2019
1 parent 592f69d commit dfac93c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 30 deletions.
3 changes: 3 additions & 0 deletions advanceSetting.sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
// 夜间模式精确切换(需要用户允许网站访问位置)
"accurateDarkMode": true,

// 底部显示最近访客
"showRecentGuest": true,

// 自定义添加栏下拉列表
"nav" : [
{
Expand Down
28 changes: 11 additions & 17 deletions assets/parts/_footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ footer{
section{
flex: 1;
position: relative;
margin-top: 1rem;
padding-top: 1rem;
margin: 1rem 0.5rem 0 0.5rem;
&,& *{
color: #ddd;
.theme-dark &{
Expand All @@ -34,17 +33,6 @@ footer{
}
font-weight: 300;
}
&:nth-child(2){
margin: 0 15px;
margin-top: 1rem;
}
&::before{
content: attr(data-title);
position: absolute;
color: #ddd;
font-weight: normal;
top: 0;
}
ul{
list-style: none;
text-indent: 0;
Expand All @@ -70,19 +58,25 @@ footer{
&:first-child{
margin-top: 1rem;
}
&#hitokoto{
margin: 1rem 0;
}
}
}
@media screen and (max-width:767px) {
flex-direction: column;
section{
margin: 15px;
.avatar-list{
margin-bottom: 0;
}
}
}
}
&.no-rg{
@media screen and (max-width:767px){
section:nth-child(2) {
margin-top: 0.5rem;
p:nth-child(1) {
margin-top: 0;
}
}
}
}
}
31 changes: 19 additions & 12 deletions includes/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,27 @@ function ExSearchCall(item){
</script>
<?php endif; ?>
<link rel="stylesheet" href="https://lab.lepture.com/social/dist/widget.css">
<footer>
<footer <?php if(!$setting['showRecentGuest']) echo 'class="no-rg"' ?>>
<div class="container">
<section data-title="Recent Guests"> <!-- 最近访客 -->
<div class="avatar-list">
<?php
$recentComments=Contents::getRecentComments(14);
foreach ($recentComments as $comment){ ?>
<a href="<?php echo $comment['permalink']; ?>"><img class="avatar" alt="<?php echo $comment['author'] ?>" src="<?php Utils::gravatar($comment['mail'], 64, ''); ?>" width="64" height="64"></a>
<?php } ?>
</div>
<section> <!-- 最近访客 -->
<?php if($setting['showRecentGuest']): ?>
<div class="avatar-list">
<?php
$recentComments=Contents::getRecentComments(14);
foreach ($recentComments as $comment){ ?>
<a href="<?php echo $comment['permalink']; ?>"><img class="avatar" alt="<?php echo $comment['author'] ?>" src="<?php Utils::gravatar($comment['mail'], 64, ''); ?>" width="64" height="64"></a>
<?php } ?>
</div>
<?php else: ?>
<p>感谢陪伴:<span id="uptime"></span></p>
<p id="hitokoto"></p>
<?php endif; ?>
</section>
<section data-title="Site Info"> <!-- 一言与页底信息 -->
<p>感谢陪伴:<span id="uptime"></span></p>
<p id="hitokoto"></p>
<section> <!-- 一言与页底信息 -->
<?php if($setting['showRecentGuest']): ?>
<p>感谢陪伴:<span id="uptime"></span></p>
<p id="hitokoto"></p>
<?php endif; ?>
<p>© <?php echo date('Y '); ?> <span class="brand"><?php echo $this->options->title; ?></span></p>
<p>Powered by <a href="http://typecho.org/">Typecho</a> • <a href="https://blog.imalan.cn/archives/247/">Theme VOID</a></p>
<p><?php echo $setting['footer']; ?></p>
Expand Down
3 changes: 2 additions & 1 deletion libs/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ public static function getVOIDSettings()
'headerMode' => 1,
'followSystemColorScheme' => false,
'accurateDarkMode' => false,
"useNotoSerif" => false
"useNotoSerif" => false,
"showRecentGuest" => false
);

$options = Helper::options();
Expand Down

0 comments on commit dfac93c

Please sign in to comment.