summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
author阔落 <45323514+BigCoke233@users.noreply.github.com>2019-03-30 15:30:52 +0800
committerGitHub <noreply@github.com>2019-03-30 15:30:52 +0800
commit9ae13dfa011baab12843b6855c2e9a4d6ca92075 (patch)
tree07399ca9dfed868bc74a4ace8bc14e11d31e364d /includes
parentd5ff633699d665803d400551dc66c14ec480bb5f (diff)
Add files via upload
Diffstat (limited to 'includes')
-rw-r--r--includes/comments.php63
-rw-r--r--includes/head.php5
-rw-r--r--includes/header.php11
-rw-r--r--includes/post-content.php47
-rw-r--r--includes/post-item.php56
-rw-r--r--includes/toolbar.php5
6 files changed, 163 insertions, 24 deletions
diff --git a/includes/comments.php b/includes/comments.php
index 3facb2a..ee6e771 100644
--- a/includes/comments.php
+++ b/includes/comments.php
@@ -1,4 +1,67 @@
<br />
+
+<!-- 重新获取respondId -->
+<script>
+(function () {
+ window.TypechoComment = {
+ dom : function (id) {
+ return document.getElementById(id);
+ },
+
+ create : function (tag, attr) {
+ var el = document.createElement(tag);
+
+ for (var key in attr) {
+ el.setAttribute(key, attr[key]);
+ }
+
+ return el;
+ },
+ reply : function (cid, coid) {
+ var comment = this.dom(cid), parent = comment.parentNode,
+ response = this.dom('" . $this->respondId . "'), input = this.dom('comment-parent'),
+ form = 'form' == response.tagName ? response : response.getElementsByTagName('form')[0],
+ textarea = response.getElementsByTagName('textarea')[0];
+ if (null == input) {
+ input = this.create('input', {
+ 'type' : 'hidden',
+ 'name' : 'parent',
+ 'id' : 'comment-parent'
+ });
+ form.appendChild(input);
+ }
+ input.setAttribute('value', coid);
+ if (null == this.dom('comment-form-place-holder')) {
+ var holder = this.create('div', {
+ 'id' : 'comment-form-place-holder'
+ });
+ response.parentNode.insertBefore(holder, response);
+ }
+ comment.appendChild(response);
+ this.dom('cancel-comment-reply-link').style.display = '';
+ if (null != textarea && 'text' == textarea.name) {
+ textarea.focus();
+ }
+ return false;
+ },
+ cancelReply : function () {
+ var response = this.dom('{$this->respondId}'),
+ holder = this.dom('comment-form-place-holder'), input = this.dom('comment-parent');
+ if (null != input) {
+ input.parentNode.removeChild(input);
+ }
+ if (null == holder) {
+ return true;
+ }
+ this.dom('cancel-comment-reply-link').style.display = 'none';
+ holder.parentNode.insertBefore(response, holder);
+ return false;
+ }
+ };
+})();
+</script>
+
+<!-- 评论开始 -->
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<div id="comments" class="responsesWrapper">
diff --git a/includes/head.php b/includes/head.php
index c0e4b9e..2d1e4ac 100644
--- a/includes/head.php
+++ b/includes/head.php
@@ -84,7 +84,7 @@
background-repeat:no-repeat;
background-attachment:fixed;
}
- .item,#nav,.list-group,.list-group li,.pagenav li,.page-navigator li,.comment-body{
+ .item,#nav,.pagenav li,.page-navigator li,.comment-body{
background:rgba(255,255,255,0.9)!important;
}
.footer-info{
@@ -94,6 +94,9 @@
box-shadow:0 0 8px #808080;
-webkit-box-shadow:0 0 8px #808080;
}
+ .list-group,.list-group li{
+ background:rgba(255,255,255,0)
+ }
<?php endif; ?>
</style>
diff --git a/includes/header.php b/includes/header.php
index f9a06d0..f5c530c 100644
--- a/includes/header.php
+++ b/includes/header.php
@@ -26,10 +26,21 @@
</div>
</nav>
+ <!-- 首页大图 -->
+ <?php if($this->options->lgimg_url && $this->options->lgimg_url!='') :?>
+ <div class="jumbotron" style="background:url('<?php $this->options->lgimg_url(); ?>');background-size:cover;background-repeat:no-repeat;">
+ <h1><?php $this->options->IndexName(); ?></h1>
+ <p><?php $this->options->IndexDecoration(); ?></p>
+ </div>
+ <?php endif; ?>
+
+ <?php if($this->options->lgimg_url && $this->options->lgimg_url='') :?>
<br />
<br />
<br />
<br />
+ <?php endif; ?>
<br />
+
<!-- 能偷懒不写样式为什么不用br? -->
</header> \ No newline at end of file
diff --git a/includes/post-content.php b/includes/post-content.php
new file mode 100644
index 0000000..c2f1a12
--- /dev/null
+++ b/includes/post-content.php
@@ -0,0 +1,47 @@
+<?php
+ //解析灯箱及图片描述
+ $content = preg_replace('/<img(.*?)src="(.*?)" alt="(.*?)" title="(.*?)"(.*?)>/s','<a data-fancybox="gallery" href="${2}"><img${1}src="${2}"${5}></a><span class="post-img-alt">${4}</span>',$this->content);
+
+ //短代码(无参数)
+ $reg = '/\[scode\](.*?)\[\/scode\]/s';
+ $rp = '<div class="tip">${1}</div>';
+ $content = preg_replace($reg,$rp,$content);
+
+ //短代码(有参数)
+ $reg = '/\[scode.*?type="(.*?)"\](.*?)\[\/scode\]/s';
+ $rp = '<div class="tip ${1}">${2}</div>';
+ $content = preg_replace($reg,$rp,$content);
+
+ //font文字排版
+ //无参数时,自动解析为红色
+ $reg = '/\[font\](.*?)\[\/font\]/s';
+ $rg = '<span style="color:red;">${1}</span>';
+ $content = preg_replace($reg,$rp,$content);
+
+ //解析只有color参数的font
+ $reg = '/\[font color="(.*?)"\](.*?)\[\/font\]/s';
+ $rp = '<span style="color:${1}">${2}</span>';
+ $content = preg_replace($reg,$rp,$content);
+
+ //解析只有bg参数的font
+ $reg = '/\[font bg="(.*?)"\](.*?)\[\/font\]/s';
+ $rp = '<span style="background-color:${1}">${2}</span>';
+ $content = preg_replace($reg,$rp,$content);
+
+ //解析只有size参数的font
+ $reg = '/\[font size="(.*?)"\](.*?)\[\/font\]/s';
+ $rp = '<span style="font-size:${1}">${2}</span>';
+ $content = preg_replace($reg,$rp,$content);
+
+ //解析只有style参数的font
+ $reg = '/\[font style="(.*?)"\](.*?)\[\/font\]/s';
+ $rp = '<span style="${1}">${2}</span>';
+ $content = preg_replace($reg,$rp,$content);
+
+ //滚动文本区域
+ $reg = '/\[stext\](.*?)\[\/stext\]/s';
+ $rp = '<div class="post-stext">${1}</div>';
+ $content = preg_replace($reg,$rp,$content);
+
+ echo $content
+?> \ No newline at end of file
diff --git a/includes/post-item.php b/includes/post-item.php
index 60ad412..f43e58c 100644
--- a/includes/post-item.php
+++ b/includes/post-item.php
@@ -1,36 +1,48 @@
<?php if($this->is('post') || $this->fields->type=='1' ): ?>
<!-- 说说 -->
-<?php if ($this->is('index')): ?>
+ <?php if ($this->is('index')): ?>
<div class="post-item item">
-
- <div class="row">
- <div class="saying-info">
+ <div class="post-content saying-content">
+ <h3><?php $this->author() ?>说:</h3>
+ <?php $this->need('includes/post-content.php'); ?>
+ </div>
+ <hr />
+ <div class="row saying-info">
<div class="col-md-1 col-xs-2 saying-avatar">
- <?php $this->author->gravatar(50); ?>
+ <?php $this->author->gravatar(50) ?>
</div>
- <div class="col-md-11 col-xs-10 saying-title-info">
- <h4 class="saying-title"><a href="<?php $this->permalink() ?>" class="post-link"><?php $this->sticky(); $this->title() ?></a></h4>
- <span><br /><i class="glyphicon glyphicon-send"></i> <?php $this->author() ?> 发布了一条说说:</span>
+ <div class="col-md-11 col-xs-10">
+ <h4 class="saying-title"><a href="<?php $this->permalink() ?>"><?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>
</div>
</div>
</div>
- <hr />
- <div class="post-content saying-content">
- <?php
- $content = preg_replace('/<img(.*?)src="(.*?)"(.*?)>/s','<a data-fancybox="gallery" href="${2}"><img${1}src="${2}"${3}></a>',$this->content);
- echo $content
- ?>
- </div>
- <a href="<?php $this->permalink() ?>" class="post-link">
+
+ <br />
+ <?php endif; ?>
+<!-- 小板式文章 -->
+<?php elseif($this->fields->type=='2'): ?>
+ <a href="<?php $this->permalink() ?>" class="post-link">
+ <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-3 post-banner-sm"></div>
+ <div class="cold-md-9 col-xs-9" style="margin-top:-20px;">
+ <h3><?php $this->sticky(); $this->title() ?></h3>
+ <p class="excerpt">
+ <?php $this->excerpt(66); ?>
+ </p>
<hr />
- <div class="post-info"><span class="glyphicon glyphicon-th-large"></span> <?php $this->category(',', true, '木有分类'); ?> &nbsp;| &nbsp;<span class="glyphicon glyphicon-calendar"></span> <?php $this->date('F j, Y'); ?> &nbsp;| &nbsp;<Span class="glyphicon glyphicon-comment"></span> <?php $this->commentsNum('%d Comments'); ?></div>
- <br />
- </a>
+ <div class="post-info"><span class="glyphicon glyphicon-th-large"></span> <?php $this->category(',', true, '木有分类'); ?> &nbsp;| &nbsp;<span class="glyphicon glyphicon-calendar"></span> <?php $this->date('F j, Y'); ?> &nbsp;| &nbsp;<Span class="glyphicon glyphicon-comment"></span> <?php $this->commentsNum('%d Comments'); ?></div>
+
+ </div>
</div>
- <br />
-<?php endif; ?>
+ </div>
+ </a>
+ <br />
<?php else: ?>
-<!-- 文章 -->
+<!-- 普通文章 -->
<a href="<?php $this->permalink() ?>" class="post-link">
<div class="item post-item">
<?php if ($this->is('index')): ?>
diff --git a/includes/toolbar.php b/includes/toolbar.php
index 1f52a4f..91bddf4 100644
--- a/includes/toolbar.php
+++ b/includes/toolbar.php
@@ -7,4 +7,7 @@
<a href="#comments"><i class="fa fa-comments"></i></a>
<?php endif; ?>
<a href="#top"><i class="fa fa-arrow-up"></i></a>
- </div> \ No newline at end of file
+ </div>
+
+ <!-- 部分js -->
+ <script type="text/javascript" src="<?php $this->options->themeUrl('assets/js/id-transition.js'); ?>"></script> \ No newline at end of file