summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJui-Ch'i Lau <21096362+KurococLiu@users.noreply.github.com>2023-03-18 11:32:25 +0800
committerGitHub <noreply@github.com>2023-03-18 11:32:25 +0800
commit6be33d93e3c66364a808372c2d4d34cd745d1beb (patch)
tree7d19c513dba3168a6b59a754fd614306387104db
parentce75d531299ea0f2a500d61586d2837bda0b31b5 (diff)
parenta9c3180ecdf84add5d6084a19c9c79eedc14af9b (diff)
Merge branch 'BigCoke233:main' into main
-rw-r--r--assets/matcha/matcha.comment.js9
-rw-r--r--assets/matcha/matcha.post.css24
-rw-r--r--includes/comments.php2
-rw-r--r--includes/header.php2
-rw-r--r--includes/sidebar.php6
-rw-r--r--libs/Matcha.php25
-rw-r--r--libs/Options.php12
7 files changed, 58 insertions, 22 deletions
diff --git a/assets/matcha/matcha.comment.js b/assets/matcha/matcha.comment.js
index b94c42b..50a911a 100644
--- a/assets/matcha/matcha.comment.js
+++ b/assets/matcha/matcha.comment.js
@@ -40,11 +40,18 @@ matchaComment.core = function() {
return false;
}
- if($('#comment-form [name="author"]').length && (!$('#comment-form [name="author"]').val().length>0 || !$('#comment-form [name="mail"]').val().length>0)) {
+ // 如果 mail 有 required 属性,则要求填写用户名和邮箱
+ if($('#comment-form [name="mail"]').attr('required') && (!$('#comment-form [name="author"]').val().length>0 || !$('#comment-form [name="mail"]').val().length>0)) {
Toaster.error('用户名和邮箱不能为空');
return false;
}
+ // 如果 mail 没有 required 属性,则仅要求用户名不能为空
+ if(!$('#comment-form [name="mail"]').attr('required') && !$('#comment-form [name="author"]').val().length>0) {
+ Toaster.error('用户名不能为空');
+ return false;
+ }
+
//发送 POST 之前的操作
matchaComment.before();
//POST 基本信息
diff --git a/assets/matcha/matcha.post.css b/assets/matcha/matcha.post.css
index bd5aeeb..ba3e412 100644
--- a/assets/matcha/matcha.post.css
+++ b/assets/matcha/matcha.post.css
@@ -33,7 +33,6 @@
.post-title-atpage {
font-size: 1.7em;
margin-top: .9em;
- font-weight: 400;
position: relative;
font-weight: 700
}
@@ -112,6 +111,7 @@
.post-content,.comment-content {
line-height: 1.5;
word-wrap: break-word;
+ word-break: break-word;
}
.post-content h2,
@@ -180,27 +180,23 @@
padding-left: 1.2em!important
}
-.post-content ul li,
-.comment-content ul li {
+.post-content ul,
+.comment-content ul {
list-style-type: square
}
-.post-content ol li,
-.comment-content ol li {
+.post-content ol,
+.comment-content ol {
list-style-type: decimal
}
-.post-content ul>ul li,
-.post-content ol>ul li,
-.comment-content ul>ul li,
-.comment-content ol>ul li {
+.post-content li ul,
+.comment-content li ul {
list-style-type: disc
}
-.post-content ol>ol li,
-.post-content ul>ol li,
-.comment-content ol>ol li,
-.comment-content ul>ol li {
+.post-content li ol,
+.comment-content li ol {
list-style-type: lower-roman
}
@@ -689,4 +685,4 @@
font-size: .9em;
margin-right: .12em;
color: var(--gray-bg)
-} \ No newline at end of file
+}
diff --git a/includes/comments.php b/includes/comments.php
index 0790a9c..783f8c4 100644
--- a/includes/comments.php
+++ b/includes/comments.php
@@ -75,7 +75,7 @@ Comments::replyScript($this); ?>
<?php $this->author->gravatar(32); ?>
<div class="comments-profile-author">
<a class="comments-profile-name" href="<?php $this->options->profileUrl(); ?>"><?php $this->user->screenName(); ?></a><br>
- <a class="comments-logout" href="<?php $this->options->logoutUrl(); ?>" title="Logout"><?php _e('退出'); ?></a>
+ <a class="comments-logout" href="<?php $this->options->logoutUrl(); ?>" title="Logout" no-pjax><?php _e('退出'); ?></a>
</div>
</div>
<script>login=true;</script>
diff --git a/includes/header.php b/includes/header.php
index a74b47a..c1cf591 100644
--- a/includes/header.php
+++ b/includes/header.php
@@ -18,7 +18,7 @@ $this->need("includes/head.php"); ?>
<div class="navbar-dropdown">
<button class="navbar-button navbar-dropup" id="nav-rise"><span>+</span></button>
<h2>页面</h2>
- <ul class="widget-list"><?php Matcha::pageNav($this, "li"); ?></ul>
+ <ul class="widget-list"><li><a href="<?php $this->options->siteUrl(); ?>" rel="section">首页</a></li><?php Matcha::pageNav($this, "li"); ?></ul>
<h2>分类</h2>
<ul class="widget-list widget-category">
<?php $this->widget('Widget_Metas_Category_List')->to($categories); ?>
diff --git a/includes/sidebar.php b/includes/sidebar.php
index 32df2e7..77109e9 100644
--- a/includes/sidebar.php
+++ b/includes/sidebar.php
@@ -3,7 +3,11 @@
<aside id="sidebar" class="sidebar" role="complementary">
<section class="widget widget-nav sidebar-nav">
<header id="header" class="header"><?php Matcha::siteName(); ?></header>
- <ul class="widget-list"><?php Matcha::pageNav($this, "li"); ?></ul>
+ <ul class="widget-list">
+ <li><a href="<?php $this->options->siteUrl(); ?>" rel="section">首页</a></li>
+ <?php Matcha::categoryNav($this, "li"); ?>
+ <?php Matcha::pageNav($this, "li"); ?>
+ </ul>
</section>
<!-- 版权信息 -->
<section class="widget sidebar-foot">
diff --git a/libs/Matcha.php b/libs/Matcha.php
index 4783998..047150a 100644
--- a/libs/Matcha.php
+++ b/libs/Matcha.php
@@ -264,10 +264,6 @@ class Matcha
if(Helper::options()->customNav=='' || $data['type']=='addition'){
$archive->widget('Widget_Contents_Page_List')->to($pages);
- //首页链接
- echo '<'.$tag.'><a href="';
- Utils::indexHome();
- echo '">首页</a></'.$tag.'>';
//页面列表
while($pages->next()) {
echo '<'.$tag.'><a href="';
@@ -288,6 +284,27 @@ class Matcha
}
/**
+ * 统一输出分类导航
+ * html 结构
+ */
+ public static function categoryNav(Widget_Archive $archive, $tag)
+ {
+ // 如果开启了分类导航,则输出分类
+ if(Helper::options()->categoryNav=='able') {
+ $archive->widget('Widget_Metas_Category_List')->to($categories);
+ while($categories->next()) {
+ echo '<'.$tag.'><a href="';
+ $categories->permalink();
+ echo '" title="';
+ $categories->name();
+ echo '">';
+ $categories->name();
+ echo '</a></'.$tag.'>';
+ }
+ }
+ }
+
+ /**
* 统一输出站点标题及副标题
* html 结构
*/
diff --git a/libs/Options.php b/libs/Options.php
index 935a7be..bacfe6c 100644
--- a/libs/Options.php
+++ b/libs/Options.php
@@ -72,6 +72,18 @@ function themeConfig($form) {
$relatedLinks = new Typecho_Widget_Helper_Form_Element_Textarea('relatedLinks', NULL, NULL, _t('首页「相关链接」内容'), _t('
<p class="description">使用特定的 JSON 格式书写,可以在首页文章目录之前展示一个相关链接版块,详情请查看说明文档</p>'));
$form->addInput($relatedLinks);
+ // 分类导航
+ $categoryNav = new Typecho_Widget_Helper_Form_Element_Radio('categoryNav', array(
+ 'able' => _t('启用'),
+ 'disable' => _t('停用'),
+ ),
+ 'disable',
+ _t('是否启用侧边栏分类导航'),
+ _t('
+ 启用后,将在侧边栏首页和独立页面中间加入所有分类页面。
+ ')
+ );
+ $form->addInput($categoryNav->addRule('required', _t('此处必须设置')));
/**
* 附加功能