Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

友情链接页面的更改,评论头像源 #21

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 7 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,16 @@
# Fantasy
一款极简Typecho 博客主题
一款极简Typecho 博客主题,当前仓库为修改版 by Meteor

详细介绍页:https://www.krsay.com/typecho/fantasy.html

<s>演示地址:https://www.krsay.com~</s>

![screenshot](screenshot.png)

>1.4.2

avatar 头像cdn修改

远程文件本地化
原仓库:https://github.com/Seevil/fantasy

增加搜索功能

修复评论审核
>23/11/7修改

回复加@功能修复
1. 由页面添加代码更改为,友链插件识别
2. 替换评论头像源为国内(极客源不稳定)

增强1.2.0 php8 兼容性 和其他优化

>1.4.1

兼容1.2和php8
细节文字微调

>1.4.0 更新细节及友情链接设置方法见:

https://www.krsay.com/typecho/fantasy-1-4-0.html

# License
详细介绍页:https://www.krsay.com/typecho/fantasy.html
![screenshot](screenshot.png)


「Fantasy」移植自PCDotFan 的 Bitcron 主题 「[Aragaki](https://github.com/pcdotfan/Aragaki)」
12 changes: 12 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ function theme_random_posts(){
echo $defaults['after'];
}

/**
* 判断插件是否可用
*
* @return bool
*/
function isPluginAvailable($name)
{
$plugins = Typecho_Plugin::export();
$plugins = $plugins['activated'];
return is_array($plugins) && array_key_exists($name, $plugins);
}

/**
* 输出评论回复内容,配合 commentAtContent($coid)一起使用
* <?php showCommentContent($comments->coid); ?>
Expand Down
171 changes: 167 additions & 4 deletions links.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,178 @@
<?php if ($this->options->eyeshow == 'able'): ?><span class="item"><i class="iconfont icon-eye"></i> <?php get_post_view($this) ?> 度</span><?php endif; ?>
<?php if($this->user->hasLogin()):?><span><a href="<?php $this->options->siteUrl(); ?>admin/write-post.php?cid=<?php $this->cid(); ?>">[编辑]</a></span><?php endif;?>
</div>
<div class="meta">
<?php $this->content(); ?>
<!-- 友情链接优化 -->
<input type="radio" name="tab" id="link_info" class="reward_none" checked="">
<input type="radio" name="tab" id="link_friend" class="reward_none">

<div class="link_tab">
<div class="link_tab_list">
<label for="link_info"><span class="douban_option_info">友链说明</span></label>
<label for="link_friend"><span class="douban_option_friend">友情链接</span></label>
</div>
</div>

<div class="links_body_friend links reward_none">
<div class ="links-body">
<?php if(isPluginAvailable('Links')) {
Links_Plugin::output('<a href="{url}" target="_blank" title="{title}" class="links-item" no-linkTarget>
<div class="links-content">
<section class="links-avatar">
<img src="{image}"class="links-img" />
</section>
<section class="links-profile">
<h4 class="links-name">{name}</h4>
<!-- <p class="links-description">{title}</p> 这个是站点描述想要的就把这段注释删掉-->
</section>
</div>
</a>'); }
else {
echo 'Links 插件未启用,若要使用友情连接功能,请安装并启用 Links 插件。';
}?>
</div>
</div>
<div class="link_body links reward_none">
<div class="meta-links">
<?php $this->content(); ?>
</div>
</div>
</div>

</article>
<section class="pager">
</section>

</main>
</div>
<script>document.querySelectorAll('ul.flinks').forEach(function(e){let a=e;if(a){let ns=a.querySelectorAll("li");let str='<div style="display:inline-block;">';for(let i=0;i<ns.length;i+=4){str+=(`<div class="flink-item link-bg"><div class="flink-title"><a href="${ns[i+1].innerText}"target="_blank"rel="external nofollow ugc">${ns[i].innerText}</a></div><div class="flink-link"><div class="flink-link-ico"style="background: url(${ns[i+2].innerText});background-size: 42px auto;"></div><div class="flink-link-text">${ns[i+3].innerText}</div></div></div>`)}str+=`</div>`;let n1=document.createElement("div");n1.innerHTML=str;a.parentNode.insertBefore(n1,a);a.style="display: none;"}});</script>
<style>.flink-item{width:300px;height:100px;position:relative;margin:10px;background-color: #f7f7f7;border-radius:3px;float:left;}.flink-title{left:25px;top:25px;position:absolute}.flink-title a{font-size:17px;color:#6b6b6b;line-height:17px;word-break:break-all;text-decoration:none;outline:0}.flink-link{right:0;bottom:0;padding:0 15px 0px;position:absolute;text-align:right}.flink-link-text{font-size:12px;color:#999}.flink-link-ico{display:inline-block;width:42px;height:42px;border-radius:50%}</style>

<style>
/* links 友情链接优化 */
article.content .meta-links, section.content .meta-links {
border-bottom: 0;
padding: 20px 0 38px 0%;
}
.links-item {
display: inline-block;
padding: .6em;
border-radius: 5px;
width: 30%;
margin: .2em 0;
box-sizing: border-box
transition: box-shadow 0.5s ease-out;
}

.links-item:hover {
transition: box-shadow 0.5s ease-out;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
@media (max-width: 1200px) {
.links-item {
width: 33.33%
}
}
@media (max-width: 674px) {
.links-item {
width: 50%
}
}@media (max-width: 478px) {
.links-item {
width: 100%
}
}

.links-item:hover {
background: var(--light-bg)
}

.links-content {
display: flex;
flex-direction: row;
color: var(--text-color);
align-items: center;
/* border: 2px solid #ccc; */
border-radius: 7px;
}

.links-img {
height: 3.6em;
width: 3.6em;
transition: transform .3s;
border-radius: 20%;
max-width: fit-content
}
.links-item:hover .links-img {
transform: scale(1.05)
}

.links-profile {
margin-left: 1.8em;
line-height: 1.2;
padding: .2em 0
}
.links-profile h4 {
margin: 0;
font-weight: 400;
font-size: 0.9em;
}
.links-profile p {
margin: 0;
color: var(--text-gray);
font-size: .9em;
line-height: 1.1;
margin-top: .4em;
}
.links-container {
clear: both;
width: 100%;
margin: 2em 0;
}
.links-body {
padding: 20px;
}

.link_tab{
text-align: center;
margin-bottom: 2rem;
margin-top: 2rem;
}
.link_tab_list{
display: initial;
padding: 10px 12px;
border-radius: 100px;
font-size: 14px;
color: #17223b;
background-color: #eeeeff;
}
.link_tab_list span {
display: block;
display: inline-block;
padding: 0px 10px;
cursor: pointer;
border-radius: 100px;
}
h4.links-name {
padding:0 0% !important;
}
h4.links-name:before {
content: "#"!important;
color: #555;
}
#link_info:checked ~ .link_body, #link_friend:checked ~ .links_body_friend, .links_body_circle{
display: block;
}

.reward_none {
display: none;
}
#link_info:checked ~ .link_tab label[for="link_info"] span, #link_friend:checked ~ .link_tab label[for="link_friend"] span {
background: #fff;
}

.links {
width:100%;
padding:10px;
float:initial;
}
</style>
<?php $this->need('vcomments.php'); ?>
<?php $this->need('footer.php'); ?>
2 changes: 1 addition & 1 deletion vcomments.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function threadedComments($comments, $options) {
$commentLevelClass = $comments->levels > 0 ? ' comment-child' : ' comment-parent';
?>
<?php
$host = 'https://sdn.geekzu.org';
$host = 'https://cravatar.cn';
$url = '/avatar/';
$rating = Helper::options()->commentsAvatarRating;
$hash = md5(strtolower($comments->mail));
Expand Down