This commit is contained in:
浪子 2024-06-27 19:59:47 +08:00
parent 18421aab6f
commit 52e5a313c8
22 changed files with 2581 additions and 0 deletions

26
404.php Normal file
View File

@ -0,0 +1,26 @@
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $this->need('header.php'); ?>
<main id="site--main">
<section class="template--404">
<div class="error--text">404</div>
<div class="error--posts">
<article class="post--error" itemtype="http://schema.org/Article" itemscope="itemscope">
<div class="content">
<h2 class="post--title" itemprop="headline">
<a href="<?php $this->options->siteUrl(); ?>">
<?php $this->options->title(); ?>
</a>
</h2>
<div class="meta">
<svg class="icon" viewBox="0 0 1024 1024" width="16" height="16">
<path
d="M512 97.52381c228.912762 0 414.47619 185.563429 414.47619 414.47619s-185.563429 414.47619-414.47619 414.47619S97.52381 740.912762 97.52381 512 283.087238 97.52381 512 97.52381z m0 73.142857C323.486476 170.666667 170.666667 323.486476 170.666667 512s152.81981 341.333333 341.333333 341.333333 341.333333-152.81981 341.333333-341.333333S700.513524 170.666667 512 170.666667z m36.571429 89.697523v229.86362h160.865523v73.142857H512a36.571429 36.571429 0 0 1-36.571429-36.571429V260.388571h73.142858z">
</path>
</svg>
</div>
</div>
</article>
</div>
</section>
</main>
<?php $this->need('footer.php'); ?>

3
README.md Normal file
View File

@ -0,0 +1,3 @@
## 说明
从hexo的Chic移植而来

41
archive.php Normal file
View File

@ -0,0 +1,41 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $this->need('part/head.php'); ?>
<div class="wrapper">
<?php $this->need('part/header.php'); ?>
<div class="post-wrap archive">
<h2 class="post-title">-&nbsp;<?php $this->archiveTitle(array(
'category' => _t(' %s '),
'search' => _t('包含关键字 %s 的文章'),
'date' => _t('在 %s 发布的文章'),
'tag' => _t('标签 %s 下的文章'),
'author' => _t('作者 %s 发布的文章')
), '', ''); ?>&nbsp;-</h2>
<?php
$previousYear = null;
while($this->next()):
$currentYear = date('Y', $this->created);
if ($previousYear !== $currentYear):
if ($previousYear !== null): ?>
</div> <!-- 关闭上一年的 div -->
<?php endif; ?>
<h3><?php echo $currentYear; ?></h3>
<div class="archive-year">
<?php
$previousYear = $currentYear;
endif;
?>
<article class="archive-item">
<a class="archive-item-link" href="<?php $this->permalink() ?>"><?php $this->title() ?></a>
<span class="archive-item-date"><?php $this->date('Y-m-d'); ?></span>
</article>
<?php endwhile; ?>
<?php if ($previousYear !== null): ?>
</div> <!-- 关闭最后一年的 div -->
<?php endif; ?>
</div>
<?php $this->need('part/paginator.php'); ?>
</div>
<?php $this->need('part/footer.php'); ?>

487
comments.php Normal file
View File

@ -0,0 +1,487 @@
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<style>
/* 分页 */
.pagination_page{
display: flex;
align-items: center;
justify-content: center;
margin-top: var(--margin);
gap: 0.5rem;
}
.pagination_page li.active a {
background: var(--theme);
color: #fff;
font-weight: 500;
}
.pagination_page a{
display: flex;
padding: 0.5rem;
font-size: 0.9rem;
width: 1.75rem;
height: 1.75rem;
background: var(--background);
border-radius: 50%;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
transition: 0.2s;
-webkit-transition: 0.2s;
justify-content: center;
align-items: center;
letter-spacing: 0;
}
.pagination_page span.next{
cursor: pointer;
}
.pagination_page li.active a:hover{
cursor: not-allowed;
}
.comment-form label {
display: block;
margin-bottom: .5rem;
font-size: 14px;
cursor: pointer;
line-height: 1.4
}
.comment-form label .required {
color: red
}
.comment-form input,
.comment-form textarea {
width: 100%;
resize: none;
border-radius: 5px;
box-sizing: border-box;
border: 1px solid #999;
padding: 8px 15px;
font-size: 14px
}
.comment-form .submit {
background-color: #000;
color: #fff;
border: 0;
font-size: 14px;
cursor: pointer;
padding: 8px 30px;
border-radius: 5px;
width: auto
}
.comment-form .submit:hover {
background-color: var(--farallon-text-light)
}
.comment-form p {
margin-bottom: 15px
}
.comment-form p:last-of-type {
margin-bottom: 0
}
.comment-form .comment-notes,
.comment-form .logged-in-as {
font-size: 12px;
color: var(--farallon-text-gray)
}
.comment-reply-title {
font-weight: 700;
font-size: 18px;
display: flex;
align-items: center
}
.comment-reply-title small {
margin-left: auto;
font-weight: 400;
font-size: 14px
}
.commentlist {
border-top: 1px solid var(--farallon-border-color-light);
list-style: none;
padding-top: 10px
}
.commentlist .comment {
padding: 0 0
}
.commentlist .comment-respond {
margin-top: 20px;
padding: 20px;
background-color: var(--farallon-background-gray);
border-radius: 5px
}
@keyframes comment--fresh {
0% {
background-color: #fff
}
100% {
background-color: #fffee0
}
}
.comment:last-child>.comment-body {
border-bottom: 0
}
.comment.parent {
border-bottom: 1px solid var(--farallon-border-color-light)
}
.comment.parent:last-child {
border-bottom: 0
}
.comment-body {
padding: 25px 0
}
.comment-body__fresh {
animation: comment--fresh 1.5s ease-in-out infinite alternate;
border-radius: 5px
}
.comment-body .avatar {
transition: .5s box-shadow
}
.comment-body:hover .avatar {
box-shadow: 0 0 3px 0 var(--farallon-hover-color)
}
.comment--avatar {
flex: none;
margin-right: 10px;
display: flex
}
.comment--author {
flex: auto;
display: flex;
align-items: center
}
.comment--author .comment-reply-link {
margin-left: auto
}
.comment--author .comment-reply-link svg {
fill: var(--farallon-text-gray);
width: 15px;
height: 15px
}
.comment--author .comment-reply-link:hover svg {
fill: var(--farallon-hover-color)
}
.comment--author a {
color: var(--farallon-main-color)
}
.comment--author a:hover {
color: var(--farallon-hover-color);
text-decoration: underline
}
.comment--meta {
display: flex;
align-items: center;
flex: auto
}
.comment--time {
color: var(--farallon-text-light)
}
.comment-meta {
display: flex;
align-items: center
}
.comment-meta .avatar {
border-radius: 100%
}
div.cancel-comment-reply.cancel-comment-reply-link {
text-align: right;
}
.comment-content {
word-wrap: break-word !important;
overflow-wrap: break-word !important;
white-space: normal !important;
color: var(--farallon-text-light)
}
.comment-content a {
text-decoration: underline
}
.comment-content a:hover {
color: var(--farallon-hover-color)
}
.children {
margin-left: 0;
padding-bottom: 10px
}
.children .avatar {
width: 32px;
height: 32px
}
.children .comment-body {
border-bottom: 0;
padding: 15px 0
}
.children .comment-content {
font-size: 14px
}
.parent>.children {
margin-left: 50px
}
.comment-meta {
margin-bottom: 10px;
font-size: 14px;
display: flex;
align-items: center
}
.comment-meta .comment-metadata {
margin-left: auto
}
.comment-reply-link {
font-size: 12px
}
.no--comment {
text-align: center;
padding: 30px 0
}
.comments--title {
margin-top: 30px;
font-size: 18px;
font-weight: 700;
margin-bottom: 10px;
display: flex;
align-items: center
}
.comments--title svg {
width: 24px;
height: 24px;
margin-right: 5px;
position: relative;
transform: translate3d(0, 1px, 0);
fill: var(--farallon-text-color)
}
.comment-respond {
padding-top: 30px
}
.comment-form-cookies-consent #wp-comment-cookies-consent {
display: none
}
.comment-form-cookies-consent label {
font-size: 14px;
color: var(--farallon-text-gray);
display: flex;
align-items: center;
position: relative
}
.comment-form-cookies-consent label::before {
background-color: #fff;
border: 1px solid rgba(0, 0, 0, .15);
border-radius: 100%;
height: 16px;
margin-right: 6px;
vertical-align: middle;
width: 16px;
content: "";
flex: none
}
.dot::before {
content: "·";
margin-left: 4px;
margin-right: 4px
}
.comment-form-cookies-consent input:checked+label::after {
background-color: var(--farallon-main-color);
border-radius: 100%;
content: "";
position: absolute;
left: 1px;
height: 12px;
margin: 2px;
width: 12px;
flex: none
}
/* 去除有序列表(<ol>)的列表号 */
ol.comment-list {
list-style-type: none;
padding-left: 0; /* 取消左侧的默认填充 */
}
/* 去除无序列表(<ul>)的列表号 */
ul.comment-list {
list-style-type: none;
padding-left: 0; /* 取消左侧的默认填充 */
}
/* 适用于所有嵌套的评论列表 */
ol.comment-list li, ul.comment-list li {
list-style-type: none;
}
/* 分页 */
</style>
<div class="post--ingle__comments">
<?php $this->comments()->to($comments); ?>
<?php if($this->allow('comment')): ?>
<?php if ($this->is('attachment')) : ?>
<?php _e(''); ?>
<?php else: ?>
<h3 class="comments--title" id="comments">
<svg viewBox="0 0 24 24" class="icon" aria-hidden="true" width="16" height="16">
<g>
<path
d="M1.751 10c0-4.42 3.584-8 8.005-8h4.366c4.49 0 8.129 3.64 8.129 8.13 0 2.96-1.607 5.68-4.196 7.11l-8.054 4.46v-3.69h-.067c-4.49.1-8.183-3.51-8.183-8.01zm8.005-6c-3.317 0-6.005 2.69-6.005 6 0 3.37 2.77 6.08 6.138 6.01l.351-.01h1.761v2.3l5.087-2.81c1.951-1.08 3.163-3.13 3.163-5.36 0-3.39-2.744-6.13-6.129-6.13H9.756z">
</path>
</g>
</svg><?php $this->commentsNum(_t('0'), _t('1'), _t('%d')); ?>
</h3>
<ol class="commentlist sulliComment--list"></ol>
<?php if ($comments->have()): ?>
<?php $comments->listComments(); ?>
<?php
$comments->pageNav(
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10.8284 12.0007L15.7782 16.9504L14.364 18.3646L8 12.0007L14.364 5.63672L15.7782 7.05093L10.8284 12.0007Z" fill="var(--main)"></path></svg>',
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13.1714 12.0007L8.22168 7.05093L9.63589 5.63672L15.9999 12.0007L9.63589 18.3646L8.22168 16.9504L13.1714 12.0007Z" fill="var(--main)"></path></svg>',
1,
'...',
array(
'wrapTag' => 'div',
'wrapClass' => 'pagination_page',
'itemTag' => '',
'textTag' => 'a',
'currentClass' => 'active',
'prevClass' => 'prev',
'nextClass' => 'next'
)
);
?>
<?php else: ?>
<center><h3><?php _e('暂无评论'); ?></h3></center>
<?php endif; ?>
<div id="<?php $this->respondId(); ?>" class="comment-respond">
<div class="cancel-comment-reply cancel-comment-reply-link"><?php $comments->cancelReply(); ?></div>
<form method="post" action="<?php $this->commentUrl() ?>" id="comment-form" role="form" class="comment-form">
<?php if($this->user->hasLogin()): ?>
<p><?php _e('登录身份: '); ?>
<a href="<?php $this->options->profileUrl(); ?>">
<?php $this->user->screenName(); ?></a>.
<a href="<?php $this->options->logoutUrl(); ?>" title="Logout"><?php _e('退出'); ?> &raquo;</a></p>
<?php else: ?>
<p class="comment-form-author">
<input placeholder="称呼 *" type="text" name="author" id="author" class="text" value="" required />
</p>
<p class="comment-notes">
<input placeholder="邮箱<?php if ($this->options->commentsRequireMail): ?> *<?php endif; ?>" type="email" name="mail" id="mail" class="text" value=""<?php if ($this->options->commentsRequireMail): ?> required<?php endif; ?> />
</p>
<p class="comment-form-url">
<input type="url" name="url" id="url" class="text" placeholder="http(s)://<?php if ($this->options->commentsRequireURL): ?> *<?php endif; ?>" value=""<?php if ($this->options->commentsRequireURL): ?> required<?php endif; ?> />
</p>
<?php endif; ?>
<p class="comment-form-comment">
<textarea rows="8" cols="50" name="text" id="textarea" class="textarea" onkeydown="if(event.ctrlKey&&event.keyCode==13){document.getElementById('misubmit').click();return false};" placeholder="<?php _e('评论审核后显示,请勿重复提交...'); ?>" required ><?php $this->remember('text'); ?></textarea>
</p>
<p class="form-submit">
<button type="submit" class="submit" id="misubmit"><?php _e('提交评论Ctrl+Enter'); ?></button>
</p>
</form>
</div>
<?php endif; ?>
<?php else: ?>
<?php _e(''); ?>
<?php endif; ?>
<?php $this->options->twikoo(); ?>
</div>
<?php
function threadedComments($comments, $options) {
$commentClass = '';
if ($comments->authorId) {
if ($comments->authorId == $comments->ownerId) {
$commentClass .= ' comment-by-author';
} else {
$commentClass .= ' comment-by-user';
}
}
$depth = $comments->levels + 1;
?>
<li id="li-<?php $comments->theId(); ?>" class="<?php
if ($comments->levels == 0) {
echo 'comment parent';
} else {
echo 'comment child';
}
echo $commentClass;
?>">
<div class="comment-body" id="<?php $comments->theId(); ?>">
<div class="comment-meta">
<div class="comment--avatar">
<?php if ($comments->url): ?>
<a href="<?php echo $comments->url ?>" target="_blank" rel="external nofollow"><?php echo $comments->gravatar('40', ''); ?> </a>
<?php else: ?>
<?php echo $comments->gravatar('40', ''); ?>
<?php endif; ?>
</div>
<div class="comment--meta">
<div class="comment--author"><?php echo $comments->author; ?><span class="dot"></span>
<div class="comment--time"><?php $comments->date('Y-m-d H:i'); ?></div>
<span class="comment-reply-link u-cursorPointer">
<?php $comments->reply('<svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true" class="" ><g><path d="M12 3.786c-4.556 0-8.25 3.694-8.25 8.25s3.694 8.25 8.25 8.25c1.595 0 3.081-.451 4.341-1.233l1.054 1.7c-1.568.972-3.418 1.534-5.395 1.534-5.661 0-10.25-4.589-10.25-10.25S6.339 1.786 12 1.786s10.25 4.589 10.25 10.25c0 .901-.21 1.77-.452 2.477-.592 1.731-2.343 2.477-3.917 2.334-1.242-.113-2.307-.74-3.013-1.647-.961 1.253-2.45 2.011-4.092 1.78-2.581-.363-4.127-2.971-3.76-5.578.366-2.606 2.571-4.688 5.152-4.325 1.019.143 1.877.637 2.519 1.342l1.803.258-.507 3.549c-.187 1.31.761 2.509 2.079 2.629.915.083 1.627-.356 1.843-.99.2-.585.345-1.224.345-1.83 0-4.556-3.694-8.25-8.25-8.25zm-.111 5.274c-1.247-.175-2.645.854-2.893 2.623-.249 1.769.811 3.143 2.058 3.319 1.247.175 2.645-.854 2.893-2.623.249-1.769-.811-3.144-2.058-3.319z"></path></g></svg>'); ?>
</span>
</div>
</div>
</div>
<div class="comment-content">
<?php $comments->content(); ?>
</div>
</div>
<?php if ($comments->children) { ?>
<ol class="children">
<?php $comments->threadedComments($options); ?>
</ol>
<?php } ?>
</li>
<?php } ?>
<ol class="commentlist">
<?php $this->comments()->to($comments); ?>
<?php while($comments->next()): ?>
<?php endwhile; ?>
</ol>

1160
dist/css/style.css vendored Normal file

File diff suppressed because it is too large Load Diff

87
dist/js/script.js vendored Normal file
View File

@ -0,0 +1,87 @@
// declaraction of document.ready() function.
(function () {
var ie = !!(window.attachEvent && !window.opera);
var wk = /webkit\/(\d+)/i.test(navigator.userAgent) && (RegExp.$1 < 525);
var fn = [];
var run = function () {
for (var i = 0; i < fn.length; i++) fn[i]();
};
var d = document;
d.ready = function (f) {
if (!ie && !wk && d.addEventListener)
return d.addEventListener('DOMContentLoaded', f, false);
if (fn.push(f) > 1) return;
if (ie)
(function () {
try {
d.documentElement.doScroll('left');
run();
} catch (err) {
setTimeout(arguments.callee, 0);
}
})();
else if (wk)
var t = setInterval(function () {
if (/^(loaded|complete)$/.test(d.readyState))
clearInterval(t), run();
}, 0);
};
})();
document.ready(
// toggleTheme function.
// this script shouldn't be changed.
() => {
var _Blog = window._Blog || {};
const currentTheme = window.localStorage && window.localStorage.getItem('theme');
const isDark = currentTheme === 'dark';
const pagebody = document.getElementsByTagName('body')[0]
if (isDark) {
document.getElementById("switch_default").checked = true;
// mobile
document.getElementById("mobile-toggle-theme").innerText = "· Dark"
} else {
document.getElementById("switch_default").checked = false;
// mobile
document.getElementById("mobile-toggle-theme").innerText = "· Light"
}
_Blog.toggleTheme = function () {
if (isDark) {
pagebody.classList.add('dark-theme');
// mobile
document.getElementById("mobile-toggle-theme").innerText = "· Dark"
} else {
pagebody.classList.remove('dark-theme');
// mobile
document.getElementById("mobile-toggle-theme").innerText = "· Light"
}
document.getElementsByClassName('toggleBtn')[0].addEventListener('click', () => {
if (pagebody.classList.contains('dark-theme')) {
pagebody.classList.remove('dark-theme');
} else {
pagebody.classList.add('dark-theme');
}
window.localStorage &&
window.localStorage.setItem('theme', document.body.classList.contains('dark-theme') ? 'dark' : 'light',)
})
// moblie
document.getElementById('mobile-toggle-theme').addEventListener('click', () => {
if (pagebody.classList.contains('dark-theme')) {
pagebody.classList.remove('dark-theme');
// mobile
document.getElementById("mobile-toggle-theme").innerText = "· Light"
} else {
pagebody.classList.add('dark-theme');
// mobile
document.getElementById("mobile-toggle-theme").innerText = "· Dark"
}
window.localStorage &&
window.localStorage.setItem('theme', document.body.classList.contains('dark-theme') ? 'dark' : 'light',)
})
};
_Blog.toggleTheme();
// ready function.
}
);

1
dist/js/tocbot.min.js vendored Normal file

File diff suppressed because one or more lines are too long

151
functions.php Normal file
View File

@ -0,0 +1,151 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
function themeConfig($form) {
$logoUrl = new Typecho_Widget_Helper_Form_Element_Text('logoUrl', NULL, NULL, _t('站点 LOGO 地址'));
$form->addInput($logoUrl);
$icoUrl = new Typecho_Widget_Helper_Form_Element_Text('icoUrl', NULL, NULL, _t('站点 Favicon 地址'));
$form->addInput($icoUrl);
$instagramurl = new Typecho_Widget_Helper_Form_Element_Text('instagramurl', NULL, NULL, _t('Instagram'), _t('会在个人信息显示'));
$form->addInput($instagramurl);
$telegramurl = new Typecho_Widget_Helper_Form_Element_Text('telegramurl', NULL, NULL, _t('电报'), _t('会在个人信息显示'));
$form->addInput($telegramurl);
$githuburl = new Typecho_Widget_Helper_Form_Element_Text('githuburl', NULL, NULL, _t('github'), _t('会在个人信息显示'));
$form->addInput($githuburl);
$twitterurl = new Typecho_Widget_Helper_Form_Element_Text('twitterurl', NULL, NULL, _t('twitter'), _t('会在个人信息显示'));
$form->addInput($twitterurl);
$mastodonurl = new Typecho_Widget_Helper_Form_Element_Text('mastodonurl', NULL, NULL, _t('mastodon'), _t('会在个人信息显示'));
$form->addInput($mastodonurl);
$sitemapurl = new Typecho_Widget_Helper_Form_Element_Text('sitemapurl', NULL, NULL, _t('sitemap'), _t('会在页脚显示'));
$form->addInput($sitemapurl);
$cnavatar = new Typecho_Widget_Helper_Form_Element_Text('cnavatar', NULL, 'https://cravatar.cn/avatar/', _t('Gravatar镜像'), _t('默认https://cravatar.cn/avatar/,建议保持默认'));
$form->addInput($cnavatar);
$twikoo = new Typecho_Widget_Helper_Form_Element_Textarea('twikoo', NULL, NULL, _t('引用第三方评论'), _t('不填写则不显示'));
$form->addInput($twikoo);
$addhead = new Typecho_Widget_Helper_Form_Element_Textarea('addhead', NULL, NULL, _t('添加head'), _t('支持HTML'));
$form->addInput($addhead);
$tongji = new Typecho_Widget_Helper_Form_Element_Textarea('tongji', NULL, NULL, _t('统计代码'), _t('支持HTML'));
$form->addInput($tongji);
$showtoc = new Typecho_Widget_Helper_Form_Element_Radio('showtoc',
array('0'=> _t('否'), '1'=> _t('是')),
'0', _t('是否显示文章目录'), _t('选择“是”将在文章页面显示文章目录(仅在宽度大于1400px的设备中显示)。'));
$form->addInput($showtoc);
}
function get_post_view($archive) {
$cid = $archive->cid;
$db = Typecho_Db::get();
$prefix = $db->getPrefix();
if (!array_key_exists('views', $db->fetchRow($db->select()->from('table.contents')))) {
$db->query('ALTER TABLE `' . $prefix . 'contents` ADD `views` INT(10) DEFAULT 0;');
echo 0;
return;
}
$row = $db->fetchRow($db->select('views')->from('table.contents')->where('cid = ?', $cid));
if ($archive->is('single')) {
$views = Typecho_Cookie::get('extend_contents_views');
if (empty($views)) {
$views = array();
} else {
$views = explode(',', $views);
}
if (!in_array($cid, $views)) {
$db->query($db->update('table.contents')->rows(array('views' => (int)$row['views'] + 1))->where('cid = ?', $cid));
array_push($views, $cid);
$views = implode(',', $views);
Typecho_Cookie::set('extend_contents_views', $views); //记录查看cookie
}
}
echo $row['views'];
}
// 获取Typecho的选项
$options = Typecho_Widget::widget('Widget_Options');
// 检查cnavatar是否已设置如果未设置或为空则使用默认的Gravatar前缀
$gravatarPrefix = empty($options->cnavatar) ? 'https://cravatar.cn/avatar/' : $options->cnavatar;
// 定义全局常量__TYPECHO_GRAVATAR_PREFIX__用于存储Gravatar前缀
define('__TYPECHO_GRAVATAR_PREFIX__', $gravatarPrefix);
/**
* 页面加载时间
*/
function timer_start() {
global $timestart;
$mtime = explode( ' ', microtime() );
$timestart = $mtime[1] + $mtime[0];
return true;
}
timer_start();
function timer_stop( $display = 0, $precision = 3 ) {
global $timestart, $timeend;
$mtime = explode( ' ', microtime() );
$timeend = $mtime[1] + $mtime[0];
$timetotal = number_format( $timeend - $timestart, $precision );
$r = $timetotal < 1 ? $timetotal * 1000 . " ms" : $timetotal . " s";
if ( $display ) {
echo $r;
}
return $r;
}
/*
* 全站字数
*/
function allwords() {
$chars = 0;
$db = Typecho_Db::get();
$select = $db ->select('text')->from('table.contents');//如果只要统计文章总字数不要统计单页的话可在后面加入->where('type = ?','post')
$rows = $db->fetchAll($select);
foreach ($rows as $row) { $chars += mb_strlen(trim($row['text']), 'UTF-8'); }
if($chars<50000){
echo '全站共 '.$chars.' 字,还在努力更新中,加油!加油啦!';}
elseif ($chars<70000 && $chars>50000){
echo '全站共 '.$chars.' 字,写完一本埃克苏佩里的《小王子》了!';}
elseif ($chars<90000 && $chars>70000){
echo '全站共 '.$chars.' 字,写完一本鲁迅的《呐喊》了!';}
elseif ($chars<100000 && $chars>90000){
echo '全站共 '.$chars.' 字,写完一本林海音的《城南旧事》了!';}
elseif ($chars<110000 && $chars>100000){
echo '全站共 '.$chars.' 字,写完一本马克·吐温的《王子与乞丐》了!';}
elseif ($chars<120000 && $chars>110000){
echo '全站共 '.$chars.' 字,写完一本鲁迅的《彷徨》了!';}
elseif ($chars<130000 && $chars>120000){
echo '全站共 '.$chars.' 字,写完一本余华的《活着》了!';}
elseif ($chars<140000 && $chars>130000){
echo '全站共 '.$chars.' 字,写完一本曹禺的《雷雨》了!';}
elseif ($chars<150000 && $chars>140000){
echo '全站共 '.$chars.' 字,写完一本史铁生的《宿命的写作》了!';}
elseif ($chars<160000 && $chars>150000){
echo '全站共 '.$chars.' 字,写完一本伯内特的《秘密花园》了!';}
elseif ($chars<170000 && $chars>160000){
echo '全站共 '.$chars.' 字,写完一本曹禺的《日出》了!';}
elseif ($chars<180000 && $chars>170000){
echo '全站共 '.$chars.' 字,写完一本马克·吐温的《汤姆·索亚历险记》了!';}
elseif ($chars<190000 && $chars>180000){
echo '全站共 '.$chars.' 字,写完一本沈从文的《边城》了!';}
elseif ($chars<200000 && $chars>190000){
echo '全站共 '.$chars.' 字,写完一本亚米契斯的《爱的教育》了!';}
elseif ($chars<210000 && $chars>200000){
echo '全站共 '.$chars.' 字,写完一本巴金的《寒夜》了!';}
elseif ($chars<220000 && $chars>210000){
echo '全站共 '.$chars.' 字,写完一本东野圭吾的《解忧杂货店》了!';}
elseif ($chars<230000 && $chars>220000){
echo '全站共 '.$chars.' 字,写完一本莫泊桑的《一生》了!';}
elseif ($chars<250000 && $chars>230000){
echo '全站共 '.$chars.' 字,写完一本简·奥斯汀的《傲慢与偏见》了!';}
elseif ($chars<280000 && $chars>250000){
echo '全站共 '.$chars.' 字,写完一本钱钟书的《围城》了!';}
elseif ($chars<300000 && $chars>280000){
echo '全站共 '.$chars.' 字,写完一本张炜的《古船》了!';}
elseif ($chars<310000 && $chars>300000){
echo '全站共 '.$chars.' 字,写完一本茅盾的《子夜》了!';}
elseif ($chars<320000 && $chars>310000){
echo '全站共 '.$chars.' 字,写完一本阿来的《尘埃落定》了!';}
elseif ($chars<340000 && $chars>320000){
echo '全站共 '.$chars.' 字,写完一本艾米莉·勃朗特的《呼啸山庄》了!';}
elseif ($chars<350000 && $chars>340000){
echo '全站共 '.$chars.' 字,写完一本雨果的《巴黎圣母院》了!';}
elseif ($chars<400000 && $chars>350000){
echo '全站共 '.$chars.' 字,写完一本东野圭吾的《白夜行》了!';}
elseif ($chars<1000000 && $chars>400000){
echo '全站共 '.$chars.' 字,写完一本我国著名的四大名著了!';}
elseif ($chars>1000000){
echo '全站共 '.$chars.' 字,已写一本列夫·托尔斯泰的《战争与和平》了!';}
}

15
index.php Normal file
View File

@ -0,0 +1,15 @@
<?php
/**
* 移植自Hexo主题 Chic
* @package Chic
* @author 老孙
* @version 0.1
* @link https://imsun.org
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
$this->need('part/head.php');
?>
<div class="wrapper">
<?php $this->need('part/header.php'); ?>
<?php $this->need('part/profile.php'); ?>
<?php $this->need('part/footer.php'); ?>

52
page-archives.php Normal file
View File

@ -0,0 +1,52 @@
<?php
/**
* 文章归档
*
* @package custom
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $this->need('part/head.php'); ?>
<div class="wrapper">
<?php $this->need('part/header.php'); ?>
<div class="main">
<div class="post-wrap archive">
<h2 class="post-title">-&nbsp;&nbsp;<?php $this->title() ?>&nbsp;&nbsp;-</h2>
<?php
$stat = Typecho_Widget::widget('Widget_Stat');
Typecho_Widget::widget('Widget_Contents_Post_Recent', 'pageSize=' . $stat->publishedPostsNum)->to($archives);
$year = 0; $mon = 0;
$output = '<div class="post-wrap archive">'; // Start archives container
while ($archives->next()) {
$year_tmp = date('Y', $archives->created);
$mon_tmp = date('m', $archives->created);
// 检查是否需要新的年份标题
if ($year != $year_tmp) {
if ($year > 0) {
$output .= '</ul> '; // 结束上一个年份的月份列表和包裹的div
}
$year = $year_tmp;
$mon = 0; // 重置月份
$output .= '<h3>' . $year . '</h3>'; // 开始新的年份div
}
// 输出文章项
$output .= '<article class="archive-item">';
$output .= '<a class="archive-item-link" href="' . $archives->permalink . '">' . $archives->title . '</a>';
$output .= '<span class="archive-item-date">' . date('m月d,Y', $archives->created) . '</span></article>';
}
// 循环后,确保所有标签都已经关闭
if ($mon > 0) {
$output .= '</ul>'; // 结束最后一个月份的列表
}
if ($year > 0) {
$output .= '</div>'; // 结束最后一个年份的div
}
$output .= '</div>'; // End archives container
echo $output;
?>
</div>
</div>
<br>
<?php $this->need('part/footer.php'); ?>

51
page-categories.php Normal file
View File

@ -0,0 +1,51 @@
<?php
/**
* 全部分类
*
* @package custom
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $this->need('part/head.php'); ?>
<div class="wrapper">
<?php $this->need('part/header.php'); ?>
<div class="main">
<div class="container">
<div class="post-wrap categories">
<h2 class="post-title">-&nbsp;&nbsp;<?php $this->title() ?>&nbsp;&nbsp;-</h2>
<div class="categories-card">
<?php $this->widget('Widget_Metas_Category_List')->to($categories); ?>
<?php while($categories->next()): ?>
<div class="card-item">
<div class="categories">
<a href="<?php $categories->permalink(); ?>">
<h3>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M2 4C2 3.44772 2.44772 3 3 3H10.4142L12.4142 5H21C21.5523 5 22 5.44772 22 6V20C22 20.5523 21.5523 21 21 21L3 21C2.45 21 2 20.55 2 20V4ZM10.5858 6L9.58579 5H4V7H9.58579L10.5858 6ZM4 9V19L20 19V7H12.4142L10.4142 9H4Z"></path></svg>
<?php $categories->name(); ?>
</h3>
</a>
<?php
// 获取当前分类下的文章
$this->widget('Widget_Archive@category_' . $categories->mid, 'pageSize=5&type=category', 'mid=' . $categories->mid)->to($posts);
?>
<?php if($posts->have()): ?>
<?php while($posts->next()): ?>
<article class="archive-item">
<a class="archive-item-link" href="<?php $posts->permalink(); ?>"><?php $posts->title(25); ?></a>
</article>
<?php endwhile; ?>
<a class="more-post-link" href="<?php $categories->permalink(); ?>">More >></a>
<?php else: ?>
<p>该分类下没有文章。</p>
<?php endif; ?>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
</div>
<?php $this->need('part/footer.php'); ?>

123
page-links.php Normal file
View File

@ -0,0 +1,123 @@
<?php
/**
* 友情链接
*
* @package custom
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $this->need('part/head.php');?>
<?php $this->need('part/header.php'); ?>
<div class="container">
<article class="post-wrap page">
<div class="post-wrap">
<h2 class="post-title">-&nbsp;&nbsp;<?php $this->title() ?>&nbsp;&nbsp;-</h2>
<section class="post-content">
<div id="links">
<div class="links-content">
<div class="link-navigation">
<?php
Links_Plugin::output('
<div class="card">
<img class="ava" src="{image}" onerror=this.onerror=null,this.src="https://cdn.jsdelivr.net/gh/jkjoy/14e@0.0.1/img/loading.svg">
<div class="card-header">
<div><a href="{url}" target="_blank" title="{name}">{name}</a></div>
<div class="info" title="{title}">{title}</div>
</div></div>
');
?>
</section>
<!-- 判断如果允许评论则显示评论的div -->
<?php if ($this->allow('comment')): ?>
<!-- 如果启用了 twikoo 选项,显示 twikoo 评论系统 -->
<?php if ($this->options->twikoo): ?>
<?php $this->options->twikoo(); ?>
<?php else: ?>
<!-- 否则调用自带的评论模板 -->
<?php $this->need('comments.php'); ?>
<?php endif; ?>
<?php endif; ?>
</div>
</article>
</div>
<?php $this->need('part/footer.php'); ?>
<style>
#links {
padding-left: 3.5em;
}
.container .main-inner {
width: 1100px;
}
.links-content {
margin-top: 1rem;
}
.link-navigation::after {
content: " ";
display: block;
clear: both;
}
.card {
width: 45%;
font-size: 1.5rem;
padding: 20px 10px;
border-radius: 4px;
transition-duration: 0.15s;
margin-bottom: 1rem;
display: flex;
}
.card:nth-child(odd) {
float: left;
}
.card:nth-child(even) {
float: right;
}
.card:hover {
transform: scale(1.1);
box-shadow: 0 2px 6px 0 rgba(0,0,0,0.12), 0 0 6px 0 rgba(0,0,0,0.04);
}
.card a {
border: none;
}
.card .ava {
width: 4rem !important;
height: 4rem !important;
margin: 0 !important;
margin-right: 1em !important;
border-radius: 50%;
display: block;
transition: all 0.75s;
}
.card .ava:hover {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-o-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
.card .card-header {
font-style: italic;
overflow: hidden;
width: 100%;
text-overflow: ellipsis;
white-space: nowrap;
}
.card .card-header a {
font-style: normal;
color: #2bbc8a;
font-weight: bold;
text-decoration: none;
}
.card .card-header a:hover {
color: #d480aa;
text-decoration: none;
}
.card .card-header .info {
font-style: normal;
color: #a3a3a3;
font-size: 14px;
min-width: 0;
word-break: break-word;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>

26
page-tags.php Normal file
View File

@ -0,0 +1,26 @@
<?php
/**
* 全部标签
*
* @package custom
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $this->need('part/head.php'); ?>
<div class="wrapper">
<?php $this->need('part/header.php'); ?>
<div class="main">
<div class="container">
<div class="post-wrap tags">
<h2 class="post-title">-&nbsp;&nbsp;<?php $this->title() ?>&nbsp;&nbsp;-</h2>
<?php $this->widget('Widget_Metas_Tag_Cloud', 'sort=mid&ignoreZeroCount=1&desc=0')->to($tags); ?>
<?php if($tags->have()): ?>
<div class="tag-cloud-tags">
<?php while ($tags->next()): ?>
<a role="listitem" target="<?php $this->options->sidebarLinkOpen(); ?>" data-toggle="tooltip" data-placement="top" href="<?php $tags->permalink(); ?>" rel="tag" title="<?php $tags->count(); ?> 篇文章"><?php $tags->name(); ?> <small>(<?php $tags->count(); ?>)</small></a>
<?php endwhile; ?>
</div>
<?php else: ?>
<p class="text-center pb-2"><?php _e('没有任何标签'); ?></p>
<?php endif; ?>
</div></div></div>
<?php $this->need('part/footer.php'); ?>

25
page.php Normal file
View File

@ -0,0 +1,25 @@
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $this->need('part/head.php');?>
<?php $this->need('part/header.php'); ?>
<div class="container">
<article class="post-wrap page">
<div class="post-wrap">
<h2 class="post-title">-&nbsp;&nbsp;<?php $this->title() ?>&nbsp;&nbsp;-</h2>
<section class="post-content">
<?php $this->content(); ?>
</section>
<!-- 判断如果允许评论则显示评论的div -->
<?php if ($this->allow('comment')): ?>
<!-- 如果启用了 twikoo 选项,显示 twikoo 评论系统 -->
<?php if ($this->options->twikoo): ?>
<?php $this->options->twikoo(); ?>
<?php else: ?>
<!-- 否则调用自带的评论模板 -->
<?php $this->need('comments.php'); ?>
<?php endif; ?>
<?php endif; ?>
</div>
</article>
</div>
<?php $this->need('part/footer.php'); ?>

10
part/footer.php Normal file
View File

@ -0,0 +1,10 @@
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<footer id="footer" class="footer">
<div class="copyright">
<span>© <?php $this->options->title() ?> | Powered by <a href="https://typecho.org" target="_blank">Typecho</a> | 移植 by <a href="https://imsun.org" target="_blank">Sun</a> </span>
</div>
<?php $this->options->tongji(); ?>
</footer>
</div>
</body>
</html>

28
part/head.php Normal file
View File

@ -0,0 +1,28 @@
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="author" content="<?php $this->options->author() ?>">
<meta name="description" content="<?php $this->options->description() ?>">
<meta name="keywords" content="<?php $this->options->keywords() ?>">
<title>
<?php if($this->_currentPage>1) echo '第 '.$this->_currentPage.' 页 - '; ?><?php $this->archiveTitle(array(
'category' => _t('分类 %s 下的文章'),
'search' => _t('包含关键字 %s 的文章'),
'tag' => _t('标签 %s 下的文章'),
'date' => _t('在<span> %s </span>发布的文章'),
'author' => _t('%s 发布的文章')
), '', ' - '); ?><?php if ($this->is('post')) $this->category(',', false);?><?php if ($this->is('post')) echo ' - ';?><?php $this->options->title(); ?><?php if ($this->is('index')) echo ' - '; ?><?php if ($this->is('index')) $this->options->description() ?>
</title>
<link rel="icon" href="<?php $this->options->icoUrl() ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('/dist/css/style.css'); ?>">
<script src="<?php $this->options->themeUrl('/dist/js/script.js'); ?>"></script>
<script src="<?php $this->options->themeUrl('/dist/js/tocbot.min.js'); ?>"></script>
<?php $this->header("generator=&template=&pingback=&wlw=&xmlrpc=&rss1=&atom=&rss2=/feed"); ?>
<?php $this->options->addhead(); ?>
<?php $this->header(); ?>
</head>
<body>

48
part/header.php Normal file
View File

@ -0,0 +1,48 @@
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<header>
<nav class="navbar">
<div class="container">
<div class="navbar-header header-logo">
<a href="<?php $this->options->siteUrl(); ?>"><?php $this->options->title() ?></a>
</div>
<div class="menu navbar-right">
<?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
<?php while($pages->next()): ?>
<a <?php if($this->is('page', $pages->slug)): ?> <?php endif; ?>class="menu-item" href="<?php $pages->permalink(); ?>" title="<?php $pages->title(); ?>"><?php $pages->title(); ?></a>
<?php endwhile; ?>
<input id="switch_default" type="checkbox" class="switch_default">
<label for="switch_default" class="toggleBtn"></label>
</div>
</div>
</nav>
<nav class="navbar-mobile" id="nav-mobile">
<div class="container">
<div class="navbar-header">
<div>
<a href="/"><?php $this->options->title() ?></a>
<a id="mobile-toggle-theme">·&nbsp;Light</a>
</div>
<div class="menu-toggle" onclick="mobileBtn()">&#9776; Menu</div>
</div>
<div class="menu" id="mobile-menu">
<?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
<?php while($pages->next()): ?>
<a <?php if($this->is('page', $pages->slug)): ?> <?php endif; ?>class="menu-item" href="<?php $pages->permalink(); ?>" title="<?php $pages->title(); ?>"><?php $pages->title(); ?></a>
<?php endwhile; ?>
</div>
</div>
</nav>
</header>
<script>
var mobileBtn = function f() {
var toggleMenu = document.getElementsByClassName("menu-toggle")[0];
var mobileMenu = document.getElementById("mobile-menu");
if(toggleMenu.classList.contains("active")){
toggleMenu.classList.remove("active")
mobileMenu.classList.remove("active")
}else{
toggleMenu.classList.add("active")
mobileMenu.classList.add("active")
}
}
</script>

67
part/paginator.php Normal file
View File

@ -0,0 +1,67 @@
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<nav class="pagination">
</nav>
<?php
$this->pagenav(
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10.8284 12.0007L15.7782 16.9504L14.364 18.3646L8 12.0007L14.364 5.63672L15.7782 7.05093L10.8284 12.0007Z" fill="var(--main)"></path></svg>',
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13.1714 12.0007L8.22168 7.05093L9.63589 5.63672L15.9999 12.0007L9.63589 18.3646L8.22168 16.9504L13.1714 12.0007Z" fill="var(--main)"></path></svg>',
1,
'...',
array(
'wrapTag' => 'div',
'wrapClass' => 'pagination_page',
'itemTag' => '',
'textTag' => 'a',
'currentClass' => 'active',
'prevClass' => 'prev',
'nextClass' => 'next'
)
);
?>
<!-- 搜索结果 -->
<style>
/* 分页 */
.pagination_page{
display: flex;
align-items: center;
justify-content: center;
margin-top: var(--margin);
gap: 0.5rem;
}
.pagination_page li.active a {
background: var(--theme);
color: #fff;
font-weight: 500;
}
.pagination_page a{
display: flex;
padding: 0.5rem;
font-size: 0.9rem;
width: 1.75rem;
height: 1.75rem;
background: var(--background);
border-radius: 50%;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
transition: 0.2s;
-webkit-transition: 0.2s;
justify-content: center;
align-items: center;
letter-spacing: 0;
}
.pagination_page span.next{
cursor: pointer;
}
.pagination_page li.active a:hover{
cursor: not-allowed;
}
/* 分页 */
</style>

11
part/profile.php Normal file
View File

@ -0,0 +1,11 @@
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<div class="main">
<div class="container profile-container">
<div class="intro">
<div class="avatar"><a href="/"> <img src="<?php $this->options->logoUrl() ?>"></a></div>
<div class="nickname"> <?php $this->author(); ?></div>
<div class="description"><p><?php $this->options->description() ?></p></div>
<div class="links"><?php $this->need('part/sns.php'); ?></div>
</div>
</div>
</div>

29
part/sns.php Normal file
View File

@ -0,0 +1,29 @@
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<a href="/feed" class="link-item" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="32" height="32" fill="currentColor"><path d="M3 17C5.20914 17 7 18.7909 7 21H3V17ZM3 10C9.07513 10 14 14.9249 14 21H12C12 16.0294 7.97056 12 3 12V10ZM3 3C12.9411 3 21 11.0589 21 21H19C19 12.1634 11.8366 5 3 5V3Z"></path></svg>
</a>
<?php if($this->options->telegramurl): ?>
<a href="<?php $this->options->telegramurl() ?>" class="link-item" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="32" height="32" fill="currentColor"><path d="M17.0943 7.14643C17.6874 6.93123 17.9818 6.85378 18.1449 6.82608C18.1461 6.87823 18.1449 6.92051 18.1422 6.94825C17.9096 9.39217 16.8906 15.4048 16.3672 18.2026C16.2447 18.8578 16.1507 19.1697 15.5179 18.798C15.1014 18.5532 14.7245 18.2452 14.3207 17.9805C12.9961 17.1121 11.1 15.8189 11.2557 15.8967C9.95162 15.0373 10.4975 14.5111 11.2255 13.8093C11.3434 13.6957 11.466 13.5775 11.5863 13.4525C11.64 13.3967 11.9027 13.1524 12.2731 12.8081C13.4612 11.7035 15.7571 9.56903 15.8151 9.32202C15.8246 9.2815 15.8334 9.13045 15.7436 9.05068C15.6539 8.97092 15.5215 8.9982 15.4259 9.01989C15.2904 9.05064 13.1326 10.4769 8.95243 13.2986C8.33994 13.7192 7.78517 13.9242 7.28811 13.9134L7.29256 13.9156C6.63781 13.6847 5.9849 13.4859 5.32855 13.286C4.89736 13.1546 4.46469 13.0228 4.02904 12.8812C3.92249 12.8466 3.81853 12.8137 3.72083 12.783C8.24781 10.8109 11.263 9.51243 12.7739 8.884C14.9684 7.97124 16.2701 7.44551 17.0943 7.14643ZM19.5169 5.21806C19.2635 5.01244 18.985 4.91807 18.7915 4.87185C18.5917 4.82412 18.4018 4.80876 18.2578 4.8113C17.7814 4.81969 17.2697 4.95518 16.4121 5.26637C15.5373 5.58382 14.193 6.12763 12.0058 7.03736C10.4638 7.67874 7.39388 9.00115 2.80365 11.001C2.40046 11.1622 2.03086 11.3451 1.73884 11.5619C1.46919 11.7622 1.09173 12.1205 1.02268 12.6714C0.970519 13.0874 1.09182 13.4714 1.33782 13.7738C1.55198 14.037 1.82635 14.1969 2.03529 14.2981C2.34545 14.4483 2.76276 14.5791 3.12952 14.6941C3.70264 14.8737 4.27444 15.0572 4.84879 15.233C6.62691 15.7773 8.09066 16.2253 9.7012 17.2866C10.8825 18.0651 12.041 18.8775 13.2243 19.6531C13.6559 19.936 14.0593 20.2607 14.5049 20.5224C14.9916 20.8084 15.6104 21.0692 16.3636 20.9998C17.5019 20.8951 18.0941 19.8479 18.3331 18.5703C18.8552 15.7796 19.8909 9.68351 20.1332 7.13774C20.1648 6.80544 20.1278 6.433 20.097 6.25318C20.0653 6.068 19.9684 5.58448 19.5169 5.21806Z"></path></svg>
</a>
<?php endif; ?>
<?php if($this->options->twitterurl): ?>
<a class="link-item" href="<?php $this->options->twitterurl() ?>" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="32" height="32" fill="currentColor"><path d="M8 2H1L9.26086 13.0145L1.44995 21.9999H4.09998L10.4883 14.651L16 22H23L14.3917 10.5223L21.8001 2H19.1501L13.1643 8.88578L8 2ZM17 20L5 4H7L19 20H17Z"></path></svg>
</a>
<?php endif; ?>
<?php if($this->options->instagramurl): ?>
<a class="link-item" href="<?php $this->options->instagramurl() ?>" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="32" height="32" fill="currentColor"><path d="M12.001 9C10.3436 9 9.00098 10.3431 9.00098 12C9.00098 13.6573 10.3441 15 12.001 15C13.6583 15 15.001 13.6569 15.001 12C15.001 10.3427 13.6579 9 12.001 9ZM12.001 7C14.7614 7 17.001 9.2371 17.001 12C17.001 14.7605 14.7639 17 12.001 17C9.24051 17 7.00098 14.7629 7.00098 12C7.00098 9.23953 9.23808 7 12.001 7ZM18.501 6.74915C18.501 7.43926 17.9402 7.99917 17.251 7.99917C16.5609 7.99917 16.001 7.4384 16.001 6.74915C16.001 6.0599 16.5617 5.5 17.251 5.5C17.9393 5.49913 18.501 6.0599 18.501 6.74915ZM12.001 4C9.5265 4 9.12318 4.00655 7.97227 4.0578C7.18815 4.09461 6.66253 4.20007 6.17416 4.38967C5.74016 4.55799 5.42709 4.75898 5.09352 5.09255C4.75867 5.4274 4.55804 5.73963 4.3904 6.17383C4.20036 6.66332 4.09493 7.18811 4.05878 7.97115C4.00703 9.0752 4.00098 9.46105 4.00098 12C4.00098 14.4745 4.00753 14.8778 4.05877 16.0286C4.0956 16.8124 4.2012 17.3388 4.39034 17.826C4.5591 18.2606 4.7605 18.5744 5.09246 18.9064C5.42863 19.2421 5.74179 19.4434 6.17187 19.6094C6.66619 19.8005 7.19148 19.9061 7.97212 19.9422C9.07618 19.9939 9.46203 20 12.001 20C14.4755 20 14.8788 19.9934 16.0296 19.9422C16.8117 19.9055 17.3385 19.7996 17.827 19.6106C18.2604 19.4423 18.5752 19.2402 18.9074 18.9085C19.2436 18.5718 19.4445 18.2594 19.6107 17.8283C19.8013 17.3358 19.9071 16.8098 19.9432 16.0289C19.9949 14.9248 20.001 14.5389 20.001 12C20.001 9.52552 19.9944 9.12221 19.9432 7.97137C19.9064 7.18906 19.8005 6.66149 19.6113 6.17318C19.4434 5.74038 19.2417 5.42635 18.9084 5.09255C18.573 4.75715 18.2616 4.55693 17.8271 4.38942C17.338 4.19954 16.8124 4.09396 16.0298 4.05781C14.9258 4.00605 14.5399 4 12.001 4ZM12.001 2C14.7176 2 15.0568 2.01 16.1235 2.06C17.1876 2.10917 17.9135 2.2775 18.551 2.525C19.2101 2.77917 19.7668 3.1225 20.3226 3.67833C20.8776 4.23417 21.221 4.7925 21.476 5.45C21.7226 6.08667 21.891 6.81333 21.941 7.8775C21.9885 8.94417 22.001 9.28333 22.001 12C22.001 14.7167 21.991 15.0558 21.941 16.1225C21.8918 17.1867 21.7226 17.9125 21.476 18.55C21.2218 19.2092 20.8776 19.7658 20.3226 20.3217C19.7668 20.8767 19.2076 21.22 18.551 21.475C17.9135 21.7217 17.1876 21.89 16.1235 21.94C15.0568 21.9875 14.7176 22 12.001 22C9.28431 22 8.94514 21.99 7.87848 21.94C6.81431 21.8908 6.08931 21.7217 5.45098 21.475C4.79264 21.2208 4.23514 20.8767 3.67931 20.3217C3.12348 19.7658 2.78098 19.2067 2.52598 18.55C2.27848 17.9125 2.11098 17.1867 2.06098 16.1225C2.01348 15.0558 2.00098 14.7167 2.00098 12C2.00098 9.28333 2.01098 8.94417 2.06098 7.8775C2.11014 6.8125 2.27848 6.0875 2.52598 5.45C2.78014 4.79167 3.12348 4.23417 3.67931 3.67833C4.23514 3.1225 4.79348 2.78 5.45098 2.525C6.08848 2.2775 6.81348 2.11 7.87848 2.06C8.94514 2.0125 9.28431 2 12.001 2Z"></path></svg>
</a>
<?php endif; ?>
<?php if($this->options->githuburl): ?>
<a class="link-item" href="<?php $this->options->githuburl() ?>" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="32" height="32" fill="currentColor"><path d="M5.88401 18.6533C5.58404 18.4526 5.32587 18.1975 5.0239 17.8369C4.91473 17.7065 4.47283 17.1524 4.55811 17.2583C4.09533 16.6833 3.80296 16.417 3.50156 16.3089C2.9817 16.1225 2.7114 15.5499 2.89784 15.0301C3.08428 14.5102 3.65685 14.2399 4.17672 14.4263C4.92936 14.6963 5.43847 15.1611 6.12425 16.0143C6.03025 15.8974 6.46364 16.441 6.55731 16.5529C6.74784 16.7804 6.88732 16.9182 6.99629 16.9911C7.20118 17.1283 7.58451 17.1874 8.14709 17.1311C8.17065 16.7489 8.24136 16.3783 8.34919 16.0358C5.38097 15.3104 3.70116 13.3952 3.70116 9.63971C3.70116 8.40085 4.0704 7.28393 4.75917 6.3478C4.5415 5.45392 4.57433 4.37284 5.06092 3.15636C5.1725 2.87739 5.40361 2.66338 5.69031 2.57352C5.77242 2.54973 5.81791 2.53915 5.89878 2.52673C6.70167 2.40343 7.83573 2.69705 9.31449 3.62336C10.181 3.41879 11.0885 3.315 12.0012 3.315C12.9129 3.315 13.8196 3.4186 14.6854 3.62277C16.1619 2.69 17.2986 2.39649 18.1072 2.52651C18.1919 2.54013 18.2645 2.55783 18.3249 2.57766C18.6059 2.66991 18.8316 2.88179 18.9414 3.15636C19.4279 4.37256 19.4608 5.45344 19.2433 6.3472C19.9342 7.28337 20.3012 8.39208 20.3012 9.63971C20.3012 13.3968 18.627 15.3048 15.6588 16.032C15.7837 16.447 15.8496 16.9105 15.8496 17.4121C15.8496 18.0765 15.8471 18.711 15.8424 19.4225C15.8412 19.6127 15.8397 19.8159 15.8375 20.1281C16.2129 20.2109 16.5229 20.5077 16.6031 20.9089C16.7114 21.4504 16.3602 21.9773 15.8186 22.0856C14.6794 22.3134 13.8353 21.5538 13.8353 20.5611C13.8353 20.4708 13.836 20.3417 13.8375 20.1145C13.8398 19.8015 13.8412 19.599 13.8425 19.4094C13.8471 18.7019 13.8496 18.0716 13.8496 17.4121C13.8496 16.7148 13.6664 16.2602 13.4237 16.051C12.7627 15.4812 13.0977 14.3973 13.965 14.2999C16.9314 13.9666 18.3012 12.8177 18.3012 9.63971C18.3012 8.68508 17.9893 7.89571 17.3881 7.23559C17.1301 6.95233 17.0567 6.54659 17.199 6.19087C17.3647 5.77663 17.4354 5.23384 17.2941 4.57702L17.2847 4.57968C16.7928 4.71886 16.1744 5.0198 15.4261 5.5285C15.182 5.69438 14.8772 5.74401 14.5932 5.66413C13.7729 5.43343 12.8913 5.315 12.0012 5.315C11.111 5.315 10.2294 5.43343 9.40916 5.66413C9.12662 5.74359 8.82344 5.69492 8.57997 5.53101C7.8274 5.02439 7.2056 4.72379 6.71079 4.58376C6.56735 5.23696 6.63814 5.77782 6.80336 6.19087C6.94565 6.54659 6.87219 6.95233 6.61423 7.23559C6.01715 7.8912 5.70116 8.69376 5.70116 9.63971C5.70116 12.8116 7.07225 13.9683 10.023 14.2999C10.8883 14.3971 11.2246 15.4769 10.5675 16.0482C10.3751 16.2156 10.1384 16.7802 10.1384 17.4121V20.5611C10.1384 21.5474 9.30356 22.2869 8.17878 22.09C7.63476 21.9948 7.27093 21.4766 7.36613 20.9326C7.43827 20.5204 7.75331 20.2116 8.13841 20.1276V19.1381C7.22829 19.1994 6.47656 19.0498 5.88401 18.6533Z"></path></svg>
</a>
<?php endif; ?>
<?php if($this->options->mastodonurl): ?>
<a class="link-item" href="<?php $this->options->mastodonurl() ?>" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="32" height="32" fill="currentColor"><path d="M3.019 12.0075C2.98744 10.7478 3.00692 9.5598 3.00692 8.56644C3.00692 4.22767 5.84954 2.95597 5.84954 2.95597C7.28286 2.29767 9.74238 2.0209 12.2993 2H12.3621C14.919 2.0209 17.3801 2.29767 18.8134 2.95597C18.8134 2.95597 21.656 4.22767 21.656 8.56644C21.656 8.56644 21.6916 11.7674 21.2596 13.9898C20.9852 15.4007 18.8034 16.9446 16.2974 17.2438C14.9906 17.3999 13.7042 17.5431 12.3322 17.4802C10.0885 17.3775 8.31815 16.9446 8.31815 16.9446C8.31815 17.1631 8.33166 17.3711 8.35853 17.5655C8.44182 18.1978 8.65659 18.6604 8.96296 19C9.72944 19.8497 11.0692 19.9301 12.3577 19.9743C14.178 20.0366 15.7986 19.5254 15.7986 19.5254L15.8735 21.1712C15.8735 21.1712 14.6003 21.8548 12.3322 21.9805C11.0815 22.0493 9.52858 21.9491 7.71969 21.4704C6.18802 21.065 5.15153 20.1804 4.45091 19C3.35714 17.1573 3.08191 14.5938 3.019 12.0075ZM6.31815 16.9446V14.3967L8.79316 15.0018C8.8405 15.0134 8.95098 15.0383 9.11692 15.0723C9.40521 15.1313 9.73416 15.1908 10.0959 15.2467C10.8485 15.3628 11.6341 15.4462 12.4237 15.4823C13.4425 15.529 14.3249 15.4652 16.0603 15.2579C17.7233 15.0594 19.208 14.0622 19.2963 13.6082C19.3783 13.1861 19.4472 12.6858 19.5021 12.1261C19.5714 11.4205 19.6155 10.6558 19.6388 9.88068C19.654 9.37026 19.6582 8.93648 19.6564 8.62452L19.656 8.56644C19.656 7.1368 19.2873 6.12756 18.6928 5.40793C18.5008 5.17553 18.3004 4.99408 18.1087 4.85958C18.0183 4.79617 17.9737 4.77136 17.9787 4.77345C16.9662 4.30844 14.8859 4.02069 12.3621 3.99993H12.3156C9.77596 4.02069 7.6969 4.30836 6.66627 4.78161C6.68919 4.77136 6.64459 4.79617 6.55423 4.85958C6.36257 4.99408 6.16214 5.17553 5.97016 5.40793C5.37568 6.12756 5.00692 7.1368 5.00692 8.56644C5.00692 8.7976 5.00628 8.96339 5.00392 9.44137C4.9981 10.6238 5.00004 11.2256 5.01841 11.9589C5.07185 14.156 5.2822 15.7941 5.71797 17C5.93023 17.5874 6.19005 18.0709 6.49741 18.4507C6.37791 18.0162 6.31815 17.5142 6.31815 16.9446ZM8.08576 6.37135C8.71735 6.37135 9.22924 6.88324 9.22924 7.51482C9.22924 8.14626 8.71735 8.6583 8.08576 8.6583C7.45432 8.6583 6.94229 8.14626 6.94229 7.51482C6.94229 6.88324 7.45432 6.37135 8.08576 6.37135Z"></path></svg>
</a>
<?php endif; ?>

60
part/toc.php Normal file
View File

@ -0,0 +1,60 @@
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<div class="post-toc">
<div class="tocbot-list">
</div>
<div class="tocbot-list-menu">
<a class="tocbot-toc-expand" onclick="expand_toc()">展开目录</a>
<a onclick="go_top()">文章顶部</a>
<a onclick="go_bottom()">文章底部</a>
</div>
</div>
<script>
var tocbot_timer;
var DEPTH_MAX = 6; // 为 6 时展开所有
var tocbot_default_config = {
tocSelector: '.tocbot-list',
contentSelector: '.post-content',
headingSelector: 'h1, h2, h3, h4, h5',
orderedList: false,
scrollSmooth: true,
onClick: extend_click,
};
function extend_click() {
clearTimeout(tocbot_timer);
tocbot_timer = setTimeout(function() {
tocbot.refresh(obj_merge(tocbot_default_config, {
hasInnerContainers: true
}));
}, 420); // 这个值是由 tocbot 源码里定义的 scrollSmoothDuration 得来的
}
document.ready(function() {
tocbot.init(obj_merge(tocbot_default_config, {
collapseDepth: 1
}));
});
function expand_toc() {
var b = document.querySelector('.tocbot-toc-expand');
var expanded = b.getAttribute('data-expanded');
expanded ? b.removeAttribute('data-expanded') : b.setAttribute('data-expanded', true);
tocbot.refresh(obj_merge(tocbot_default_config, {
collapseDepth: expanded ? 1 : DEPTH_MAX
}));
b.innerText = expanded ? 'Expand all' : 'Collapse all';
}
function go_top() {
window.scrollTo(0, 0);
}
function go_bottom() {
window.scrollTo(0, document.body.scrollHeight);
}
function obj_merge(target, source) {
for (var item in source) {
if (source.hasOwnProperty(item)) {
target[item] = source[item];
}
}
return target;
}
</script>

80
post.php Normal file
View File

@ -0,0 +1,80 @@
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $this->need('part/head.php'); ?>
<div class="wrapper">
<?php $this->need('part/header.php'); ?>
<div class="main">
<div class="container">
<article class="post-wrap">
<header class="post-header">
<h1 class="post-title"><?php $this->title() ?></h1>
<div class="post-meta">
<span class="post-time">
发布日期:
</span> <?php $this->date('Y-m-d'); ?><span class="dot"></span>
<span class="post-category">
分类:
</span><?php $this->category(','); ?> <span class="dot"></span>
<span> 浏览:</span><?php get_post_view($this) ?>次<span class="dot"></span>
<span>评论:</span><a href="<?php $this->permalink() ?>#comments">
<?php $this->commentsNum('0', '1', '%d '); ?></a>
<?php if($this->user->hasLogin() && $this->user->pass('editor', true)): ?>
<span><span class="dot"></span>
<a href="<?php $this->options->adminUrl('write-post.php?cid=' . $this->cid); ?>" target="_blank" title="编辑文章">
<svg class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="16" height="16">
<path
d="M362.7 19.3L314.3 67.7 444.3 197.7l48.4-48.4c25-25 25-65.5 0-90.5L453.3 19.3c-25-25-65.5-25-90.5 0zm-71 71L58.6 323.5c-10.4 10.4-18 23.3-22.2 37.4L1 481.2C-1.5 489.7 .8 498.8 7 505s15.3 8.5 23.7 6.1l120.3-35.4c14.1-4.2 27-11.8 37.4-22.2L421.7 220.3 291.7 90.3z"/>
</svg></a></span>
<?php endif; ?>
</div>
</header>
<div class="post-content">
<?php $this->content(); ?>
</div>
<section class="post-copyright">
<p class="copyright-item">
<span>作者:</span>
<span><a href="<?php $this->author->permalink(); ?>"><?php $this->author(); ?></a></span>
</p>
<p class="copyright-item">
<span>链接:</span>
<span><a href="<?php $this->permalink() ?>"><?php $this->permalink() ?></a></span>
</p>
</section>
<section class="post-tags">
<div>
<span class="tag">
<?php if ($this->tags): ?>
<?php foreach ($this->tags as $tag): ?>
<a href="<?php echo $tag['permalink']; ?>">#<?php echo $tag['name']; ?></a>
<?php endforeach; ?>
<?php else: ?>
无标签
<?php endif; ?>
</span>
</div>
<div>
<a href="javascript:window.history.back();">返回上一页</a>
<span>· </span>
<a href="/">返回首页</a>
</div>
</section>
<section class="post-nav">
<a class="prev" rel="prev"><?php $this->thePrev('%s', '没有了'); ?></a>
<a class="next" rel="next"><?php $this->theNext('%s', '没有了'); ?></a>
</section>
<!-- 判断如果允许评论则显示评论的div -->
<?php if ($this->allow('comment')): ?>
<!-- 如果启用了 twikoo 选项,显示 twikoo 评论系统 -->
<?php if ($this->options->twikoo): ?>
<?php $this->options->twikoo(); ?>
<?php else: ?>
<!-- 否则调用自带的评论模板 -->
<?php $this->need('comments.php'); ?>
<?php endif; ?>
<?php endif; ?>
</article>
</div>
</div>
<?php $this->need('part/toc.php'); ?>
<?php $this->need('part/footer.php'); ?>