-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 增加独立“搜索模板” - 菜单及部分代码调整 - CSS 样式移至 style.css 文件 - 优化多处负空间距离 - 优化评论框样式
- Loading branch information
Showing
6 changed files
with
156 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
/** | ||
* 搜索模板 | ||
* | ||
* @package custom | ||
*/ | ||
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?> | ||
<?php $this->need('header.php'); ?> | ||
<h1 class="title">搜索<?php if ( $this->is('search') ) : ?>关键词:<?php echo $this->archiveTitle('','“','”'); ?><?php endif; ?></h1> | ||
<form id="search" method="post" action="<?php $this->options->siteUrl(); ?>" role="search"> | ||
<input type="text" id="s" name="s" class="text" value="<?php if ( $this->is('search') ) : ?><?php echo $this->archiveTitle('','',''); ?><?php endif; ?>" placeholder="<?php _e('输入关键字搜索'); ?>"/> | ||
<button type="submit" class="submit"><?php _e('搜索'); ?></button> | ||
</form> | ||
<article> | ||
<?php if ( $this->is('search') && $this->have()) : ?> | ||
<div class="intro">为你找到以下相关结果</div> | ||
<ul class="results"> | ||
<?php while ($this->next()): ?> | ||
<li> | ||
[ <?php $this->category(','); ?> ] <a href="<?php $this->permalink(); ?>" title="<?php $this->title() ?>"><?php $this->title() ?></a><br /> | ||
<small><time datetime="<?php $this->date(); ?>"><?php $this->date(); ?></time></small></li> | ||
<?php endwhile; ?> | ||
</ul> | ||
<?php elseif ( $this->is('search') && !$this->have()) : ?> | ||
<div class="intro">抱歉,没有找到相关的结果,你可以在上方搜索栏中尝试其他关键词。</div> | ||
<?php endif; ?> | ||
</article> | ||
<?php if ( $this->is('search') && $this->is('archive')) { ?> | ||
<?php $this->pageNav('« 前一页', '后一页 »'); ?> | ||
<?php }; ?> | ||
<?php $this->need('footer.php'); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
:root { | ||
--width: 720px; | ||
--font-yahei: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Ubuntu,"Helvetica Neue",Helvetica,Arial,"PingFangSC-Regular","Hiragino Sans GB","Lantinghei SC","Microsoft Yahei","Source Han Sans CN","WenQuanYi Micro Hei",SimSun,sans-serif; | ||
--font-fangsong: Baskerville, "Times New Roman", "Liberation Serif", STFangsong, FangSong, FangSong_GB2312, "CWTEX\-F", serif; | ||
--font-songti: Georgia, "Nimbus Roman No9 L", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif CN", STSong, "AR PL New Sung", "AR PL SungtiL GB", NSimSun, SimSun, "TW\-Sung", "WenQuanYi Bitmap Song", "AR PL UMing CN", "AR PL UMing HK", "AR PL UMing TW", "AR PL UMing TW MBE", PMingLiU, MingLiU, serif; | ||
--font-scale: 1em; | ||
--background-color: #F2F0E5; | ||
--main-color:#fff; | ||
--heading-color: #222; | ||
--nav-color:#666; | ||
--text-color: #444; | ||
--link-color: #444; | ||
--code-background-color: #f2f2f2; | ||
--code-color: #222; | ||
--blockquote-color: #222; | ||
--gray-color: #999; | ||
--shadow-color:#ebe4c6; | ||
} | ||
@media (prefers-color-scheme: dark) { | ||
:root { | ||
--background-color: #0b0c1b; | ||
--main-color: #0e1028; | ||
--heading-color: #c2cef0; | ||
--nav-color: #585c90; | ||
--text-color: #a6b4d2; | ||
--link-color: #7b88c8; | ||
--code-background-color: #000; | ||
--code-color: #ddd; | ||
--blockquote-color: #ccc; | ||
--gray-color: #4f5287; | ||
--shadow-color: #000; | ||
} | ||
} | ||
body { | ||
font-family: var(--font-yahei); /* 可替换 --font-fangsong 或 --font-songti 字体 */ | ||
font-size: var(--font-scale); | ||
margin: auto; | ||
padding: 20px; | ||
max-width: var(--width); | ||
text-align: left; | ||
background-color: var(--background-color); | ||
word-wrap: break-word; | ||
overflow-wrap: break-word; | ||
line-height: 1.8; | ||
color: var(--text-color); | ||
} | ||
html{scroll-behavior:smooth;} | ||
h1,h2,h3,h4,h5,h6{color:var(--heading-color);} | ||
a{color:var(--link-color);cursor:pointer;text-decoration:none} | ||
a:hover{opacity:0.5;} | ||
nav a{margin-right:10px} | ||
strong,b{color:var(--heading-color)} | ||
button{margin:0;cursor:pointer} | ||
time,.comment-meta a{color:var(--gray-color);} | ||
main{padding:10% 7% 7%; background-color:var(--main-color);box-shadow: 0px 10px 20px 0px var(--shadow-color);} | ||
table{width:100%} | ||
hr{border:0;border-top:1px dashed} | ||
img{max-width:100%;height:auto} | ||
code{font-family:monospace;padding:2px;background-color:var(--code-background-color);color:var(--code-color);border-radius:3px} | ||
blockquote{border-left:1px solid var(--gray-color);color:var(--code-color);padding-left:20px;font-style:italic} | ||
header,footer{padding:20px 0;margin: 10px 0;color:var(--gray-color);} | ||
header a,footer a{color:var(--nav-color)} | ||
article.list{margin-bottom: 50px;padding-bottom:50px;border-bottom:1px dashed var(--gray-color);} | ||
h1.title,h2.title {margin:0;line-height:1.6;} | ||
.intro{color:var(--gray-color);margin-bottom:80px;} | ||
.single .content{margin-top: 50px;} | ||
.content a,.comment-reply a,.page-navigator .current{border-bottom:1px solid var(--link-color);} | ||
.content a:has(img){border:none} | ||
.tags{margin-top: 50px;} | ||
.tags,.tags a{color:var(--gray-color);margin-right: 15px;} | ||
.page-navigator{list-style: none;padding:0;} | ||
.page-navigator li{display: inline-block;padding:0 6px;margin-right: 10px;} | ||
#comments{margin-top:40px;padding-top:40px;border-top:1px dashed var(--gray-color);} | ||
.comment-list{list-style: none;padding:0;margin-bottom:40px;} | ||
.comment-children{margin:30px 0 0 50px} | ||
.comment-author cite{font-weight:bold;font-style:normal;} | ||
.comment-author .says,.comment-author .avatar{display:none} | ||
input,textarea{border-radius:4px;border:1px solid var(--gray-color);display:block;font-size:0.9em;margin:0 0 10px;padding:10px;width:100%;max-width:calc(100% - 25px);} | ||
button[type="submit"]{border:none;font-size:0.9em;border-radius:4px;padding:10px 16px;background:#ccc;} | ||
button[type="submit"]:hover{cursor:pointer;opacity:.7;} | ||
#search input{margin:20px 5px 10px 0;width: initial;display:inline-block;} | ||
.results{list-style:none;padding:0;margin-bottom:40px;padding-bottom:40px;border-bottom:1px dashed var(--gray-color);} | ||
.results li{margin:20px 0 0;} |