summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author阔落 <45323514+BigCoke233@users.noreply.github.com>2019-04-06 16:48:17 +0800
committerGitHub <noreply@github.com>2019-04-06 16:48:17 +0800
commitbf183e944f0cbb924b73c84d2c8cdb7b59d35eb1 (patch)
treef6530294df83ec1991b92c5c8dfa64b224b34e34
parent43156f86f3e167f066e1a655baee71eaebbdad4b (diff)
修复无法评论问题,现在具有data-pjax特性的元素才能使pjax响应
-rw-r--r--file.php2
-rw-r--r--functions.php3
-rw-r--r--includes/footer.php4
-rw-r--r--includes/head.php7
-rw-r--r--includes/header.php4
-rw-r--r--includes/sidebar.php6
-rw-r--r--index.php2
-rw-r--r--post.php5
-rw-r--r--post/post-content.php3
-rw-r--r--post/post-item.php13
10 files changed, 34 insertions, 15 deletions
diff --git a/file.php b/file.php
index 4b387a2..9553d22 100644
--- a/file.php
+++ b/file.php
@@ -45,7 +45,7 @@
if ($year > $year_tmp || $mon > $mon_tmp) {
$output .= '</ul>';
}
- $output .= '<li><span>'. $year_tmp .' - '. $mon_tmp .' | </span><a href="'.$archives->permalink .'">'. $archives->title .'</a><br /></li>';
+ $output .= '<li><span>'. $year_tmp .' - '. $mon_tmp .' | </span><a href="'.$archives->permalink .'" data-pjax>'. $archives->title .'</a><br /></li>';
}
$output .= '</ul>';
echo $output;
diff --git a/functions.php b/functions.php
index 902d8af..191ba5d 100644
--- a/functions.php
+++ b/functions.php
@@ -7,6 +7,9 @@ function themeFields($layout) {
$banner = new Typecho_Widget_Helper_Form_Element_Text('banner', NULL, NULL, _t('文章缩略图'), _t('填入一个图片url作为缩略图,显示在文章列表和文章页面顶部,不填写则没有缩略图'));
$layout->addItem($banner);
+ $topic = new Typecho_Widget_Helper_Form_Element_Text('topic', NULL, NULL, _t('题记'), _t('输入一段话,作为题记显示在文章列表(仅普通文章有效) 和 文章内页'));
+ $layout->addItem($topic);
+
$type=new Typecho_Widget_Helper_Form_Element_Select('type',array('0'=>'一般文章','1'=>'说说','2'=>'小板式文章(New)'),'0','文章类型');
$layout->addItem($type);
}
diff --git a/includes/footer.php b/includes/footer.php
index eedc7a0..74c3c29 100644
--- a/includes/footer.php
+++ b/includes/footer.php
@@ -8,7 +8,7 @@
<div class="newest-comment">
<?php $this->widget('Widget_Comments_Recent','ignoreAuthor=true')->to($comments); ?>
<?php while($comments->next()): ?>
- <a href="<?php $comments->permalink(); ?>"><?php $comments->gravatar(200); ?></a>
+ <a href="<?php $comments->permalink(); ?>" data-pjax><?php $comments->gravatar(200); ?></a>
<?php endwhile; ?>
</div>
</div>
@@ -44,7 +44,7 @@
<script>
//pjax load
$(document).pjax(
- 'body a',
+ '[data-pjax]',
'#pjax-container',
{
timeout:8000,
diff --git a/includes/head.php b/includes/head.php
index c99961e..796f34c 100644
--- a/includes/head.php
+++ b/includes/head.php
@@ -65,8 +65,13 @@
#nav{
padding:0!important;
}
+ .nav-content{
+ display:block;
+ text-align:Center;
+ margin:0 auto!important;
+ }
.nav-content,.nav-content ul>li{
- float:left!important
+ float:left;
}
.nav-content{
font-size:12px;
diff --git a/includes/header.php b/includes/header.php
index 03837f3..f8fdedc 100644
--- a/includes/header.php
+++ b/includes/header.php
@@ -18,8 +18,8 @@
<?php $this->options->custom_nav() ?>
<?php else: ?>
<?php $this->widget('Widget_Contents_Page_List')
- ->parse('<li><a href="{permalink}"><i class="fa fa-paper-plane" aria-hidden="true"></i> {title}</a></li>'); ?>
- <li><a href="<?php $this->options->SiteUrl(); ?>"><i class="fa fa-home" aria-hidden="true"></i> 首页</a></li>
+ ->parse('<li><a href="{permalink}" data-pjax><i class="fa fa-paper-plane" aria-hidden="true"></i> {title}</a></li>'); ?>
+ <li><a data-pjax href="<?php $this->options->SiteUrl(); ?>"><i class="fa fa-home" aria-hidden="true"></i> 首页</a></li>
<?php endif; ?>
</ul>
</div>
diff --git a/includes/sidebar.php b/includes/sidebar.php
index 0c07b6f..c9dfa2f 100644
--- a/includes/sidebar.php
+++ b/includes/sidebar.php
@@ -28,7 +28,7 @@
<div class="input-group">
<input type="text" name="s" class="form-control" placeholder="搜点什么吧~">
<span class="input-group-btn">
- <button class="btn btn-default sumbit" type="sumbit"><i class="fa fa-search"></i></button>
+ <button class="btn btn-default sumbit" type="sumbit" data-pjax><i class="fa fa-search"></i></button>
</span>
</div>
</form>
@@ -67,7 +67,7 @@
<hr />
<ul class="sidebar-category list-group">
<?php $this->widget('Widget_Metas_Category_List')
- ->parse('<li class="list-group-item"><a href="{permalink}">{name}</a><span class="badge">{count}</span></li>'); ?>
+ ->parse('<li class="list-group-item"><a href="{permalink}" data-pjax>{name}</a><span class="badge">{count}</span></li>'); ?>
</ul>
</div>
@@ -89,7 +89,7 @@
<?php $this->widget('Widget_Metas_Tag_Cloud', 'sort=mid&ignoreZeroCount=1&desc=0&limit=30')->to($tags); ?>
<?php if($tags->have()): ?>
<?php while ($tags->next()): ?>
- <a href="<?php $tags->permalink(); ?>" title="该标签下有 <?php $tags->count(); ?> 篇文章"><?php $tags->name(); ?></a>
+ <a href="<?php $tags->permalink(); ?>" title="该标签下有 <?php $tags->count(); ?> 篇文章" data-pjax><?php $tags->name(); ?></a>
<?php endwhile; ?>
<?php else: ?>
还没有任何标签哦~
diff --git a/index.php b/index.php
index ca9d273..3bf0719 100644
--- a/index.php
+++ b/index.php
@@ -4,7 +4,7 @@
*
* @package Mark
* @author BigCoke
- * @version 2.0.0
+ * @version 2.1.7
* @link http://cokewithice.com
*/
$this->need('includes/head.php');
diff --git a/post.php b/post.php
index e641114..758df30 100644
--- a/post.php
+++ b/post.php
@@ -29,6 +29,11 @@
</div>
<hr />
+ <?php if($this->fields->topic && $this->fields->topic!='') :?>
+ <div class="inpost-topic">
+ <p>“ <Span class="post-topic-content"><?php $this->fields->topic(); ?></span> ”</p>
+ </div>
+ <?php endif; ?>
<div class="post-content">
<?php $this->need('post/post-content.php'); ?>
diff --git a/post/post-content.php b/post/post-content.php
index a1fdd24..56d160d 100644
--- a/post/post-content.php
+++ b/post/post-content.php
@@ -1,7 +1,8 @@
<?php
$content = $this->content;
- $content = preg_replace('/<table(.*?)>/s','<table class="table table-striped table-hover">',$content);
+ $content = preg_replace('/<a(.*?)>/s','<a ${1} data-pjax>',$content);
+ $content = preg_replace('/<table(.*?)>/s','<table class="table table-striped table-hover table-bordered">',$content);
$content = preg_replace('/<pre><code>/s','<pre><code class="language-html">',$content);
$content = preg_replace('/<img(.*?)src="(.*?)"(.*?)alt="(.*?)"(.*?)>/s','<a data-fancybox="gallery" href="${2}" class="gallery-link"><img${1}src="${2}"${3}></a><span class="post-img-alt">${4}</span>',$content);
diff --git a/post/post-item.php b/post/post-item.php
index 5452f45..262632f 100644
--- a/post/post-item.php
+++ b/post/post-item.php
@@ -12,10 +12,10 @@
<?php $this->author->gravatar(50) ?>
</div>
<div class="col-md-11 col-xs-10">
- <h4 class="saying-title"><a href="<?php $this->permalink() ?>"><?php $this->title(); ?></a></h4>
+ <h4 class="saying-title"><a href="<?php $this->permalink() ?>" data-pjax><?php $this->title(); ?></a></h4>
<div class="saying-info"><?php $this->date('F j, Y'); ?></div>
- <a href="<?php $this->permalink() ?>" class="read-more pull-right btn btn-default">前往吐槽</a>
+ <a href="<?php $this->permalink() ?>" class="read-more pull-right btn btn-default" data-pjax>前往吐槽</a>
</div>
</div>
</div>
@@ -24,7 +24,7 @@
<?php endif; ?>
<!-- 小板式文章 -->
<?php elseif($this->fields->type=='2'): ?>
- <a href="<?php $this->permalink() ?>" class="post-link">
+ <a href="<?php $this->permalink() ?>" class="post-link" data-pjax>
<div class="item post-item">
<div class="row">
<div style="height:160px;background:url('<?php $this->fields->banner(); ?>');background-repeat:no-repeat;background-size:cover" class="col-md-3 col-xs-5 post-banner-sm"></div>
@@ -45,7 +45,7 @@
<br />
<?php else: ?>
<!-- 普通文章 -->
- <a href="<?php $this->permalink() ?>" class="post-link">
+ <a href="<?php $this->permalink() ?>" class="post-link" data-pjax>
<div class="item post-item">
<?php if ($this->is('index')): ?>
<div class="post-banner">
@@ -58,6 +58,11 @@
<h2 class="index-post-header"><?php $this->sticky(); $this->title() ?></h4>
<p class="excerpt">
+ <?php if($this->fields->topic && $this->fields->topic!='') :?>
+ <blockquote class="post-topic">
+ <p><?php $this->fields->topic(); ?></p>
+ </blockquote>
+ <?php endif; ?>
<?php $this->need('post/post-excerpt.php'); ?>
<?php echo $this->excerpt(100); ?>
</p>