Compare commits
95 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 33175a8951 | |||
| 0ed7e7b5e8 | |||
| 6f37575943 | |||
| 6b8f758dcf | |||
| 1f535bb9d6 | |||
| a42f5f41ca | |||
| 16e91b835e | |||
| 9671712412 | |||
| 4df85ae062 | |||
| a6883c5ce7 | |||
| 4dce3365b6 | |||
| 26e2c5b40c | |||
| c5eb0aa112 | |||
| cd3933ea53 | |||
| 482e9a1e93 | |||
| 13c3587762 | |||
| 4d7652218f | |||
| 8a7f6e5baa | |||
| ef3c0d44ed | |||
| 4f24340993 | |||
| cacb1ca01b | |||
| e4a4eed079 | |||
| 9f8976966c | |||
| d4d2fd3c13 | |||
| ad347ce0d7 | |||
| 5dc3ec7059 | |||
| 5ca790f631 | |||
| 077bd0f720 | |||
| 2189a0ec68 | |||
| 78cdfb6fe9 | |||
| 75773ee369 | |||
| 7b1984c876 | |||
| ec49b125fe | |||
| 221f0ed1bd | |||
| 5c91195745 | |||
| 81af4b6590 | |||
| 81b745ddb3 | |||
| 8aec57b257 | |||
| b5dfa7f09b | |||
| 8ac5a088aa | |||
| bfc8076867 | |||
| cd8738f10e | |||
| b7250fde19 | |||
| 579f92c720 | |||
| 458fad51bb | |||
| f1b8c138ac | |||
| 0289493b1d | |||
| b98790a646 | |||
| dbe59a80de | |||
| 5edbf772c7 | |||
| 0f64cc9bba | |||
| 59de4e3f46 | |||
| ff27b5558a | |||
| 8b692a05d1 | |||
| 3efd5abba7 | |||
| d52254d0eb | |||
| d5d35a6e70 | |||
| 696ef5a2e9 | |||
| c7171fac9b | |||
| 0cfafd5433 | |||
| 4bc9e98199 | |||
| 2e857c2e75 | |||
| f24f990e3a | |||
| 96c251cbf1 | |||
| 6f81b44809 | |||
| 18bf403848 | |||
| b0b20298b5 | |||
| 15b7523b18 | |||
| 59f1d27e27 | |||
| b3c8ea001f | |||
| 5c3fd36980 | |||
| c9be23aea0 | |||
| 9c40556f6e | |||
| 8c9dd30c52 | |||
| 74b7bcecff | |||
| b4c55168b4 | |||
| 0e343d704f | |||
| e8b1f941b4 | |||
| 044fff9185 | |||
| c5c5b94f4f | |||
| 5dd748cb53 | |||
| f205c3f37e | |||
| 1c18ec0593 | |||
| 52f8e45de0 | |||
| acb3f7e9e5 | |||
| 92cf4296f2 | |||
| 19a3934e6b | |||
| c7d947e313 | |||
| 98defefd96 | |||
| 53b3cf13a2 | |||
| 6ee130ce3d | |||
| 8c696e028c | |||
| 641c487916 | |||
| 2970fc745e | |||
| 70979cdb94 |
@@ -0,0 +1,4 @@
|
||||
|
||||
tooot.php
|
||||
Parsedown.php
|
||||
/assets/images/covers
|
||||
@@ -1,92 +1,131 @@
|
||||
|
||||
## 说明
|
||||
|
||||
移植自 `bigfa `大大的 `hugo-theme-farallon` 原汁原味,可以直接使用 原主题的CSS
|
||||
精简部分 JS.
|
||||
|
||||
- 2024.7.4
|
||||
把分类图片以`mid`.jpg 的形式在主题`/dist/img`目录下,自动匹配
|
||||
|
||||
- 2024.6.12
|
||||
|
||||
更新豆瓣API获取方式
|
||||
[Docker 自动同步豆瓣书影音记录](https://fatesinger.com/103483)
|
||||
主题设置处填入API
|
||||
|
||||
- 2024.6.7
|
||||
|
||||
用自带评论做的说说页面,来自
|
||||
https://github.com/gogobody/typecho-whisper
|
||||
删减部分内容只能发表文字
|
||||
|
||||
- 2024.6.5 v0.5.3
|
||||
|
||||
新增了好物的页面 还是通过memos来获取
|
||||
|
||||
- 2024.6.4 v0.5.1
|
||||
|
||||
更改了设置memos的方式
|
||||
新增了Mastodon 的 说说 页面
|
||||
|
||||
- 2024.6.3 v0.5.0
|
||||
|
||||
还是抄了原版的豆瓣获取方式
|
||||
|
||||
- 2024.5.26 v0.4.1
|
||||
|
||||
抄了个网站统计页面
|
||||
|
||||
- 2024.5.24
|
||||
|
||||
新增了说说页面,基于memos 0.19 以下的版本
|
||||
在后台设置memos的地址和memoID即可
|
||||
默认获取最近20条公开的memo
|
||||
移植自 `bigfa `大大的 `hugo-theme-farallon` 主题,并在此基础上进行了一些修改.
|
||||
由于是自用,有很多主观上的修改,可能不适合所有人.
|
||||
|
||||
|
||||
## 原项目地址
|
||||
https://github.com/bigfa/hugo-theme-farallon
|
||||
## 更新日志 & 预览
|
||||
|
||||
### 0.8
|
||||
|
||||
- 兼容 Typecho 1.3.0
|
||||
- 自动裁切封面并保存在主题目录 `usr/cache/covers` 下,使用前必须开启 `php` 的 `GD拓展` 和`usr`目录的写权限.
|
||||
- 站点统计
|
||||
|
||||
### 0.7.2
|
||||
|
||||
- ~~优化页面加载速度,自动裁切封面,并压缩为`webp`格式,并保存在主题目录`assets`-`images`-`covers`下,使用前必须开启`php`的`GD拓展`和主题目录的写入权限~~
|
||||
- 修复了置顶文章和翻页的问题
|
||||
|
||||
### 0.7.1
|
||||
|
||||
- 调整了赞赏的样式,同时填写支付宝和微信收款码的图片地址即可显示
|
||||
- 调整文章列表的加载方式
|
||||
- 调整了文件的结构
|
||||
|
||||
### 0.7.0
|
||||
|
||||
根据原版更新,修复了一些问题,并添加了一些功能
|
||||
|
||||
- 增加了文章列表的加载方式选择
|
||||
- 增加了足迹分类的显示
|
||||
- 增加了说说页面的显示
|
||||
- 增加了编辑页面的自定义字段的说明
|
||||
|
||||
- 调整了文件夹的结构
|
||||
- 调整了一些样式
|
||||
|
||||
- 移除了评论功能对links插件的关联,避免出现错误
|
||||
- 移除了一些不必要的文件
|
||||
- 移除了评论QQ通知的功能
|
||||
|
||||
|
||||
后续会继续更新
|
||||
|
||||
|
||||
- 可能会删除Memos说说的功能,因为memos的API不稳定
|
||||
- 逐渐移除依靠API实现的功能
|
||||
|
||||
|
||||
|
||||
[预览](https://blog.imsun.org/)
|
||||
|
||||
https://www.imsun.org/archives/1640.html
|
||||
|
||||
## 功能
|
||||
|
||||
### 豆瓣观影
|
||||
### 封面
|
||||
|
||||
更新 获取方式
|
||||
优先使用自定义字段`cover`的值作为封面,若没有则使用文章内的第一张图片作为封面
|
||||
|
||||
### 摘要
|
||||
|
||||
优先使用自定义字段`summary`的值作为摘要,若没有则显示默认字数摘要
|
||||
|
||||
### 观影
|
||||
|
||||
- 更新豆瓣API获取方式
|
||||
|
||||
[Docker 自动同步豆瓣书影音记录](https://fatesinger.com/103483)
|
||||
|
||||
在新建页面选择模板`豆瓣页面`, 在自定义字段设置`douban`值为API地址. (默认为`https://db.imsun.org`)
|
||||
|
||||
- neodb 方式获取
|
||||
|
||||
参照[使用 NeoDB API 构建观影页面](https://www.imsun.org/archives/1688.html)
|
||||
|
||||
在新建页面选择模板`NEODB页面`, 在自定义字段设置`neodb`值为API地址. (默认为`https://neodb.imsun.org`)
|
||||
|
||||
### 友情链接
|
||||
|
||||
基于 `links` 插件实现
|
||||
本功能基于 `links` 插件实现,必须安装 `links` 插件才能使用.
|
||||
否则报错`Class "Links_Plugin" not found`
|
||||
|
||||
可使用 `寒泥` 大佬制作的版本或者其他版本
|
||||
|
||||
### 首页摘要
|
||||
|
||||
若使用AI摘要插件则显示AI摘要,不使用则显示默认字数摘要
|
||||
*可使用 `寒泥` 大佬制作的版本或者其他版本*
|
||||
|
||||
### 说说 by Memos
|
||||
|
||||
使用自定义字段设置memos
|
||||
基于`memos`的API获取,注意该功能要求`memos`的版本为 v0.18.0
|
||||
|
||||
在自定义字段中填入`memos`值为memos地址,不带`/`
|
||||
自定义页面使用模板`说说页面 by memos`在自定义字段设置
|
||||
|
||||
在自定义字段中填入`memosID`默认值为`1`,不为`1`时才需要设置
|
||||
- `memos`值为memos地址,结尾不带`/`
|
||||
|
||||
在自定义字段中填入`memosnum`默认值为`20`,默认获取20条最近的memo
|
||||
- `memosID`默认值为`1`,不为`1`时需要设置
|
||||
|
||||
- `memosnum`默认值为`20`,默认获取20条最近的memo
|
||||
|
||||
### 说说 by Mastodon
|
||||
|
||||
根据 https://www.imsun.org/archives/1643.html
|
||||
兼容`Mastodon`,`Pleroma`,`GotoSocial`的API.
|
||||
|
||||
根据 [如何获得Access Tokens](https://www.imsun.org/archives/1643.html)
|
||||
获得API地址
|
||||
|
||||
在自定义字段中填入`tooot`值为Mastodon API 地址
|
||||
在自定义字段中填入`tooot`值为 Mastodon API 地址
|
||||
|
||||
### 好物 by memos
|
||||
### 好物页面
|
||||
|
||||
在自定义字段中填入`memos`值为memos地址
|
||||
在自定义字段中填入`memosID`默认值为`1`,不为`1`时才需要设置
|
||||
在自定义字段中填入`memostag`默认值为`好物`,不为`好物`时才需要设置
|
||||
## 预览地址
|
||||
~~在自定义字段中填入`memos`值为memos地址~~
|
||||
~~在自定义字段中填入`memosID`默认值为`1`,不为`1`时才需要设置~~
|
||||
~~在自定义字段中填入`memostag`默认值为`好物`,不为`好物`时才需要设置~~
|
||||
~~memos的写法可以参照~~
|
||||
|
||||
https://www.imsun.org
|
||||
在自定义页面选择模板`好物页面`
|
||||
|
||||
在编辑器中使用表格的方式进行书写,以下为示例
|
||||
```markdown
|
||||
| 图片链接 | 商品名称 | 价格 | 商品链接 | 推荐理由 |
|
||||
|---------|---------|------|----------|----------|
|
||||
| https://example.com/image1.jpg | 商品A | ¥99 | https://example.com/product1 | 这是一个很好的产品 |
|
||||
| https://example.com/image2.jpg | 商品B | ¥199 | https://example.com/product2 | 非常推荐购买 |
|
||||
```
|
||||
|
||||
|
||||
## 版权
|
||||
|
||||
使用本主题请保留原作者的版权信息 谢谢合作
|
||||
|
||||
## 感谢
|
||||
|
||||
|
||||
@@ -1,117 +1,46 @@
|
||||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<?php $this->need('header.php'); ?>
|
||||
<main class="site--main">
|
||||
<header class="archive--header"><?php if ($this->have()): ?>
|
||||
<h2 class="post--single__title"><?php $this->archiveTitle(array(
|
||||
<header class="archive--header">
|
||||
<h2 class="post--single__title">
|
||||
<?php $this->archiveTitle(array(
|
||||
'category' => _t(' <span> %s </span> '),
|
||||
'search' => _t('包含关键字<span> %s </span>的文章'),
|
||||
'date' => _t('在 <span> %s </span>发布的文章'),
|
||||
'tag' => _t('标签 <span> %s </span>下的文章'),
|
||||
'author' => _t('作者 <span>%s </span>发布的文章')
|
||||
), '', ''); ?></h2>
|
||||
<h3 class="post--single__subtitle"><?php $this->categorydescription(); ?></h3>
|
||||
<?php while($this->next()): ?>
|
||||
</header>
|
||||
<article class="post--item">
|
||||
<div class="content">
|
||||
<h2 class="post--title">
|
||||
<a href="<?php $this->permalink() ?>"><?php $this->title() ?></a>
|
||||
</h2>
|
||||
<div class="description">
|
||||
<?php
|
||||
// 判断是否存在自定义字段summary并输出,否则输出自动生成的摘要
|
||||
if($this->fields->summary){echo $this->fields->summary;} else {$this->excerpt(180); }
|
||||
?>
|
||||
</div>
|
||||
<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><time><?php $this->date('Y-m-d'); ?></time>
|
||||
<svg class="icon" viewBox="0 0 1024 1024" width="16" height="16">
|
||||
<path
|
||||
d="M408.551619 97.52381a73.142857 73.142857 0 0 1 51.736381 21.430857L539.306667 197.973333A73.142857 73.142857 0 0 0 591.067429 219.428571H804.571429a73.142857 73.142857 0 0 1 73.142857 73.142858v560.761904a73.142857 73.142857 0 0 1-73.142857 73.142857H219.428571a73.142857 73.142857 0 0 1-73.142857-73.142857V170.666667a73.142857 73.142857 0 0 1 73.142857-73.142857h189.123048z m0 73.142857H219.428571v682.666666h585.142858V292.571429h-213.504a146.285714 146.285714 0 0 1-98.499048-38.13181L487.619048 249.734095 408.551619 170.666667zM365.714286 633.904762v73.142857h-73.142857v-73.142857h73.142857z m365.714285 0v73.142857H414.47619v-73.142857h316.952381z m-365.714285-195.047619v73.142857h-73.142857v-73.142857h73.142857z m365.714285 0v73.142857H414.47619v-73.142857h316.952381z">
|
||||
</path>
|
||||
</svg><?php $this->category(','); ?>
|
||||
<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><a href="<?php $this->permalink() ?>#comments"><?php $this->commentsNum('0 ', '1 ', '%d '); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<?php endwhile; ?>
|
||||
</main>
|
||||
<?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'
|
||||
)
|
||||
);
|
||||
?>
|
||||
<!-- 搜索结果 -->
|
||||
), '', ''); ?>
|
||||
</h2>
|
||||
<div class="taxonomy--description">
|
||||
<?php echo $this->getDescription(); ?>
|
||||
</div>
|
||||
</header>
|
||||
<div class="site--main">
|
||||
<?php
|
||||
// 获取分类ID配置
|
||||
$travelId = Helper::options()->travel;
|
||||
$memosId = Helper::options()->memos;
|
||||
// 安全地获取当前分类 mid
|
||||
$currentCategory = isset($this->categories[0]['mid']) ? intval($this->categories[0]['mid']) : null;
|
||||
// 转换为整型(如果需要)
|
||||
$travelId = is_numeric($travelId) ? intval($travelId) : null;
|
||||
$memosId = is_numeric($memosId) ? intval($memosId) : null;
|
||||
?>
|
||||
<?php if ($this->have()): ?>
|
||||
<?php if ($currentCategory === $travelId): ?>
|
||||
<!-- 旅行分类模板 -->
|
||||
<?php $this->need('module/travel.php'); ?>
|
||||
<?php elseif ($currentCategory === $memosId): ?>
|
||||
<!-- 说说分类模板 -->
|
||||
<?php $this->need('module/memos.php'); ?>
|
||||
<?php else: ?>
|
||||
<main class="site--main">
|
||||
<header class="archive-header archive-header__search">
|
||||
<div class="pagination">
|
||||
<h2>Sorry</h2>
|
||||
<p>很遗憾,未找到您期待的内容</p>
|
||||
</div>
|
||||
</header>
|
||||
</main>
|
||||
<?php endif; ?>
|
||||
<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>
|
||||
<!-- 默认文章列表 -->
|
||||
<?php $this->need('module/postlist.php'); ?>
|
||||
<?php endif; ?>
|
||||
<!-- 分页导航 -->
|
||||
<?php $this->need('module/paging.php'); ?>
|
||||
<?php else: ?>
|
||||
<!-- 无结果 -->
|
||||
<?php $this->need('module/notfound.php'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
@@ -0,0 +1 @@
|
||||
.lb-loader,.lightbox{text-align:center;line-height:0;position:absolute;left:0}body.lb-disable-scrolling{overflow:hidden}.lightboxOverlay{position:absolute;top:0;left:0;z-index:9999;background-color:#000;filter:alpha(Opacity=80);opacity:.8;display:none}.lightbox{width:100%;z-index:10000;font-weight:400;outline:0}.lightbox .lb-image{display:block;height:auto;max-width:inherit;max-height:none;border-radius:3px;border:4px solid #fff}.lightbox a img{border:none}.lb-outerContainer{position:relative;width:250px;height:250px;margin:0 auto;border-radius:4px;background-color:#fff}.lb-outerContainer:after{content:"";display:table;clear:both}.lb-loader{top:43%;height:25%;width:100%}.lb-cancel{display:block;width:32px;height:32px;margin:0 auto;background:url(../images/loading.gif) no-repeat}.lb-nav{position:absolute;top:0;left:0;height:100%;width:100%;z-index:10}.lb-container>.nav{left:0}.lb-nav a{outline:0;background-image:url(data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==)}.lb-next,.lb-prev{height:100%;cursor:pointer;display:block}.lb-nav a.lb-prev{width:34%;left:0;float:left;background:url(../images/prev.png) left 48% no-repeat;filter:alpha(Opacity=0);opacity:0;-webkit-transition:opacity .6s;-moz-transition:opacity .6s;-o-transition:opacity .6s;transition:opacity .6s}.lb-nav a.lb-prev:hover{filter:alpha(Opacity=100);opacity:1}.lb-nav a.lb-next{width:64%;right:0;float:right;background:url(../images/next.png) right 48% no-repeat;filter:alpha(Opacity=0);opacity:0;-webkit-transition:opacity .6s;-moz-transition:opacity .6s;-o-transition:opacity .6s;transition:opacity .6s}.lb-nav a.lb-next:hover{filter:alpha(Opacity=100);opacity:1}.lb-dataContainer{margin:0 auto;padding-top:5px;width:100%;border-bottom-left-radius:4px;border-bottom-right-radius:4px}.lb-dataContainer:after{content:"";display:table;clear:both}.lb-data{padding:0 4px;color:#ccc}.lb-data .lb-details{width:85%;float:left;text-align:left;line-height:1.1em}.lb-data .lb-caption{font-size:13px;font-weight:700;line-height:1em}.lb-data .lb-caption a{color:#4ae}.lb-data .lb-number{display:block;clear:left;padding-bottom:1em;font-size:12px;color:#999}.lb-data .lb-close{display:block;float:right;width:30px;height:30px;background:url(../images/close.png) top right no-repeat;text-align:right;outline:0;filter:alpha(Opacity=70);opacity:.7;-webkit-transition:opacity .2s;-moz-transition:opacity .2s;-o-transition:opacity .2s;transition:opacity .2s}.lb-data .lb-close:hover{cursor:pointer;filter:alpha(Opacity=100);opacity:1}
|
||||
@@ -0,0 +1 @@
|
||||
.neodb-container{--db-item-width:140px;--db-item-height:180px;--db-music-width:150px;--db-music-height:150px;--db-primary-color:var(--farallon-hover-color);--db-background-white:var(--farallon-background-white);--db-background-gray:var(--farallon-background-gray);--db-border-color:var(--farallon-border-color);--db-text-light:var(--farallon-text-light);}.neodb-nav{padding:30px 0 20px;display:flex;align-items:center;flex-wrap:wrap;}.neodb-navItem{font-size:20px;cursor:pointer;border-bottom:1px solid rgba(0,0,0,0);transition:0.5s border-color;display:flex;align-items:center;text-transform:capitalize;}.neodb-navItem.current,.neodb-navItem:hover{border-color:inherit;}.neodb-navItem{margin-right:20px;}.neodb-score svg{fill:#f5c518;margin-right:5px;}.neodb-list{display:flex;align-items:flex-start;flex-wrap:wrap;}.neodb-image{width:var(--db-item-width);height:var(--db-item-height);object-fit:cover;border-radius:4px;}.neodb-image:hover{box-shadow:0 0 10px var(--db-border-color);}.neodb-title{margin-top:2px;font-size:14px;line-height:1.4;}.neodb-title a:hover{color:var(--db-primary-color);text-decoration:underline;}.neodb-genreItem{background:var(--db-background-gray);font-size:12px;padding:5px 12px;border-radius:4px;margin-right:6px;margin-bottom:10px;line-height:1.4;cursor:pointer;}.neodb-genreItem.is-active,.neodb-genreItem:hover{background-color:var(--db-primary-color);color:var(--db-background-white);}.neodb-genres{padding-bottom:15px;display:flex;flex-wrap:wrap;}.neodb-genres.u-hide + .neodb-list{padding-top:10px;}.neodb-score{display:flex;align-items:center;font-size:14px;color:var(--db-text-light);}.neodb-item{width:var(--db-item-width);margin-right:20px;margin-bottom:20px;position:relative;}.neodb-item__music img{width:var(--db-music-width);height:var(--db-music-height);object-fit:cover;}.neodb-date{position:relative;font-size:20px;color:var(--farallon-text-light);font-weight:900;line-height:1;}.neodb-date::before{content:"";position:absolute;top:0.5em;bottom:-2px;left:-10px;width:3.4em;z-index:-1;background:var(--farallon-hover-color);opacity:0.3;transform:skew(-35deg);transition:opacity 0.2s ease;border-radius:3px 8px 10px 6px;}.neodb-date{margin-top:30px;margin-bottom:10px;}.neodb-dateList{padding-left:15px;padding-top:5px;padding-right:15px;}.neodb-card__list{display:flex;align-items:center;padding:15px 0;border-bottom:1px dotted var(--farallon-border-color);font-size:14px;color:rgba(0,0,0,0.55);}.neodb-card__list:last-child{border-bottom:0;}.neodb-card__list .title{font-size:18px;margin-bottom:5px;}.neodb-card__list .rating{margin:0 0 0px;font-size:14px;line-height:1;display:flex;align-items:center;}.neodb-card__list .rating .allstardark{position:relative;color:#f99b01;height:16px;width:80px;background-repeat:repeat;background-image:url("../images/star.svg");background-size:auto 100%;margin-right:5px;}.neodb-card__list .rating .allstarlight{position:absolute;left:0;color:#f99b01;height:16px;overflow:hidden;background-repeat:repeat;background-image:url("../images/star-fill.svg");background-size:auto 100%;}.neodb-card__list img{width:80px;border-radius:4px;height:80px;object-fit:cover;flex:0 0 auto;margin-right:15px;}.neodb-titleDate{display:flex;flex-direction:column;line-height:1.1;margin-bottom:10px;flex:0 0 auto;margin-right:15px;align-items:center;}.neodb-titleDate__day{font-weight:900;font-size:44px;}.neodb-titleDate__month{font-size:14px;color:var(--farallon-text-light);font-weight:900;}.neodb-list__card{display:block;}.neodb-dateList__card{display:flex;flex-wrap:wrap;align-items:flex-start;}.neodb-listBydate{display:flex;align-items:flex-start;margin-top:15px;}@media (max-width:600px){.neodb-listBydate{flex-direction:column;}}
|
||||
|
After Width: | Height: | Size: 280 B |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
@@ -17,7 +17,7 @@
|
||||
is_single = false;
|
||||
post_id = 0;
|
||||
is_archive = false;
|
||||
VERSION = "0.5.6";
|
||||
VERSION = "0.8";
|
||||
constructor() {
|
||||
super();
|
||||
this.initCopyright();
|
||||
@@ -46,7 +46,8 @@
|
||||
}
|
||||
initCopyright() {
|
||||
const copyright = `<div class="site--footer__info">
|
||||
Theme <a href="https://fatesinger.com/101971" target="_blank">farallon</a> by bigfa / version ${this.VERSION}
|
||||
Theme <a href="https://github.com/jkjoy/typecho-theme-farallon" target="_blank">farallon</a> Designed by <a href="https://fatesinger.com/" target="_blank">bigfa</a>
|
||||
<p><a href="https://www.imsun.org" target="_blank"> 老孙博客</a> 移植 / version ${this.VERSION}</p>
|
||||
</div>`;
|
||||
document.querySelector(".site--footer__content").insertAdjacentHTML("afterend", copyright);
|
||||
document.querySelector(".icon--copryrights").addEventListener("click", () => {
|
||||
@@ -0,0 +1,66 @@
|
||||
document.addEventListener('click', function (e) {
|
||||
// 检查点击的元素是否是 .loadmore a
|
||||
if (e.target.closest('.loadmore a')) {
|
||||
e.preventDefault();
|
||||
var btn = e.target.closest('.loadmore a');
|
||||
var nextPage = btn.getAttribute('href');
|
||||
// 防止重复点击
|
||||
if (btn.classList.contains('loading')) return false;
|
||||
btn.classList.add('loading');
|
||||
btn.textContent = '加载中...';
|
||||
// 发起 AJAX 请求
|
||||
fetch(nextPage)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
}
|
||||
return response.text();
|
||||
})
|
||||
.then(data => {
|
||||
// 创建一个临时的 DOM 元素来解析返回的 HTML
|
||||
var parser = new DOMParser();
|
||||
var htmlDoc = parser.parseFromString(data, 'text/html');
|
||||
// 调试代码:检查选择器
|
||||
console.log('Searching for #loadpost:', htmlDoc.querySelectorAll('#loadpost'));
|
||||
console.log('Searching for .nav-links:', htmlDoc.querySelector('.nav-links'));
|
||||
// 找到新的文章和按钮
|
||||
var newPosts = htmlDoc.querySelectorAll('#loadpost');
|
||||
var newBtn = htmlDoc.querySelector('.nav-links a');
|
||||
// 更健壮的元素选择
|
||||
var articleList = document.querySelector('#loadposts') ||
|
||||
document.querySelector('.posts-container') ||
|
||||
document.body;
|
||||
var postReadMore = document.querySelector('.nav-links');
|
||||
if (newPosts.length > 0) {
|
||||
newPosts.forEach(post => {
|
||||
// 使用 appendChild 替代 insertBefore
|
||||
articleList.appendChild(post);
|
||||
});
|
||||
// 新文章淡入效果
|
||||
Array.from(newPosts).forEach(post => {
|
||||
post.style.opacity = 0;
|
||||
setTimeout(() => {
|
||||
post.style.transition = 'opacity 0.5s';
|
||||
post.style.opacity = 1;
|
||||
}, 10);
|
||||
});
|
||||
}
|
||||
// 更新"加载更多"按钮或移除它
|
||||
if (newBtn) {
|
||||
btn.setAttribute('href', newBtn.getAttribute('href'));
|
||||
btn.classList.remove('loading');
|
||||
btn.textContent = '加载更多';
|
||||
} else {
|
||||
// 如果没有更多的按钮,移除 .post-read-more
|
||||
if (postReadMore) {
|
||||
postReadMore.remove();
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("AJAX Error:", error);
|
||||
btn.classList.remove('loading');
|
||||
btn.textContent = '加载失败,点击重试';
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,142 @@
|
||||
class NeoDB {
|
||||
constructor(config) {
|
||||
this.container = config.container;
|
||||
this.types = config.types ?? ["book", "movie", "tv", "music", "game", "podcast"];
|
||||
this.baseAPI = config.baseAPI;
|
||||
this.type = "movie";
|
||||
this.status = "complete";
|
||||
this.finished = false;
|
||||
this.paged = 1;
|
||||
this.subjects = [];
|
||||
this._create();
|
||||
}
|
||||
|
||||
on(event, element, callback) {
|
||||
const nodeList = document.querySelectorAll(element);
|
||||
nodeList.forEach((item) => {
|
||||
item.addEventListener(event, callback);
|
||||
});
|
||||
}
|
||||
|
||||
_handleTypeClick() {
|
||||
this.on("click", ".neodb-navItem", (t) => {
|
||||
const self = t.currentTarget;
|
||||
if (self.classList.contains("current")) return;
|
||||
this.type = self.dataset.type;
|
||||
document.querySelector(".neodb-list").innerHTML = "";
|
||||
document.querySelector(".lds-ripple").classList.remove("u-hide");
|
||||
document.querySelector(".neodb-navItem.current").classList.remove("current");
|
||||
self.classList.add("current");
|
||||
this.paged = 1;
|
||||
this.finished = false;
|
||||
this.subjects = [];
|
||||
this._fetchData();
|
||||
});
|
||||
}
|
||||
|
||||
_renderTypes() {
|
||||
document.querySelector(".neodb-nav").innerHTML = this.types
|
||||
.map((item) => {
|
||||
return `<span class="neodb-navItem${
|
||||
this.type == item ? " current" : ""
|
||||
}" data-type="${item}">${item}</span>`;
|
||||
})
|
||||
.join("");
|
||||
this._handleTypeClick();
|
||||
}
|
||||
|
||||
_fetchData() {
|
||||
const params = new URLSearchParams({
|
||||
type: "complete",
|
||||
category: this.type,
|
||||
page: this.paged.toString(),
|
||||
});
|
||||
|
||||
return fetch(this.baseAPI + "?" + params.toString())
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
if (data.length) {
|
||||
// 过滤重复项
|
||||
data = data.filter(item => !this.subjects.some(existing => existing.item.id === item.item.id));
|
||||
|
||||
if (data.length) {
|
||||
this.subjects = [...this.subjects, ...data];
|
||||
this._renderListTemplate();
|
||||
}
|
||||
|
||||
document.querySelector(".lds-ripple").classList.add("u-hide");
|
||||
} else {
|
||||
this.finished = true; // 没有更多数据
|
||||
document.querySelector(".lds-ripple").classList.add("u-hide");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_renderListTemplate() {
|
||||
document.querySelector(".neodb-list").innerHTML = this.subjects
|
||||
.map((item) => {
|
||||
const coverImage = item.item.cover_image_url;
|
||||
const title = item.item.title;
|
||||
const rating = item.item.rating;
|
||||
const link = item.item.id;
|
||||
|
||||
return `<div class="neodb-item">
|
||||
<img src="${coverImage}" referrerpolicy="no-referrer" class="neodb-image">
|
||||
<div class="neodb-score">
|
||||
${rating ? `<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor"><path d="M12 20.1l5.82 3.682c1.066.675 2.37-.322 2.09-1.584l-1.543-6.926 5.146-4.667c.94-.85.435-2.465-.799-2.567l-6.773-.602L13.29.89a1.38 1.38 0 0 0-2.581 0l-2.65 6.53-6.774.602C.052 8.126-.453 9.74.486 10.59l5.147 4.666-1.542 6.926c-.28 1.262 1.023 2.26 2.09 1.585L12 20.099z"></path></svg>${rating}` : ""}
|
||||
</div>
|
||||
<div class="neodb-title">
|
||||
<a href="${link}" target="_blank">${title}</a>
|
||||
</div>
|
||||
|
||||
</div>`;
|
||||
})
|
||||
.join("");
|
||||
}
|
||||
|
||||
_handleScroll() {
|
||||
let isLoading = false; // 标志位,表示是否正在加载数据
|
||||
let lastScrollTop = 0; // 上一次的滚动位置
|
||||
|
||||
window.addEventListener("scroll", () => {
|
||||
const scrollY = window.scrollY || window.pageYOffset;
|
||||
const moreElement = document.querySelector(".block-more");
|
||||
|
||||
// 检查滚动到底部的条件
|
||||
if (
|
||||
moreElement.offsetTop + moreElement.clientHeight <= scrollY + window.innerHeight &&
|
||||
document.querySelector(".lds-ripple").classList.contains("u-hide") &&
|
||||
!this.finished &&
|
||||
!isLoading // 确保没有正在加载数据
|
||||
) {
|
||||
isLoading = true; // 设置标志位为 true,表示正在加载数据
|
||||
document.querySelector(".lds-ripple").classList.remove("u-hide");
|
||||
this.paged++;
|
||||
this._fetchData().finally(() => {
|
||||
isLoading = false; // 数据加载完成后,重置标志位
|
||||
});
|
||||
}
|
||||
|
||||
// 更新上一次的滚动位置
|
||||
lastScrollTop = scrollY;
|
||||
});
|
||||
}
|
||||
|
||||
_create() {
|
||||
if (document.querySelector(".neodb-container")) {
|
||||
const container = document.querySelector(this.container);
|
||||
if (!container) return;
|
||||
container.innerHTML = `
|
||||
<nav class="neodb-nav"></nav>
|
||||
<div class="neodb-list"></div>
|
||||
<div class="block-more block-more__centered">
|
||||
<div class="lds-ripple"></div>
|
||||
</div>
|
||||
`;
|
||||
this._renderTypes();
|
||||
this._fetchData();
|
||||
this._handleScroll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const tooltip = document.getElementById('copyTooltip');
|
||||
let timeoutId = null;
|
||||
// 确保初始状态下提示框是隐藏的
|
||||
//tooltip.style.display = 'none';
|
||||
// 复制函数
|
||||
function copyToClipboard(text) {
|
||||
navigator.clipboard.writeText(text).then(() => {
|
||||
// 显示提示
|
||||
tooltip.style.display = 'block';
|
||||
tooltip.style.opacity = '1';
|
||||
// 清除之前的定时器(如果存在)
|
||||
if (timeoutId) clearTimeout(timeoutId);
|
||||
// 设置新的定时器
|
||||
timeoutId = setTimeout(() => {
|
||||
tooltip.style.opacity = '0';
|
||||
setTimeout(() => {
|
||||
tooltip.style.display = 'none';
|
||||
}, 300); // 等待淡出动画完成后再隐藏
|
||||
}, 1500);
|
||||
}).catch(err => {
|
||||
tooltip.textContent = '复制失败,请重试';
|
||||
tooltip.style.display = 'block';
|
||||
tooltip.style.opacity = '1';
|
||||
|
||||
if (timeoutId) clearTimeout(timeoutId);
|
||||
timeoutId = setTimeout(() => {
|
||||
tooltip.style.opacity = '0';
|
||||
setTimeout(() => {
|
||||
tooltip.style.display = 'none';
|
||||
tooltip.textContent = '复制成功!'; // 重置文本
|
||||
}, 300);
|
||||
}, 1500);
|
||||
console.error('复制失败:', err);
|
||||
});
|
||||
}
|
||||
// 给所有复制链接添加点击事件
|
||||
document.querySelectorAll('.copy').forEach(link => {
|
||||
link.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
const textToCopy = this.getAttribute('data-copy') || this.textContent;
|
||||
copyToClipboard(textToCopy);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
const targetClassElement = document.querySelector('.post--single__title');
|
||||
const postContent = document.querySelector('.post--single__content');
|
||||
if (!postContent) return;
|
||||
let found = false;
|
||||
for (let i = 1; i <= 6 &&!found; i++) {
|
||||
if (postContent.querySelector(`h${i}`)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found) return;
|
||||
const heads = postContent.querySelectorAll('h1, h2, h3, h4, h5, h6');
|
||||
const toc = document.createElement('div');
|
||||
toc.id = 'toc';
|
||||
toc.innerHTML = '<details class="toc" open><summary class="toc-title">目录</summary><nav id="TableOfContents"><ul></ul></nav></details>';
|
||||
// 插入到指定 class 元素之后
|
||||
if (targetClassElement) {
|
||||
targetClassElement.parentNode.insertBefore(toc, targetClassElement.nextSibling);
|
||||
}
|
||||
let currentLevel = 0;
|
||||
let currentList = toc.querySelector('ul');
|
||||
let levelCounts = [0];
|
||||
heads.forEach((head, index) => {
|
||||
const level = parseInt(head.tagName.substring(1));
|
||||
if (levelCounts[level] === undefined) {
|
||||
levelCounts[level] = 1;
|
||||
} else {
|
||||
levelCounts[level]++;
|
||||
}
|
||||
// 重置下级标题的计数器
|
||||
levelCounts = levelCounts.slice(0, level + 1);
|
||||
if (currentLevel === 0) {
|
||||
currentLevel = level;
|
||||
}
|
||||
while (level > currentLevel) {
|
||||
let newList = document.createElement('ul');
|
||||
if (!currentList.lastElementChild) {
|
||||
currentList.appendChild(newList);
|
||||
} else {
|
||||
currentList.lastElementChild.appendChild(newList);
|
||||
}
|
||||
currentList = newList;
|
||||
currentLevel++;
|
||||
levelCounts[currentLevel] = 1;
|
||||
}
|
||||
while (level < currentLevel) {
|
||||
currentList = currentList.parentElement;
|
||||
if (currentList.tagName.toLowerCase() === 'li') {
|
||||
currentList = currentList.parentElement;
|
||||
}
|
||||
currentLevel--;
|
||||
}
|
||||
const anchor = head.textContent.trim().replace(/\s+/g, '-');
|
||||
head.id = anchor;
|
||||
const item = document.createElement('li');
|
||||
const link = document.createElement('a');
|
||||
link.href = `#${anchor}`;
|
||||
link.textContent = `${head.textContent}`;
|
||||
link.style.textDecoration = 'none';
|
||||
item.appendChild(link);
|
||||
currentList.appendChild(item);
|
||||
});
|
||||
});
|
||||
|
||||
function fetchWithRetry(url, retries = 3) {
|
||||
return fetch(url)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
return response.text(); // 首先获取文本响应
|
||||
})
|
||||
.then(text => {
|
||||
try {
|
||||
return JSON.parse(text); // 尝试解析 JSON
|
||||
} catch (e) {
|
||||
console.error('Invalid JSON:', text);
|
||||
throw new Error('Invalid JSON response');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
if (retries > 0) {
|
||||
console.log(`Retrying... (${retries} attempts left)`);
|
||||
return new Promise(resolve => setTimeout(resolve, 1000)) // 等待1秒
|
||||
.then(() => fetchWithRetry(url, retries - 1));
|
||||
}
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const doubanLinks = document.querySelectorAll('a[href^="https://movie.douban.com/subject/"]');
|
||||
doubanLinks.forEach(link => {
|
||||
const url = link.href;
|
||||
const movieId = url.match(/subject\/(\d+)/)[1];
|
||||
link.innerHTML += ' <span class="loading">(加载中...)</span>';
|
||||
fetchWithRetry(`https://api.loliko.cn/movies/${movieId}`)
|
||||
.then(data => {
|
||||
const movieInfo = createMovieInfoHTML(data, url);
|
||||
const wrapper = document.createElement('div');
|
||||
wrapper.innerHTML = movieInfo;
|
||||
link.parentNode.replaceChild(wrapper, link);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error fetching movie data:', error);
|
||||
// 显示错误消息给用户
|
||||
link.innerHTML = `<span style="color: red;">加载失败</span> <a href="${url}" target="_blank">查看豆瓣电影详情</a>`;
|
||||
})
|
||||
.finally(() => {
|
||||
const loadingSpan = link.querySelector('.loading');
|
||||
if (loadingSpan) {
|
||||
loadingSpan.remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
function createMovieInfoHTML(data, originalUrl) {
|
||||
if (!data || data.error || Object.keys(data).length === 0) {
|
||||
return `<a href="${originalUrl}" target="_blank">查看豆瓣电影详情</a>`;
|
||||
}
|
||||
return `
|
||||
<div class=doulist-item>
|
||||
<div class=doulist-subject>
|
||||
<div class=doulist-post>
|
||||
<img decoding=async referrerpolicy=no-referrer src=${data.img}>
|
||||
</div>
|
||||
<div class=doulist-content>
|
||||
<div class=doulist-title>
|
||||
<a href="${originalUrl}" class=cute target="_blank" rel="external nofollow"> ${data.name} </a>
|
||||
</div>
|
||||
<div class=rating>
|
||||
<span class=rating_nums>豆瓣评分 : ${data.rating}</span>
|
||||
</div>
|
||||
<div class=abstract>
|
||||
${data.year}年 · ${data.country} · ${data.genre} · 导演: ${data.director} · 演员 : ${data.actor}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
@@ -1,162 +0,0 @@
|
||||
<?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;
|
||||
}
|
||||
/* 分页 */
|
||||
</style>
|
||||
<div class="post--ingle__comments">
|
||||
<?php $this->comments()->to($comments); ?>
|
||||
<?php if($this->allow('comment')): ?>
|
||||
<?php if ($this->is('attachment')) : ?>
|
||||
<?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>
|
||||
<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('退出'); ?> »</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 endif; ?>
|
||||
<?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; ?>
|
||||
<?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 if ($comments->parent) {echo getPermalinkFromCoid($comments->parent);}?>
|
||||
<?php $comments->content(); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($comments->children) { ?>
|
||||
<ol class="children">
|
||||
<?php $comments->threadedComments($options); ?>
|
||||
</ol>
|
||||
<?php } ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
@@ -1,66 +0,0 @@
|
||||
.donate-panel{
|
||||
text-align: center;
|
||||
position: relative;
|
||||
}
|
||||
#donate-btn{
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
/* #background: #e26d6d;*/
|
||||
color: #fff;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
line-height: 50px;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
/* box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04)*/
|
||||
}
|
||||
#donate-btn:hover{
|
||||
/* #background: #bd4b4b;*/
|
||||
}
|
||||
#qrcode-panel{
|
||||
position: absolute;
|
||||
width: 300px;
|
||||
height: 320px;
|
||||
background:#fff;
|
||||
top: 0;
|
||||
left: 0;
|
||||
border-radius: 5px;
|
||||
/* padding: 5px; */
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
|
||||
}
|
||||
.qrcode-body{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background:#fff;
|
||||
position: relative;
|
||||
border-radius: 5px;
|
||||
|
||||
}
|
||||
.donate-memo{
|
||||
padding: 10px;
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
text-align: center;
|
||||
}
|
||||
#donate-close{
|
||||
float: right;
|
||||
padding: 0 5px;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#donate-close:hover{
|
||||
color: #bd4b4b;
|
||||
}
|
||||
.donate-qrpay{
|
||||
|
||||
}
|
||||
.donate-qrpay img{
|
||||
width: 280px;
|
||||
height: 280px;
|
||||
}
|
||||
input[name='pay']{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 244 KiB |
|
Before Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 206 KiB |
|
Before Width: | Height: | Size: 25 KiB |
@@ -1,30 +0,0 @@
|
||||
setTimeout(function(){
|
||||
initDonate()
|
||||
}, 1000);
|
||||
function initDonate(){
|
||||
var donateBtn = document.getElementById('donate-btn');
|
||||
var donatePopup = document.getElementById('qrcode-panel');
|
||||
if(!donateBtn && !donatePopup){
|
||||
return
|
||||
}
|
||||
var l = donateBtn.offsetLeft-125;
|
||||
var t = donateBtn.offsetTop-330;
|
||||
donatePopup.style.left=l+'px'
|
||||
donatePopup.style.top=t+'px'
|
||||
|
||||
donateBtn.addEventListener('click',function(){
|
||||
donatePopup.style.display='';
|
||||
event.stopPropagation()
|
||||
})
|
||||
document.getElementById('donate-close').addEventListener('click',function(){
|
||||
donatePopup.style.display='none';
|
||||
event.stopPropagation()
|
||||
})
|
||||
document.querySelector('body').addEventListener('click',function() {
|
||||
donatePopup.style.display='none';
|
||||
event.stopPropagation()
|
||||
});
|
||||
donatePopup.addEventListener('click',function() {
|
||||
event.stopPropagation()
|
||||
});
|
||||
}
|
||||
@@ -2,23 +2,20 @@
|
||||
<footer class="site--footer">
|
||||
<div class="site--footer__content">
|
||||
<div class=site--footer__sns>
|
||||
<?php $this->need('sns.php'); ?>
|
||||
</div>
|
||||
<?php $this->need('./module/sns.php'); ?>
|
||||
<?php //sitemap填入
|
||||
if($this->options->sitemapurl): ?>
|
||||
<a href="<?php $this->options->sitemapurl() ?>" target="_blank">💗</a>
|
||||
<?php endif; ?>
|
||||
<a href="https://www.typecho.org" target="_blank">Typecho驱动</a>
|
||||
<a href="https://www.imsun.org" target="_blank"> Made with Sun</a>
|
||||
<a href="<?php $this->options->sitemapurl() ?>" target="_blank" aria-label="网站地图"></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php //添加加载时间控制
|
||||
if ($this->options->showtime): ?>
|
||||
页面加载耗时<?php echo timer_stop();?>
|
||||
<?php endif; ?>
|
||||
<div class="copyright">
|
||||
<a href="<?php $this->options->siteUrl(); ?>">
|
||||
<?php $this->options->title(); ?>
|
||||
</a> ©
|
||||
<?php $this->options->jzyear() ?>-<?php echo date('Y'); ?>
|
||||
<?php endif; ?>
|
||||
<?php $this->options->tongji(); ?>
|
||||
<?php $stats = getSiteStatsWithCache(); ?>
|
||||
<div class="copyright"> © <?php echo $stats['siteCreateYear']; ?>-<?php echo date('Y'); ?>
|
||||
<?php $this->options->title(); ?> 💗 由 <a href="https://www.typecho.org" target="_blank"> Typecho </a> 驱动
|
||||
<svg class="icon icon--copryrights" viewBox="0 0 1040 1024" width="16" height="16">
|
||||
<path
|
||||
d="M717.056236 383.936299l-51.226708 0c-28.2893 0-51.226708 22.936385-51.226708 51.225685l0 128.062678c0 28.2893 22.937408 51.225685 51.226708 51.225685l51.226708 0c28.2893 0 51.225685-22.936385 51.225685-51.225685L768.281921 435.161984C768.281921 406.872684 745.345536 383.936299 717.056236 383.936299zM717.056236 537.611308c0 14.158465-11.480472 25.612331-25.613354 25.612331-14.132882 0-25.612331-11.453866-25.612331-25.612331l0-76.835969c0-14.158465 11.480472-25.613354 25.612331-25.613354 14.133905 0 25.613354 11.453866 25.613354 25.613354L717.056236 537.611308zM1013.977739 426.580538 859.776751 165.30079c-8.888438-15.063067-22.294772-25.975605-37.57171-32.080649-32.708959-34.856879-79.187527-56.638975-130.762159-56.638975L332.862064 76.581166c-51.575656 0-98.0532 21.782096-130.761136 56.639998-15.276938 6.105045-28.683273 17.017582-37.572734 32.079626L10.327206 426.580538c-21.26021 36.069497-8.655124 82.217537 28.239158 103.028515l115.00836 64.967664 0 199.163015c0 99.024318 80.264045 153.678078 179.287339 153.678078l358.580818 0c99.024318 0 179.290409-80.266092 179.290409-179.290409L870.733291 594.575694l115.00836-64.966641C1022.63184 508.798075 1035.238972 462.650035 1013.977739 426.580538zM153.574724 536.518417l-67.058278-37.875632c-24.589025-13.907755-33.019021-44.647873-18.809391-68.684312l85.86767-145.555074L153.574724 536.518417zM646.620024 127.807874c0 56.5786-60.205197 102.45137-134.467551 102.45137-74.261331 0-134.466528-45.873794-134.466528-102.45137L646.620024 127.807874zM819.507606 742.515071c0 84.893482-68.810179 153.677055-153.678078 153.677055L358.475418 896.192126c-84.8679 0-153.675008-68.783573-153.675008-153.677055l0-461.030142c0-76.150354 55.402821-139.361001 128.093377-151.545508 1.332345 83.883479 81.06734 151.545508 179.258687 151.545508 98.19237 0 177.926342-67.662029 179.25971-151.545508 72.690556 12.183484 128.096447 75.394131 128.096447 151.545508L819.508629 742.515071zM937.791569 498.642784l-67.058278 37.875632 0-252.111948 85.86767 145.552004C970.807521 453.995935 962.377524 484.736053 937.791569 498.642784z"
|
||||
@@ -26,7 +23,6 @@
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<?php $this->options->tongji(); ?>
|
||||
</footer>
|
||||
<div class="backToTop">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="svgIcon" viewBox="0 0 14 14" fill="currentColor" aria-hidden="true">
|
||||
@@ -35,7 +31,7 @@
|
||||
</path>
|
||||
</svg>
|
||||
</div>
|
||||
<script src="<?php $this->options->themeUrl('/dist/js/bundle.js'); ?>"></script>
|
||||
<script src="<?php $this->options->themeUrl('assets/js/bundle.js'); ?>"></script>
|
||||
<?php $this->footer(); ?>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="<?php $this->options->charset(); ?>">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<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="stylesheet" href="<?php $this->options->themeUrl('/dist/css/style.min.css'); ?>">
|
||||
), '', ' - '); ?>
|
||||
<?php $this->options->title(); ?><?php if ($this->is('index')) echo ' - '; ?>
|
||||
<?php if ($this->is('index')) $this->options->description() ?>
|
||||
</title>
|
||||
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/style.min.css'); ?>">
|
||||
<?php if ($this->options->icoUrl): ?>
|
||||
<link rel='icon' href='<?php $this->options->icoUrl() ?>' type='image/x-icon' />
|
||||
<?php endif; ?>
|
||||
@@ -25,7 +25,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<?php $this->options->addhead(); ?>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
<script>
|
||||
window.DEFAULT_THEME = "light";
|
||||
if (localStorage.getItem("theme") == null) {
|
||||
localStorage.setItem("theme", window.DEFAULT_THEME);
|
||||
@@ -39,39 +39,37 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
</script>
|
||||
<div class="main">
|
||||
<header class="site--header">
|
||||
<?php if ($this->options->logoUrl): ?>
|
||||
<a href="<?php $this->options->siteUrl(); ?>" class="site--url">
|
||||
<img src="<?php $this->options->logoUrl() ?>" class="avatar" alt="<?php $this->options->title() ?>" />
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<span class="u-xs-show">
|
||||
<a href="<?php $this->options->siteUrl(); ?>"><?php $this->options->title() ?></a>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<div class="site--header__center">
|
||||
<div class="inner">
|
||||
<nav>
|
||||
<ul>
|
||||
<?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
|
||||
<?php while($pages->next()): ?>
|
||||
<?php if ($this->options->logoUrl): ?>
|
||||
<a href="<?php $this->options->siteUrl(); ?>" class="site--url">
|
||||
<img src="<?php $this->options->logoUrl() ?>" class="avatar" alt="<?php $this->options->title() ?>" />
|
||||
</a>
|
||||
<span class="u-xs-show">
|
||||
<a href="<?php $this->options->siteUrl(); ?>"><?php $this->options->title() ?></a>
|
||||
</span>
|
||||
<?php else: ?>
|
||||
<span class="u-xs-show">
|
||||
<a href="<?php $this->options->siteUrl(); ?>"><?php $this->options->title() ?></a>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<div class="site--header__center">
|
||||
<div class="inner">
|
||||
<nav>
|
||||
<ul>
|
||||
<?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
|
||||
<?php while($pages->next()): ?>
|
||||
<li><a <?php if($this->is('page', $pages->slug)): ?> class="current"<?php endif; ?> href="<?php $pages->permalink(); ?>" title="<?php $pages->title(); ?>"><?php $pages->title(); ?></a></li>
|
||||
<?php endwhile; ?>
|
||||
</ul>
|
||||
</nav>
|
||||
<!-- 这年头谁会用站内的搜索啊 -->
|
||||
<div class="search--area">
|
||||
<form id="search" method="post" action="./" role="search" class="search-form">
|
||||
<label>
|
||||
<input type="text" name="s" class="search-field text" placeholder="Search" required/>
|
||||
</label>
|
||||
<button type="submit" class="search-submit submit">搜索</button>
|
||||
</form>
|
||||
<?php endwhile; ?>
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="search--area">
|
||||
<form id="search" method="post" action="./" role="search" class="search-form">
|
||||
<label>
|
||||
<input type="text" name="s" class="search-field text" placeholder="Search" required/>
|
||||
</label>
|
||||
<button type="submit" class="search-submit submit">搜索</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<svg class="svgIcon" width="25" height="25" data-action="show-search">
|
||||
<path
|
||||
d="M20.067 18.933l-4.157-4.157a6 6 0 1 0-.884.884l4.157 4.157a.624.624 0 1 0 .884-.884zM6.5 11c0-2.62 2.13-4.75 4.75-4.75S16 8.38 16 11s-2.13 4.75-4.75 4.75S6.5 13.62 6.5 11z">
|
||||
</path>
|
||||
</svg>
|
||||
</header>
|
||||
<svg class="svgIcon" width="25" height="25" data-action="show-search"><path d="M20.067 18.933l-4.157-4.157a6 6 0 1 0-.884.884l4.157 4.157a.624.624 0 1 0 .884-.884zM6.5 11c0-2.62 2.13-4.75 4.75-4.75S16 8.38 16 11s-2.13 4.75-4.75 4.75S6.5 13.62 6.5 11z"></path></svg>
|
||||
</header>
|
||||
@@ -1,17 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* 移植自HUGO主题 farallon 原作者 bigfa
|
||||
* 一款单栏主题.
|
||||
* 移植自HUGO主题 <a href="https://github.com/bigfa/Farallon">Farallon</a>
|
||||
* 原作者 bigfa
|
||||
* * 适配Typecho 1.3.0
|
||||
* @package Farallon
|
||||
* @author 老孙
|
||||
* @version 0.5.7
|
||||
* @version 0.8
|
||||
* @link https://www.imsun.org
|
||||
*/
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
||||
$this->need('header.php');
|
||||
?>
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<?php $this->need('module/sticky.php'); ?>
|
||||
<?php $this->need('header.php');?>
|
||||
<main class="site--main">
|
||||
<div class="articleList">
|
||||
<?php $this->need('postlist.php'); ?>
|
||||
</div>
|
||||
<div class="articleList">
|
||||
<?php $this->need('module/postlist.php'); ?>
|
||||
<?php $this->need('module/paging.php'); ?>
|
||||
</div>
|
||||
</main>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
@@ -0,0 +1,163 @@
|
||||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<div class="post--ingle__comments">
|
||||
<?php $this->comments()->to($comments); ?>
|
||||
<?php
|
||||
// 获取之前评论者的信息
|
||||
$previousAuthor = isset($_COOKIE['__typecho_remember_author']) ? htmlspecialchars($_COOKIE['__typecho_remember_author']) : '';
|
||||
$previousEmail = isset($_COOKIE['__typecho_remember_mail']) ? htmlspecialchars($_COOKIE['__typecho_remember_mail']) : '';
|
||||
$previousUrl = isset($_COOKIE['__typecho_remember_url']) ? htmlspecialchars($_COOKIE['__typecho_remember_url']) : '';
|
||||
|
||||
$language = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : '';
|
||||
if($this->allow('comment') && stripos($language, 'zh') > -1): ?>
|
||||
<?php if ($this->is('attachment')) : ?>
|
||||
<?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>
|
||||
<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('退出'); ?> »</a></p>
|
||||
<?php else: ?>
|
||||
<p class="comment-form-author">
|
||||
<input placeholder="称呼 *" type="text" name="author" id="author" class="text" value="<?php echo $previousAuthor; ?>" 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 echo $previousEmail; ?>"<?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 echo $previousUrl; ?>"<?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 endif; ?>
|
||||
<?php if ($comments->have()): ?>
|
||||
<?php $comments->listComments(); ?>
|
||||
<?php $comments->pageNav(
|
||||
' ',
|
||||
' ',
|
||||
1,
|
||||
'...',
|
||||
array(
|
||||
'wrapTag' => 'nav',
|
||||
'wrapClass' => 'nav-links nav-links__comment',
|
||||
'itemTag' => '',
|
||||
'textTag' => 'span',
|
||||
'itemClass' => 'page-numbers',
|
||||
'currentClass' => 'page-numbers current',
|
||||
'prevClass' => 'hidden',
|
||||
'nextClass' => 'hidden'
|
||||
)
|
||||
);
|
||||
?>
|
||||
<?php else: ?>
|
||||
<center><h3></h3></center>
|
||||
<?php endif; ?>
|
||||
<?php $this->options->twikoo(); ?>
|
||||
</div>
|
||||
<!-- 添加JavaScript代码 -->
|
||||
<script>
|
||||
document.getElementById('comment-form').addEventListener('submit', function() {
|
||||
// 获取表单数据
|
||||
var author = document.getElementById('author');
|
||||
var mail = document.getElementById('mail');
|
||||
var url = document.getElementById('url');
|
||||
|
||||
// 如果不是登录用户才保存cookie
|
||||
if (author && mail && url) {
|
||||
// 设置cookie,有效期30天
|
||||
setCookie('__typecho_remember_author', author.value, 30);
|
||||
setCookie('__typecho_remember_mail', mail.value, 30);
|
||||
setCookie('__typecho_remember_url', url.value, 30);
|
||||
}
|
||||
});
|
||||
// Cookie设置函数
|
||||
function setCookie(name, value, days) {
|
||||
var expires = '';
|
||||
if (days) {
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||
expires = '; expires=' + date.toUTCString();
|
||||
}
|
||||
document.cookie = name + '=' + encodeURIComponent(value) + expires + '; path=/';
|
||||
}
|
||||
</script>
|
||||
<?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;
|
||||
?>">
|
||||
<?php $commentApprove = commentApprove($comments, $comments->mail); ?>
|
||||
<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" title=" <?php echo $commentApprove['userDesc']; ?> ">
|
||||
<?php echo $comments->gravatar('40', ''); ?>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<?php echo $comments->gravatar('40', ''); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="comment--meta">
|
||||
<div class="comment--author">
|
||||
<span style="color: <?php echo $commentApprove['bgColor']; ?>;">
|
||||
<p class="tooltip" data-tooltip=" <?php echo $commentApprove['userLevel']; ?> ">
|
||||
<?php echo $comments->author; ?>
|
||||
</p>
|
||||
</span>
|
||||
<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 if ($comments->parent) {echo getPermalinkFromCoid($comments->parent);} $comments->content();?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($comments->children) { ?>
|
||||
<ol class="children">
|
||||
<?php $comments->threadedComments($options); ?>
|
||||
</ol>
|
||||
<?php } ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<div id="loadposts">
|
||||
<?php while($this->next()): ?>
|
||||
<article id="loadpost" class="post--item post--item__status" itemtype="http://schema.org/Article" itemscope="itemscope">
|
||||
<div class="content">
|
||||
<header>
|
||||
<img src="<?php $this->options->logoUrl() ?>" class="avatar" width="48" height="48" />
|
||||
<a datetime='<?php $this->date('Y-m-d'); ?>' class="humane--time" href="<?php $this->permalink() ?>"
|
||||
itemprop="datePublished">
|
||||
<?php $options = Helper::options();if ($options->friendlyTime == '1') {echo time_ago($this->created);} else {$this->date('Y-m-d H:i'); }?>
|
||||
</a>
|
||||
</header>
|
||||
<div class="description" itemprop="about">
|
||||
<?php $this->excerpt(200, '...'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
@@ -0,0 +1,8 @@
|
||||
<main class="site--main">
|
||||
<header class="archive-header archive-header__search">
|
||||
<div class="pagination">
|
||||
<h2>Sorry</h2>
|
||||
<p>很遗憾,未找到您期待的内容</p>
|
||||
</div>
|
||||
</header>
|
||||
</main>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php if ($this->options->loadmore): ?>
|
||||
<?php
|
||||
$this->pageNav(
|
||||
' ',
|
||||
' ',
|
||||
1,
|
||||
'...',
|
||||
array(
|
||||
'wrapTag' => 'nav',
|
||||
'wrapClass' => 'nav-links',
|
||||
'itemTag' => '',
|
||||
'textTag' => 'span',
|
||||
'itemClass' => 'page-numbers',
|
||||
'currentClass' => 'page-numbers current',
|
||||
'prevClass' => 'hidden',
|
||||
'nextClass' => 'hidden'
|
||||
)
|
||||
);
|
||||
?>
|
||||
<?php else:?>
|
||||
<?php
|
||||
$nextPage = $this->_currentPage + 1;
|
||||
$totalPages = ceil($this->getTotal() / $this->parameter->pageSize);
|
||||
if ($this->_currentPage < $totalPages):
|
||||
?>
|
||||
<div class="nav-links">
|
||||
<span class="loadmore"><?php $this->pageLink('加载更多', 'next'); ?></span>
|
||||
</div>
|
||||
<script src="<?php $this->options->themeUrl('assets/js/loadmore.js'); ?>"></script>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,88 @@
|
||||
<div id="loadposts">
|
||||
<?php while($this->next()): ?>
|
||||
<?php
|
||||
// 获取当前文章的分类
|
||||
$categories = $this->categories;
|
||||
$memosMid = $this->options->memos; // 获取主题设置中的说说分类 mid
|
||||
$isMemos = false;
|
||||
// 检查当前文章是否属于说说分类
|
||||
foreach ($categories as $category) {
|
||||
if ($category['mid'] == $memosMid) {
|
||||
$isMemos = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 根据是否为说说分类使用不同的显示模板
|
||||
if ($isMemos):
|
||||
?>
|
||||
<div id="loadpost">
|
||||
<article class="post--item post--item__status" itemtype="http://schema.org/Article" itemscope="itemscope">
|
||||
<div class="content">
|
||||
<header>
|
||||
<img src="<?php $this->options->logoUrl() ?>" class="avatar" width="48" height="48" />
|
||||
<a datetime='<?php $this->date('Y-m-d'); ?>' class="humane--time" href="<?php $this->permalink() ?>"
|
||||
itemprop="datePublished">
|
||||
<?php $options = Helper::options();if ($options->friendlyTime == '1') {echo time_ago($this->created);} else {$this->date('Y-m-d H:i'); }?>
|
||||
</a>
|
||||
</header>
|
||||
<div class="description" itemprop="about">
|
||||
<?php $this->excerpt(200, '...'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div id="loadpost">
|
||||
<article class="post--item" id="loadpost">
|
||||
<div class="content">
|
||||
<h2 class="post--title">
|
||||
<a href="<?php $this->permalink() ?>">
|
||||
<?php $this->title() ?><?php if (isset($this->isSticky) && $this->isSticky): ?><?php echo $this->stickyHtml; ?><?php endif; ?>
|
||||
<?php if((time() - $this->created) < 60*60*24*3): ?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
|
||||
class="icon--sticky" stroke="currentColor" stroke-width="2" stroke-linecap="round"
|
||||
stroke-linejoin="round" class="w-4 h-4 text-red-400">
|
||||
<path d="M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"></path>
|
||||
</svg>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
</h2>
|
||||
<div class="description">
|
||||
<?php
|
||||
if($this->fields->summary){
|
||||
echo $this->fields->summary;
|
||||
} else {
|
||||
$this->excerpt(180);
|
||||
}?>
|
||||
</div>
|
||||
<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>
|
||||
<time>
|
||||
<?php $options = Helper::options();if ($options->friendlyTime == '1') {echo time_ago($this->created);} else {$this->date('Y-m-d H:i'); }?>
|
||||
</time>
|
||||
<svg class="icon" viewBox="0 0 1024 1024" width="16" height="16"><path d="M408.551619 97.52381a73.142857 73.142857 0 0 1 51.736381 21.430857L539.306667 197.973333A73.142857 73.142857 0 0 0 591.067429 219.428571H804.571429a73.142857 73.142857 0 0 1 73.142857 73.142858v560.761904a73.142857 73.142857 0 0 1-73.142857 73.142857H219.428571a73.142857 73.142857 0 0 1-73.142857-73.142857V170.666667a73.142857 73.142857 0 0 1 73.142857-73.142857h189.123048z m0 73.142857H219.428571v682.666666h585.142858V292.571429h-213.504a146.285714 146.285714 0 0 1-98.499048-38.13181L487.619048 249.734095 408.551619 170.666667zM365.714286 633.904762v73.142857h-73.142857v-73.142857h73.142857z m365.714285 0v73.142857H414.47619v-73.142857h316.952381z m-365.714285-195.047619v73.142857h-73.142857v-73.142857h73.142857z m365.714285 0v73.142857H414.47619v-73.142857h316.952381z"></path></svg>
|
||||
<?php $this->category(','); ?>
|
||||
<svg class="icon" viewBox="0 0 24 24" width="16" height="16" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9ZM11 12C11 11.4477 11.4477 11 12 11C12.5523 11 13 11.4477 13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12Z" /><path fill-rule="evenodd" clip-rule="evenodd" d="M21.83 11.2807C19.542 7.15186 15.8122 5 12 5C8.18777 5 4.45796 7.15186 2.17003 11.2807C1.94637 11.6844 1.94361 12.1821 2.16029 12.5876C4.41183 16.8013 8.1628 19 12 19C15.8372 19 19.5882 16.8013 21.8397 12.5876C22.0564 12.1821 22.0536 11.6844 21.83 11.2807ZM12 17C9.06097 17 6.04052 15.3724 4.09173 11.9487C6.06862 8.59614 9.07319 7 12 7C14.9268 7 17.9314 8.59614 19.9083 11.9487C17.9595 15.3724 14.939 17 12 17Z" /></svg>
|
||||
<span class="article--views">
|
||||
<?php get_post_view($this) ?>
|
||||
</span>
|
||||
<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>
|
||||
<a href="<?php $this->permalink() ?>#comments"><?php $this->commentsNum('0 ', '1 ', '%d '); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$firstImage = img_postthumb($this->cid);
|
||||
$cover = $this->fields->cover;
|
||||
$imageToDisplay = !empty($cover) ? $cover : $firstImage;
|
||||
if($imageToDisplay):
|
||||
$imageToDisplay = process_cover_image($imageToDisplay);
|
||||
?>
|
||||
<a href="<?php $this->permalink() ?>" class="cover--link">
|
||||
<img src="<?php echo $imageToDisplay; ?>" alt="<?php $this->title() ?>" class="cover" itemprop="image"/>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</article>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
@@ -8,6 +8,6 @@
|
||||
<?php $this->options->description() ?>
|
||||
</div>
|
||||
<div class="author--sns">
|
||||
<?php $this->need('sns.php'); ?>
|
||||
<?php $this->need('./module/sns.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,8 +1,9 @@
|
||||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<div class="related--content">
|
||||
<?php $this->related(6)->to($relatedPosts); ?>
|
||||
<?php if ($relatedPosts->have()): ?>
|
||||
<h3 class="related--posts__title">相关文章</h3>
|
||||
<div class="post--single__related">
|
||||
<?php $this->related(6)->to($relatedPosts); ?>
|
||||
<?php while ($relatedPosts->next()): ?>
|
||||
<div class="post--single__related__item">
|
||||
<a href="<?php $relatedPosts->permalink(); ?>">
|
||||
@@ -18,4 +19,5 @@
|
||||
</div>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<a href="/feed" target="_blank">
|
||||
<a href="/feed" target="_blank" aria-label="RSS订阅">
|
||||
<svg class="sns" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M12 17C12 14 10 12 7 12" stroke-width="2.3" stroke-linecap="round" stroke-linejoin="round" />
|
||||
<path d="M17 17C17 11 13 7 7 7" stroke-width="2.3" stroke-linecap="round" stroke-linejoin="round" />
|
||||
@@ -10,7 +10,7 @@
|
||||
</svg>
|
||||
</a>
|
||||
<?php if($this->options->telegramurl): ?>
|
||||
<a href="<?php $this->options->telegramurl() ?>" target="_blank">
|
||||
<a href="<?php $this->options->telegramurl() ?>" target="_blank" aria-label="电报">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30px" height="30px">
|
||||
<path
|
||||
d="M 25.154297 3.984375 C 24.829241 3.998716 24.526384 4.0933979 24.259766 4.2011719 C 24.010014 4.3016357 23.055766 4.7109106 21.552734 5.3554688 C 20.048394 6.0005882 18.056479 6.855779 15.931641 7.7695312 C 11.681964 9.5970359 6.9042108 11.654169 4.4570312 12.707031 C 4.3650097 12.746607 4.0439208 12.849183 3.703125 13.115234 C 3.3623292 13.381286 3 13.932585 3 14.546875 C 3 15.042215 3.2360676 15.534319 3.5332031 15.828125 C 3.8303386 16.121931 4.144747 16.267067 4.4140625 16.376953 C 5.3912284 16.775666 8.4218473 18.015862 8.9941406 18.25 C 9.195546 18.866983 10.29249 22.222526 10.546875 23.044922 C 10.714568 23.587626 10.874198 23.927519 11.082031 24.197266 C 11.185948 24.332139 11.306743 24.45034 11.453125 24.542969 C 11.511635 24.579989 11.575789 24.608506 11.640625 24.634766 L 11.644531 24.636719 C 11.659471 24.642719 11.67235 24.652903 11.6875 24.658203 C 11.716082 24.668202 11.735202 24.669403 11.773438 24.677734 C 11.925762 24.726927 12.079549 24.757812 12.216797 24.757812 C 12.80196 24.757814 13.160156 24.435547 13.160156 24.435547 L 13.181641 24.419922 L 16.191406 21.816406 L 19.841797 25.269531 C 19.893193 25.342209 20.372542 26 21.429688 26 C 22.057386 26 22.555319 25.685026 22.875 25.349609 C 23.194681 25.014192 23.393848 24.661807 23.478516 24.21875 L 23.478516 24.216797 C 23.557706 23.798129 26.921875 6.5273437 26.921875 6.5273438 L 26.916016 6.5507812 C 27.014496 6.1012683 27.040303 5.6826405 26.931641 5.2695312 C 26.822973 4.8564222 26.536648 4.4608905 26.181641 4.2480469 C 25.826669 4.0352506 25.479353 3.9700339 25.154297 3.984375 z M 24.966797 6.0742188 C 24.961997 6.1034038 24.970391 6.0887279 24.962891 6.1230469 L 24.960938 6.1347656 L 24.958984 6.1464844 C 24.958984 6.1464844 21.636486 23.196371 21.513672 23.845703 C 21.522658 23.796665 21.481573 23.894167 21.439453 23.953125 C 21.379901 23.91208 21.257812 23.859375 21.257812 23.859375 L 21.238281 23.837891 L 16.251953 19.121094 L 12.726562 22.167969 L 13.775391 17.96875 C 13.775391 17.96875 20.331562 11.182109 20.726562 10.787109 C 21.044563 10.471109 21.111328 10.360953 21.111328 10.251953 C 21.111328 10.105953 21.035234 10 20.865234 10 C 20.712234 10 20.506484 10.14875 20.396484 10.21875 C 18.963383 11.132295 12.671823 14.799141 9.8515625 16.439453 C 9.4033769 16.256034 6.2896636 14.981472 5.234375 14.550781 C 5.242365 14.547281 5.2397349 14.548522 5.2480469 14.544922 C 7.6958673 13.491784 12.47163 11.434667 16.720703 9.6074219 C 18.84524 8.6937992 20.838669 7.8379587 22.341797 7.1933594 C 23.821781 6.5586849 24.850125 6.1218894 24.966797 6.0742188 z" />
|
||||
@@ -18,7 +18,7 @@
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if($this->options->twitterurl): ?>
|
||||
<a href="<?php $this->options->twitterurl() ?>" target="_blank">
|
||||
<a href="<?php $this->options->twitterurl() ?>" target="_blank" aria-label="推特">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30px" height="30px">
|
||||
<path
|
||||
d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z" />
|
||||
@@ -26,7 +26,7 @@
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if($this->options->instagramurl): ?>
|
||||
<a href="<?php $this->options->instagramurl() ?>" target="_blank">
|
||||
<a href="<?php $this->options->instagramurl() ?>" target="_blank" aria-label="Ins">
|
||||
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd"
|
||||
d="M10.825091,2 L13.1738932,2 C14.8491598,2.00379146 15.2338099,2.01854561 16.1226982,2.059103 C17.187141,2.10765278 17.9141174,2.27672349 18.5502266,2.52395815 C19.2078518,2.77948955 19.7655588,3.12144192 20.3215589,3.67740233 C20.8775194,4.23340244 21.2194717,4.79110953 21.4750428,5.44873467 C21.7222377,6.08484389 21.8913085,6.81182019 21.9398582,7.87626307 C21.9869049,8.90737346 21.9992305,9.25998097 22,11.7357029 L22,12.2632942 C21.9992305,14.7389803 21.9869049,15.0915878 21.9398582,16.1226982 C21.8913085,17.187141 21.7222377,17.9141174 21.4750428,18.5502266 C21.2194717,19.2078518 20.8775194,19.7655588 20.3215589,20.3215589 C19.7655588,20.8775194 19.2078518,21.2194717 18.5502266,21.4750428 C17.9141174,21.7222377 17.187141,21.8913085 16.1226982,21.9398582 C15.0915878,21.9869049 14.7389803,21.9992305 12.2632942,22 L11.7357029,22 C9.25998097,21.9992305 8.90737346,21.9869049 7.87626307,21.9398582 C6.81182019,21.8913085 6.08484389,21.7222377 5.44873467,21.4750428 C4.79110953,21.2194717 4.23340244,20.8775194 3.67740233,20.3215589 C3.12144192,19.7655588 2.77948955,19.2078518 2.52395815,18.5502266 C2.27672349,17.9141174 2.10765278,17.187141 2.059103,16.1226982 C2.01854561,15.2338099 2.00379146,14.8491598 2,13.1738932 L2,10.825091 C2.00379146,9.14980144 2.01854561,8.76515134 2.059103,7.87626307 C2.10765278,6.81182019 2.27672349,6.08484389 2.52395815,5.44873467 C2.77948955,4.79110953 3.12144192,4.23340244 3.67740233,3.67740233 C4.23340244,3.12144192 4.79110953,2.77948955 5.44873467,2.52395815 C6.08484389,2.27672349 6.81182019,2.10765278 7.87626307,2.059103 C8.76515134,2.01854561 9.14980144,2.00379146 10.825091,2 L13.1738932,2 L10.825091,2 Z M12.733046,3.80115495 L11.2659442,3.80115495 C9.25857953,3.80324073 8.90746344,3.81583469 7.95839674,3.85913648 C6.98335214,3.90359743 6.45383012,4.06651507 6.10143736,4.20347069 C5.63463704,4.38488726 5.30149746,4.60159471 4.95156594,4.95156594 C4.60159471,5.30149746 4.38488726,5.63463704 4.20347069,6.10143736 C4.06651507,6.45383012 3.90359743,6.98335214 3.85913648,7.95839674 C3.81583469,8.90746344 3.80324073,9.25857953 3.80115495,11.2659442 L3.80115495,12.733046 C3.80324073,14.7403818 3.81583469,15.0914978 3.85913648,16.0405646 C3.90359743,17.0156091 4.06651507,17.5451311 4.20347069,17.8975239 C4.38488726,18.3643242 4.60163441,18.6974638 4.95156594,19.0473953 C5.30149746,19.3973665 5.63463704,19.614074 6.10143736,19.7954906 C6.45383012,19.9324462 6.98335214,20.0953638 7.95839674,20.1398247 C9.0127962,20.1879378 9.32902474,20.1981401 11.9995005,20.1981401 C14.6699365,20.1981401 14.9862047,20.1879378 16.0405646,20.1398247 C17.0156091,20.0953638 17.5451311,19.9324462 17.8975239,19.7954906 C18.3643242,19.614074 18.6974638,19.3973665 19.0473953,19.0473953 C19.3973665,18.6974638 19.614074,18.3643242 19.7954906,17.8975239 C19.9324462,17.5451311 20.0953638,17.0156091 20.1398247,16.0405646 C20.1879378,14.986046 20.1981401,14.6697381 20.1981401,11.9995005 C20.1981401,9.32922322 20.1879378,9.0129153 20.1398247,7.95839674 C20.0953638,6.98335214 19.9324462,6.45383012 19.7954906,6.10143736 C19.614074,5.63463704 19.3973665,5.30149746 19.0473953,4.95156594 C18.6974638,4.60159471 18.3643242,4.38488726 17.8975239,4.20347069 C17.5451311,4.06651507 17.0156091,3.90359743 16.0405646,3.85913648 C15.0914978,3.81583469 14.7403818,3.80324073 12.733046,3.80115495 Z M11.9995,6.99920128 C14.7610764,6.99920128 16.99976,9.23788484 16.99976,11.9995 C16.99976,14.7610764 14.7610764,16.99976 11.9995,16.99976 C9.23788484,16.99976 6.99920128,14.7610764 6.99920128,11.9995 C6.99920128,9.23788484 9.23788484,6.99920128 11.9995,6.99920128 Z M11.9995,8.75368323 C10.2068679,8.75368323 8.75368323,10.2068679 8.75368323,11.9995 C8.75368323,13.7920934 10.2068679,15.245278 11.9995,15.245278 C13.7920934,15.245278 15.245278,13.7920934 15.245278,11.9995 C15.245278,10.2068679 13.7920934,8.75368323 11.9995,8.75368323 Z M17.4164293,5.33244149 C18.1068302,5.33244149 18.6665198,5.89213105 18.6665198,6.58253201 C18.6665198,7.27293296 18.1068302,7.83258117 17.4164293,7.83258117 C16.7260697,7.83258117 16.1663801,7.27293296 16.1663801,6.58253201 C16.1663801,5.89213105 16.7260697,5.33244149 17.4164293,5.33244149 Z" />
|
||||
@@ -34,18 +34,16 @@
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if($this->options->githuburl): ?>
|
||||
<a href="<?php $this->options->githuburl() ?>" target="_blank">
|
||||
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M20.9992 5.95846C21.0087 6.565 20.9333 7.32649 20.8658 7.8807C20.8395 8.09686 20.8037 8.27676 20.7653 8.42453C21.6227 10.01 22 11.9174 22 14C22 16.4684 20.8127 18.501 18.9638 19.8871C17.1319 21.2605 14.6606 22 12 22C9.33939 22 6.86809 21.2605 5.0362 19.8871C3.18727 18.501 2 16.4684 2 14C2 11.9174 2.37732 10.01 3.23472 8.42452C3.19631 8.27676 3.16055 8.09685 3.13422 7.8807C3.06673 7.32649 2.99133 6.565 3.00081 5.95846C3.01149 5.27506 3.10082 4.5917 3.19988 3.91379C3.24569 3.60028 3.31843 3.30547 3.65883 3.11917C4.00655 2.92886 4.37274 2.99981 4.73398 3.1021C5.95247 3.44713 7.09487 3.93108 8.16803 4.51287C9.2995 4.17287 10.5783 4 12 4C13.4217 4 14.7005 4.17287 15.832 4.51287C16.9051 3.93108 18.0475 3.44713 19.266 3.1021C19.6273 2.99981 19.9935 2.92886 20.3412 3.11917C20.6816 3.30547 20.7543 3.60028 20.8001 3.91379C20.8992 4.5917 20.9885 5.27506 20.9992 5.95846ZM20 14C20 12.3128 19.6122 10 17.5 10C16.5478 10 15.6474 10.2502 14.7474 10.5004C13.8482 10.7502 12.9495 11 12 11C11.0505 11 10.1518 10.7502 9.25263 10.5004C8.35261 10.2502 7.45216 10 6.5 10C4.39379 10 4 12.3197 4 14C4 15.7636 4.82745 17.231 6.23588 18.2869C7.66135 19.3556 9.69005 20 12 20C14.3099 20 16.3386 19.3555 17.7641 18.2869C19.1726 17.231 20 15.7636 20 14ZM10 14.5C10 15.8807 9.32843 17 8.5 17C7.67157 17 7 15.8807 7 14.5C7 13.1193 7.67157 12 8.5 12C9.32843 12 10 13.1193 10 14.5ZM15.5 17C16.3284 17 17 15.8807 17 14.5C17 13.1193 16.3284 12 15.5 12C14.6716 12 14 13.1193 14 14.5C14 15.8807 14.6716 17 15.5 17Z"
|
||||
fill="#000000" />
|
||||
<a href="<?php $this->options->githuburl() ?>" target="_blank" aria-label="github">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" 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 href="<?php $this->options->mastodonurl() ?>" target="_blank">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
|
||||
<path d="M433 179.1c0-97.2-63.7-125.7-63.7-125.7-62.5-28.7-228.6-28.4-290.5 0 0 0-63.7 28.5-63.7 125.7 0 115.7-6.6 259.4 105.6 289.1 40.5 10.7 75.3 13 103.3 11.4 50.8-2.8 79.3-18.1 79.3-18.1l-1.7-36.9s-36.3 11.4-77.1 10.1c-40.4-1.4-83-4.4-89.6-54a102.5 102.5 0 0 1 -.9-13.9c85.6 20.9 158.7 9.1 178.8 6.7 56.1-6.7 105-41.3 111.2-72.9 9.8-49.8 9-121.5 9-121.5zm-75.1 125.2h-46.6v-114.2c0-49.7-64-51.6-64 6.9v62.5h-46.3V197c0-58.5-64-56.6-64-6.9v114.2H90.2c0-122.1-5.2-147.9 18.4-175 25.9-28.9 79.8-30.8 103.8 6.1l11.6 19.5 11.6-19.5c24.1-37.1 78.1-34.8 103.8-6.1 23.7 27.3 18.4 53 18.4 175z"/>
|
||||
</svg>
|
||||
<a href="<?php $this->options->mastodonurl() ?>" target="_blank" aria-label="Mastodon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" 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; ?>
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
||||
$sticky = $this->options->sticky;
|
||||
$db = Typecho_Db::get();
|
||||
$pageSize = $this->options->pageSize;
|
||||
if ($sticky && !empty(trim($sticky))) {
|
||||
$sticky_cids = array_filter(explode('|', $sticky));
|
||||
if (!empty($sticky_cids)) {
|
||||
$sticky_html = " <span class='sticky--post'> 置顶 </span>";
|
||||
// 保存原始对象状态
|
||||
$originalRows = $this->row;
|
||||
$originalStack = $this->stack;
|
||||
$originalLength = $this->length;
|
||||
$totalOriginal = $this->getTotal();
|
||||
// 重置当前对象状态
|
||||
$this->row = [];
|
||||
$this->stack = [];
|
||||
$this->length = 0;
|
||||
// 关键修改:不再减少总文章数
|
||||
// 保持原始总数,这样分页逻辑不会受影响
|
||||
// $this->setTotal(max($totalOriginal - $stickyCount, 0));
|
||||
if (isset($this->currentPage) && $this->currentPage == 1) {
|
||||
// 查询置顶文章
|
||||
$selectSticky = $this->select()->where('type = ?', 'post');
|
||||
foreach ($sticky_cids as $i => $cid) {
|
||||
if ($i == 0)
|
||||
$selectSticky->where('cid = ?', $cid);
|
||||
else
|
||||
$selectSticky->orWhere('cid = ?', $cid);
|
||||
}
|
||||
$stickyPosts = $db->fetchAll($selectSticky);
|
||||
|
||||
// 添加置顶文章到结果集
|
||||
foreach ($stickyPosts as &$stickyPost) {
|
||||
$stickyPost['isSticky'] = true;
|
||||
$stickyPost['stickyHtml'] = $sticky_html;
|
||||
$this->push($stickyPost);
|
||||
}
|
||||
|
||||
// 计算当前页应显示的普通文章数量
|
||||
$standardPageSize = $pageSize - count($stickyPosts);
|
||||
|
||||
// 确保第一页不会显示太多文章
|
||||
if ($standardPageSize <= 0) {
|
||||
$standardPageSize = 0; // 如果置顶文章已经填满或超过一页,则不显示普通文章
|
||||
}
|
||||
} else {
|
||||
// 非第一页显示正常数量的文章
|
||||
$standardPageSize = $pageSize;
|
||||
}
|
||||
// 查询普通文章
|
||||
if ($this->currentPage == 1) {
|
||||
// 第一页需要排除置顶文章并限制数量
|
||||
$selectNormal = $this->select()
|
||||
->where('type = ?', 'post')
|
||||
->where('status = ?', 'publish')
|
||||
->where('created < ?', time());
|
||||
|
||||
// 排除所有置顶文章
|
||||
foreach ($sticky_cids as $cid) {
|
||||
$selectNormal->where('table.contents.cid != ?', $cid);
|
||||
}
|
||||
|
||||
$selectNormal->order('created', Typecho_Db::SORT_DESC)
|
||||
->limit($standardPageSize)
|
||||
->offset(0);
|
||||
} else {
|
||||
// 非第一页的查询
|
||||
// 计算正确的偏移量:(当前页码-1) * 每页数量 - 置顶文章数
|
||||
// 这样可以确保不会漏掉文章
|
||||
$offset = ($this->currentPage - 1) * $pageSize - count($sticky_cids);
|
||||
$offset = max($offset, 0); // 确保偏移量不为负
|
||||
|
||||
$selectNormal = $this->select()
|
||||
->where('type = ?', 'post')
|
||||
->where('status = ?', 'publish')
|
||||
->where('created < ?', time());
|
||||
|
||||
// 排除所有置顶文章
|
||||
foreach ($sticky_cids as $cid) {
|
||||
$selectNormal->where('table.contents.cid != ?', $cid);
|
||||
}
|
||||
|
||||
$selectNormal->order('created', Typecho_Db::SORT_DESC)
|
||||
->limit($pageSize)
|
||||
->offset($offset);
|
||||
}
|
||||
} else {
|
||||
// 没有有效的置顶文章ID,正常查询
|
||||
$selectNormal = $this->select()
|
||||
->where('type = ?', 'post')
|
||||
->where('status = ?', 'publish')
|
||||
->where('created < ?', time())
|
||||
->order('created', Typecho_Db::SORT_DESC)
|
||||
->page(isset($this->currentPage) ? $this->currentPage : 1, $pageSize);
|
||||
}
|
||||
} else {
|
||||
// 没有设置置顶文章,正常查询
|
||||
$selectNormal = $this->select()
|
||||
->where('type = ?', 'post')
|
||||
->where('status = ?', 'publish')
|
||||
->where('created < ?', time())
|
||||
->order('created', Typecho_Db::SORT_DESC)
|
||||
->page(isset($this->currentPage) ? $this->currentPage : 1, $pageSize);
|
||||
}
|
||||
// 添加私有文章查询条件
|
||||
if ($this->user->hasLogin()) {
|
||||
$uid = $this->user->uid;
|
||||
if ($uid) {
|
||||
$selectNormal->orWhere('authorId = ? AND status = ?', $uid, 'private');
|
||||
}
|
||||
}
|
||||
// 获取普通文章
|
||||
$normalPosts = $db->fetchAll($selectNormal);
|
||||
// 如果没有置顶文章或在前面的代码中没有重置对象状态,则在这里重置
|
||||
if (empty($sticky) || empty(trim($sticky)) || empty($sticky_cids)) {
|
||||
$this->row = [];
|
||||
$this->stack = [];
|
||||
$this->length = 0;
|
||||
}
|
||||
// 将普通文章添加到结果集
|
||||
foreach ($normalPosts as $normalPost) {
|
||||
$this->push($normalPost);
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<div class="post--cards" id="loadposts">
|
||||
<?php while($this->next()): ?>
|
||||
<?php // 获取文章图片
|
||||
$default_thumbnail = Helper::options()->themeUrl . '/assets/images/nopic.svg';
|
||||
$firstImage = img_postthumb($this->cid);
|
||||
if (empty($firstImage)) {
|
||||
$firstImage = $default_thumbnail;
|
||||
}
|
||||
$cover = $this->fields->cover;
|
||||
$imageToDisplay = $cover;
|
||||
if (empty($imageToDisplay)) {
|
||||
$imageToDisplay = $firstImage;
|
||||
}
|
||||
if (!empty($imageToDisplay) && $imageToDisplay != $default_thumbnail) {
|
||||
$imageToDisplay = process_cover_image($imageToDisplay);
|
||||
}
|
||||
?>
|
||||
<article class="post--card" id="loadpost">
|
||||
<img src="<?php echo $imageToDisplay; ?>" alt="<?php $this->title() ?>" class="cover" itemprop="image"/>
|
||||
<div class="content">
|
||||
<h2 class="post--title">
|
||||
<a href="<?php $this->permalink() ?>">
|
||||
<?php $this->title() ?>
|
||||
</a>
|
||||
</h2>
|
||||
<div class="description">
|
||||
<?php $this->excerpt(20, '...'); ?>
|
||||
</div>
|
||||
<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>
|
||||
<time datetime='<?php $this->date('Y-m-d'); ?>' class="humane--time">
|
||||
<?php $options = Helper::options();if ($options->friendlyTime == '1') {echo time_ago($this->created);} else {$this->date('Y-m-d H:i'); }?>
|
||||
</time>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
/**
|
||||
* 文章归档
|
||||
*
|
||||
@@ -11,11 +11,8 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||
<?php Typecho_Widget::widget('Widget_Stat')->to($quantity); ?>
|
||||
<h2 class="post--single__subtitle">共包含 <?php $quantity->publishedPostsNum(); ?> 篇文章</h2>
|
||||
<?php if ($this->options->showallwords): ?>
|
||||
<h3><?php echo allwords(); ?></h3>
|
||||
<?php endif; ?>
|
||||
</header>
|
||||
<div class="page--archive">
|
||||
</header>
|
||||
<div class="page--archive">
|
||||
<?php
|
||||
$stat = Typecho_Widget::widget('Widget_Stat');
|
||||
Typecho_Widget::widget('Widget_Contents_Post_Recent', 'pageSize=' . $stat->publishedPostsNum)->to($archives);
|
||||
@@ -23,7 +20,8 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
$output = '<div class="archives">'; // Start archives container
|
||||
while ($archives->next()) {
|
||||
$year_tmp = date('Y', $archives->created);
|
||||
$mon_tmp = date('m', $archives->created);
|
||||
$mon_tmp = date('m', $archives->created);
|
||||
|
||||
// 检查是否需要新的年份标题
|
||||
if ($year != $year_tmp) {
|
||||
if ($year > 0) {
|
||||
@@ -31,7 +29,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
}
|
||||
$year = $year_tmp;
|
||||
$mon = 0; // 重置月份
|
||||
$output .= '<div class="archive-year"><h2 class="archive--title__year">' . $year . '</h2>'; // 开始新的年份div
|
||||
$output .= '<div class="archive-year"><h2 class="archive--title__year">' . $year . '年</h2>'; // 开始新的年份div
|
||||
}
|
||||
// 检查是否需要新的月份标题
|
||||
if ($mon != $mon_tmp) {
|
||||
@@ -39,7 +37,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
$output .= '</ul>'; // 结束上一个月份的列表
|
||||
}
|
||||
$mon = $mon_tmp;
|
||||
$output .= '<h3 class="archive--title__month"></h3>';// '. $mon . '
|
||||
$output .= '<h3 class="archive--title__month">' . $mon . '月</h3>';
|
||||
$output .= '<ul class="archive--list">'; // 开始新的月份列表
|
||||
}
|
||||
// 输出文章项
|
||||
@@ -57,7 +55,6 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
$output .= '</div>'; // End archives container
|
||||
echo $output;
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
|
||||
<?php $this->need('footer.php'); ?>
|
||||
@@ -13,14 +13,13 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
</header>
|
||||
<section class="category--list">
|
||||
<?php $this->widget('Widget_Metas_Category_List')->to($categories); ?>
|
||||
<?php while($categories->next()): ?>
|
||||
<?php while($categories->next()): ?>
|
||||
<?php
|
||||
// 获取分类 ID
|
||||
$categoryId = $categories->mid;
|
||||
// 获取主题URL
|
||||
$themeUrl = $this->options->themeUrl;
|
||||
$themeUrl = $this->options->midimg;
|
||||
// 为每个分类生成图片地址
|
||||
$categoryImage = $themeUrl . '/dist/img/' . $categoryId . '.jpg';
|
||||
$categoryImage = $themeUrl . $categoryId . '.jpg';
|
||||
?>
|
||||
<div class="category--item">
|
||||
<img class="category--cover" src="<?php echo $categoryImage; ?>" loading="lazy" alt="<?php $categories->name(); ?>">
|
||||
@@ -31,7 +30,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endwhile; ?>
|
||||
<?php endwhile; ?>
|
||||
</section>
|
||||
</div>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
@@ -1,154 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 网站数据
|
||||
* @package custom
|
||||
*/
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
||||
$this->need('header.php');
|
||||
?>
|
||||
<section class="site--main">
|
||||
<header class="archive--header">
|
||||
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||
<h2 class="post--single__subtitle"><?php $this->content(); ?> </h2>
|
||||
</header>
|
||||
<article class="post--single">
|
||||
<div class="graph u-marginBottom30">
|
||||
<div data-target="<?php $this->options->postLinkOpen(); ?>" class="post-content">
|
||||
<h2>分类占比</h2>
|
||||
<p>下面是个分类的文章占比:</p>
|
||||
<div id="category-chart" style="height: 390px;"></div>
|
||||
<h2>文章更新</h2>
|
||||
<p>下面是 <?php echo date('Y年m月d日', time() - 20736000); ?> 到 <?php echo date('Y年m月d日', time()); ?> 的文章更新情况</p>
|
||||
<div id="post-chart" style="height: 250px;"></div>
|
||||
<h2>评论动态</h2>
|
||||
<p>下面是 <?php echo date('Y年m月d日', time() - 20736000); ?> 到 <?php echo date('Y年m月d日', time()); ?> 的评论动态</p>
|
||||
<div id="comment-chart" style="height: 250px;"></div>
|
||||
<h2>最多阅读的文章</h2>
|
||||
<?php $top5Post = top5post(); ?>
|
||||
<p>下面是阅读量排名前 <?php echo count($top5Post); ?> 的文章</p>
|
||||
<table class="pure-table pure-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>排名</th>
|
||||
<th>文章</th>
|
||||
<th>阅读量</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $top = 1; ?>
|
||||
<?php foreach ($top5Post as $post): ?>
|
||||
<tr>
|
||||
<td><?php echo $top; ?></td>
|
||||
<td><a href="<?php echo $post['link']; ?>"><?php echo $post['title']; ?></a></td>
|
||||
<td><?php echo $post['views']; ?></td>
|
||||
</tr>
|
||||
<?php $top ++; ?>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2>最多评论的文章</h2>
|
||||
<?php $top5CommentPost = top5CommentPost(); ?>
|
||||
<p>下面是评论数排名前 <?php echo count($top5CommentPost); ?> 的文章:</p>
|
||||
<table class="pure-table pure-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>排名</th>
|
||||
<th>文章</th>
|
||||
<th>评论数</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $top = 1; ?>
|
||||
<?php foreach ($top5CommentPost as $post): ?>
|
||||
<tr>
|
||||
<td><?php echo $top; ?></td>
|
||||
<td><a href="<?php echo $post['link']; ?>"><?php echo $post['title']; ?></a></td>
|
||||
<td><?php echo $post['commentsNum']; ?></td>
|
||||
</tr>
|
||||
<?php $top ++; ?>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
<script type="text/javascript">
|
||||
var data = {
|
||||
post: <?php echo json_encode(postCalendar(time() - 20736000, time())); ?>,
|
||||
comment: <?php echo json_encode(commentCalendar(time() - 20736000, time())); ?>,
|
||||
category: <?php echo json_encode(categoryPostCount()); ?>
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/jkjoy/typecho-theme-farallon@0.5.0/dist/js/chart.js"></script>
|
||||
<script id="MathJax-script" async src="https://jsd.onmicrosoft.cn/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||||
<script>
|
||||
// 配置 MathJax
|
||||
MathJax = {
|
||||
tex: {
|
||||
inlineMath: [['$', '$']],
|
||||
displayMath: [['$$', '$$']],
|
||||
processEscapes: true,
|
||||
processEnvironments: true,
|
||||
},
|
||||
options: {
|
||||
skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
|
||||
},
|
||||
};
|
||||
// 刷新预时重新渲染
|
||||
document.addEventListener('pjax:complete', () => {
|
||||
MathJax.typesetPromise();
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
td,th {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.pure-table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
empty-cells: show;
|
||||
border: 1px solid #cbcbcb;
|
||||
}
|
||||
|
||||
.pure-table caption {
|
||||
color: #000;
|
||||
font: italic 85%/1 arial,sans-serif;
|
||||
padding: 1em 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pure-table td,.pure-table th {
|
||||
border-left: 1px solid #cbcbcb;
|
||||
border-width: 0 0 0 1px;
|
||||
font-size: inherit;
|
||||
margin: 0;
|
||||
overflow: visible;
|
||||
padding: .5em 1em;
|
||||
}
|
||||
|
||||
.pure-table thead {
|
||||
background-color: #e0e0e0;
|
||||
color: #000;
|
||||
text-align: left;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.pure-table td {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.pure-table-bordered td {
|
||||
border-bottom: 1px solid #cbcbcb;
|
||||
}
|
||||
|
||||
.pure-table-bordered tbody>tr:last-child>td {
|
||||
border-bottom-width: 0;
|
||||
}
|
||||
</style>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<?php $this->need('header.php'); ?>
|
||||
<script src="<?php $this->options->themeUrl('/dist/js/db.js'); ?>"></script>
|
||||
<script src="<?php $this->options->themeUrl('assets/js/db.js'); ?>"></script>
|
||||
<section class="site--main">
|
||||
<header class="archive--header">
|
||||
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||
@@ -14,12 +14,18 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
</header>
|
||||
<div class="site--main">
|
||||
<div class="db--container"></div>
|
||||
<script>
|
||||
new Douban({
|
||||
baseAPI: '<?php $this->options->doubanID() ?>', // api
|
||||
container: ".db--container", // 容器名
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
// 获取自定义字段 douban 的值,如果不存在则使用默认值
|
||||
$douban = $this->fields->douban ? $this->fields->douban : 'https://db.imsun.org/';
|
||||
// 确保URL末尾只有一个斜杠
|
||||
$douban = rtrim($douban, '/') . '/';
|
||||
?>
|
||||
<script>
|
||||
new Douban({
|
||||
baseAPI: <?php echo json_encode($douban); ?>,
|
||||
container: ".db--container",
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</section>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
@@ -1,64 +1,87 @@
|
||||
<?php
|
||||
<?php
|
||||
/**
|
||||
* 好物页面
|
||||
*
|
||||
* @package custom
|
||||
*/
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<?php $this->need('header.php'); ?>
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
||||
$this->need('header.php');
|
||||
?>
|
||||
<div class="site--main site--main__gears">
|
||||
<header class="archive--header">
|
||||
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||
<h2 class="post--single__subtitle"><?php $this->content(); ?></h2>
|
||||
</header>
|
||||
<div id=goods class="good--list"></div>
|
||||
</div>
|
||||
<style>
|
||||
.img40 {
|
||||
height: 137px;
|
||||
width: auto;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
// 检查是否存在自定义字段 'memos' 和 'memosID'
|
||||
$memos = $this->fields->memos ? $this->fields->memos : 'https://memos.imsun.org';
|
||||
$memosID = $this->fields->memosID ? $this->fields->memosID : '1';
|
||||
$memostag = $this->fields->memostag ? $this->fields->memostag : '好物';
|
||||
?>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
memoGoods();
|
||||
});
|
||||
function memoGoods(e) {
|
||||
let t = e || 12;
|
||||
var n = "<?php echo $memos; ?>",
|
||||
s = n + "/api/v1/memo?creatorId=<?php echo $memosID; ?>&limit=" + t + "&tag=<?php echo $memostag; ?>";
|
||||
let i = 1;
|
||||
const o = /\n/;
|
||||
fetch(s).then(e => e.json()).then(e => {
|
||||
let c = "";
|
||||
for (var t, s, i, a, d, u, h, m, r = 0; r < e.length; r++) {
|
||||
a = e[r].content.replace(`#好物 \n`, ""),
|
||||
t = a.split(o),
|
||||
i = t[0].replace(/!\[.*?\]\((.*?)\)/g, "$1"), // 图片链接
|
||||
s = t[0].replace(/!\[(.*?)\]\(.*?\)/g, "$1"),
|
||||
d = s.split(",")[0], // 商品名称
|
||||
u = s.split(",")[1], // 价格
|
||||
h = t[1].replace(/\[.*?\]\((.*?)\)/g, "$1"), // 商品链接
|
||||
m = t[1].replace(/\[(.*?)\]\(.*?\)/g, "$1"), // 推荐理由
|
||||
c +=
|
||||
'<div class="good--item"><div class="img-spacer"><a href="'
|
||||
+ h +
|
||||
'" target="_blank"><img src="'
|
||||
+ i +
|
||||
'" class="img40"></a></div><div class="good--name"><div class="brand">'
|
||||
+ d + '·' + m +'</div>'
|
||||
+ u +
|
||||
'</div></div>';
|
||||
<header class="archive--header">
|
||||
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||
</header>
|
||||
<div id="goods" class="good--list">
|
||||
<?php
|
||||
// 获取内容并解析
|
||||
$content = $this->content;
|
||||
$goods = parseGoodsTable($content);
|
||||
if (!empty($goods)) {
|
||||
foreach ($goods as $item): ?>
|
||||
<div class="good--item">
|
||||
<div class="img-spacer">
|
||||
<a href="<?php echo htmlspecialchars($item['link']); ?>" target="_blank" rel="noopener noreferrer">
|
||||
<img src="<?php echo htmlspecialchars($item['image']); ?>" class="img40" alt="<?php echo htmlspecialchars($item['name']); ?>">
|
||||
</a>
|
||||
</div>
|
||||
<div class="good--name">
|
||||
<div class="brand">
|
||||
<?php echo htmlspecialchars($item['name']); ?>·<?php echo htmlspecialchars($item['description']); ?>
|
||||
</div>
|
||||
<?php echo htmlspecialchars($item['price']); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach;
|
||||
} else {
|
||||
echo '<div class="no-goods">暂无商品数据,请按照格式填写商品信息。</div>';
|
||||
}
|
||||
let f = document.querySelector("#goods");
|
||||
f.innerHTML = c;
|
||||
});
|
||||
?>
|
||||
</div>
|
||||
<?php if ($this->allow('comment')): ?>
|
||||
<?php $this->need('./module/comments.php'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<style>.img40{height:137px;width:auto;object-fit:cover;}.img-spacer{width:100%;aspect-ratio:1;overflow:hidden;}.brand{font-weight:500;margin-bottom:5px;}.no-goods{grid-column:1 / -1;text-align:center;padding:20px;background:#f5f5f5;border-radius:8px;}</style>
|
||||
<?php
|
||||
/**
|
||||
* 解析商品表格数据
|
||||
* @param string $content 页面内容
|
||||
* @return array 解析后的商品数据
|
||||
*/
|
||||
function parseGoodsTable($content) {
|
||||
$goods = array();
|
||||
// 创建DOM对象
|
||||
$dom = new DOMDocument();
|
||||
libxml_use_internal_errors(true); // 禁用libxml错误
|
||||
$dom->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
|
||||
libxml_clear_errors();
|
||||
// 查找表格
|
||||
$tables = $dom->getElementsByTagName('table');
|
||||
if ($tables->length > 0) {
|
||||
$table = $tables->item(0); // 获取第一个表格
|
||||
$rows = $table->getElementsByTagName('tr');
|
||||
// 跳过表头行
|
||||
for ($i = 1; $i < $rows->length; $i++) {
|
||||
$row = $rows->item($i);
|
||||
$cells = $row->getElementsByTagName('td');
|
||||
// 确保有足够的单元格
|
||||
if ($cells->length >= 5) {
|
||||
$item = array(
|
||||
'image' => trim($cells->item(0)->textContent),
|
||||
'name' => trim($cells->item(1)->textContent),
|
||||
'price' => trim($cells->item(2)->textContent),
|
||||
'link' => trim($cells->item(3)->textContent),
|
||||
'description' => trim($cells->item(4)->textContent)
|
||||
);
|
||||
|
||||
// 确保必要字段不为空
|
||||
if (!empty($item['image']) && !empty($item['name'])) {
|
||||
$goods[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $goods;
|
||||
}
|
||||
</script>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
$this->need('footer.php');
|
||||
?>
|
||||
@@ -11,22 +11,15 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||
<h2 class="post--single__subtitle"><?php $this->content(); ?> </h2>
|
||||
</header>
|
||||
<div class="graph u-marginBottom30">
|
||||
<?php $this->content(); ?>
|
||||
</div>
|
||||
<div class="template--linksWrap">
|
||||
<ul class="link-items">
|
||||
<?php
|
||||
Links_Plugin::output('<li class="link-item"><a class="link-item-inner effect-apollo" href="{url}" target="_blank">
|
||||
<span class="sitename"><strong>{name}</strong>{title}</span>
|
||||
</a></li>');
|
||||
?>
|
||||
</ul>
|
||||
<?php Links_Plugin::output('<li class="link-item"><a class="link-item-inner effect-apollo" href="{url}" target="_blank"><span class="sitename"><strong>{name}</strong>{title}</span></a></li>'); ?>
|
||||
</ul>
|
||||
</div>
|
||||
<article class="post--single">
|
||||
<?php if ($this->allow('comment')): ?>
|
||||
<?php $this->need('comments.php'); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->allow('comment')): ?>
|
||||
<?php $this->need('module/comments.php'); ?>
|
||||
<?php endif; ?>
|
||||
</article>
|
||||
</section>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
@@ -13,9 +13,9 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
</header>
|
||||
<article class="post--single">
|
||||
<?php $tooot = $this->fields->tooot ? $this->fields->tooot : 'https://bbapi.ima.cm'; ?>
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.umd.js"></script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.css" />
|
||||
<script src="<?php $this->options->themeUrl('assets/js/marked.min.js'); ?>"></script>
|
||||
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/lightbox.min.css'); ?>">
|
||||
<script src="<?php $this->options->themeUrl('assets/js/lightbox-plus-jquery.min.js'); ?>"></script>
|
||||
<div id="tooot"></div>
|
||||
<div class="nav-links" id="loadmore">
|
||||
<span class="loadmore">加载更多</span>
|
||||
@@ -25,16 +25,24 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
window.onload = function() {
|
||||
let offset = 0; // 初始偏移量
|
||||
const limit = 20; // 每次加载的数量
|
||||
|
||||
function formatHTML(toots) {
|
||||
let htmlString = '';
|
||||
toots.forEach(toot => {
|
||||
const { content, account, url, created_at, media_attachments} = toot;
|
||||
// 判断是否存在 reblog
|
||||
const isReblog = toot.reblog && toot.reblog.content;
|
||||
const content = isReblog ? toot.reblog.content : toot.content;
|
||||
const url = isReblog ? toot.reblog.url : toot.url;
|
||||
const account = isReblog ? toot.reblog.account : toot.account;
|
||||
const created_at = isReblog ? toot.reblog.created_at : toot.created_at;
|
||||
const media_attachments = isReblog ? toot.reblog.media_attachments : toot.media_attachments;
|
||||
|
||||
let mediaHTML = ''; // 初始化资源相关HTML为空字符串
|
||||
// 处理媒体附件
|
||||
if (media_attachments.length > 0) {
|
||||
media_attachments.forEach(attachment => {
|
||||
if (attachment.type === 'image') {
|
||||
mediaHTML += `<a href="${attachment.url}" target="_blank"><img src="${attachment.preview_url}" data-fancybox="img" class="thumbnail-image img"></a>`;
|
||||
mediaHTML += `<a href="${attachment.url}" target="_blank" data-lightbox="image-set"><img src="${attachment.preview_url}" class="thumbnail-image img" ></a>`;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -45,7 +53,7 @@ window.onload = function() {
|
||||
<article class='post--item post--item__status'>
|
||||
<div class='content'>
|
||||
<header>
|
||||
<img src="${account.avatar}" class="avatar" width="48" height="48" />
|
||||
<img src="${account.avatar}" class="avatar" width="48" height="48" no-view />
|
||||
<a class="humane--time" href="${url}" target="_blank">${new Date(created_at).toLocaleString()}</a>
|
||||
</header>
|
||||
<div class="description" itemprop="about">
|
||||
@@ -82,17 +90,12 @@ window.onload = function() {
|
||||
// 绑定“加载更多”按钮的点击事件
|
||||
document.getElementById('loadmore').addEventListener('click', fetchAndDisplayToots);
|
||||
};
|
||||
Fancybox.bind("[data-fancybox]", {
|
||||
// Your custom options
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
div pre code {
|
||||
/* 迫使文字断行 */
|
||||
white-space: pre-wrap; /* CSS3 */
|
||||
word-wrap: break-word; /* 老版本的浏览器 */
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
overflow-wrap: break-word;
|
||||
/* 指定如何断行 */
|
||||
word-break: break-all;
|
||||
word-break: break-word;
|
||||
}
|
||||
@@ -143,33 +146,6 @@ img {
|
||||
height: 480px;
|
||||
}
|
||||
}
|
||||
.load-more-btn {
|
||||
display: block;
|
||||
margin: 20px auto;
|
||||
padding: 10px 20px;
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.load-more-btn:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
.nav-links .loadmore {
|
||||
border: 1px solid var(--farallon-border-color);
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
padding: 5px 30px;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
color: var(--farallon-text-gray)
|
||||
}
|
||||
|
||||
.nav-links .loadmore:hover {
|
||||
border-color: var(--farallon-hover-color);
|
||||
color: var(--farallon-hover-color)
|
||||
}
|
||||
</style>
|
||||
</div>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
|
||||
@@ -13,20 +13,27 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
</header>
|
||||
<?php
|
||||
// 检查是否存在自定义字段 'memos' 和 'memosID'
|
||||
$memos = $this->fields->memos ? $this->fields->memos : 'https://memos.loliko.cn';
|
||||
$memos = $this->fields->memos ? $this->fields->memos : 'https://memos.imsun.org';
|
||||
$memosID = $this->fields->memosID ? $this->fields->memosID : '1';
|
||||
$memosnum = $this->fields->memosnum ? $this->fields->memosnum : '20';
|
||||
?>
|
||||
?>
|
||||
<article class="post--single">
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.umd.js"></script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.css" />
|
||||
<script src="<?php $this->options->themeUrl('assets/js/marked.min.js'); ?>"></script>
|
||||
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/lightbox.min.css'); ?>">
|
||||
<script src="<?php $this->options->themeUrl('assets/js/lightbox-plus-jquery.min.js'); ?>"></script>
|
||||
<div id="talk"></div>
|
||||
<div class="nav-links" id="loadmore">
|
||||
<span class="loadmore">加载更多</span>
|
||||
</div>
|
||||
</article>
|
||||
<script>
|
||||
if (99) {
|
||||
let url = '<?php echo $memos; ?>';
|
||||
fetch(url + '/api/v1/memo?creatorId=<?php echo $memosID; ?>&rowStatus=NORMAL&limit=<?php echo $memosnum; ?>')
|
||||
let currentPage = 1; // 当前页码
|
||||
const limit = 10; // 每页条数
|
||||
let url = '<?php echo $memos; ?>';
|
||||
let memosID = '<?php echo $memosID; ?>';
|
||||
let memosnum = '<?php echo $memosnum; ?>';
|
||||
function loadMemos(page) {
|
||||
fetch(`${url}/api/v1/memo?creatorId=${memosID}&rowStatus=NORMAL&limit=${limit}&offset=${(page - 1) * limit}`)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
let html = '';
|
||||
@@ -38,7 +45,7 @@ if (99) {
|
||||
<article class='post--item post--item__status'>
|
||||
<div class='content'>
|
||||
<header>
|
||||
<img src="<?php $this->options->logoUrl() ?>" class="avatar" width="48" height="48" />
|
||||
<img src="<?php $this->options->logoUrl() ?>" class="avatar" width="48" height="48" no-view />
|
||||
<a class="humane--time" href="${memoURL}" target="_blank">${data.date}</a>
|
||||
</header>
|
||||
<div class="description" itemprop="about">
|
||||
@@ -49,57 +56,61 @@ if (99) {
|
||||
</article>
|
||||
`;
|
||||
});
|
||||
document.getElementById('talk').innerHTML = html;
|
||||
document.getElementById('talk').innerHTML += html;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
// 这里可以添加一些用户提示错误发生的 HTML 更新
|
||||
});
|
||||
function Format(item) {
|
||||
let date = getTime(new Date(item.createdTs * 1000).toString()),
|
||||
content = item.content,
|
||||
tag = item.content.match(/#([^\s#]+?) /g),
|
||||
imgs = content.match(/!\[.*\]\(.*?\)/g),
|
||||
text = ''
|
||||
if (imgs) imgs = imgs.map(item => { return item.replace(/!\[.*\]\((.*?)\)/, '$1') })
|
||||
if (item.resourceList.length) {
|
||||
if (!imgs) imgs = []
|
||||
item.resourceList.forEach(t => {
|
||||
if (t.externalLink) imgs.push(t.externalLink)
|
||||
else imgs.push(`${url}/o/r/${t.id}/${t.publicId}/${t.filename}`)
|
||||
})
|
||||
}
|
||||
text = content.replace(/#(.*?)\s/g, '').replace(/\!?\[(.*?)\]\((.*?)\)/g, '').replace(/\{(.*?)\}/g, '')
|
||||
content = text.replace(/\[(.*?)\]\((.*?)\)/g, `<a href="$2" target="_blank">$1</a>`);
|
||||
if (imgs) {
|
||||
content += `<div class="resimg">`
|
||||
imgs.forEach(e => content += `<a href="${e}" data-fancybox="gallery" class="fancybox img" data-thumb="${e}"><img class="no-lazyload thumbnail-image" src="${e}"></a>`
|
||||
)
|
||||
content += '</div>'
|
||||
}
|
||||
return {
|
||||
content: content,
|
||||
tag: tag ? tag[0].replace(/#([^\s#]+?) /,'$1') : '日常',
|
||||
date: date,
|
||||
text: text.replace(/\[(.*?)\]\((.*?)\)/g, '[链接]' + `${imgs?'[图片]':''}`)
|
||||
}
|
||||
}
|
||||
function Format(item) {
|
||||
let date = getTime(new Date(item.createdTs * 1000).toString()),
|
||||
content = item.content,
|
||||
tag = item.content.match(/#([^\s#]+?) /g),
|
||||
imgs = content.match(/!\[.*\]\(.*?\)/g),
|
||||
text = ''
|
||||
if (imgs) imgs = imgs.map(item => { return item.replace(/!\[.*\]\((.*?)\)/, '$1') })
|
||||
if (item.resourceList.length) {
|
||||
if (!imgs) imgs = []
|
||||
item.resourceList.forEach(t => {
|
||||
if (t.externalLink) imgs.push(t.externalLink)
|
||||
else imgs.push(`${url}/o/r/${t.id}/${t.publicId}/${t.filename}`)
|
||||
})
|
||||
}
|
||||
// 页面时间格式化
|
||||
function getTime(time) {
|
||||
let d = new Date(time),
|
||||
ls = [d.getFullYear(), d.getMonth() + 1, d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds()];
|
||||
for (let i = 0; i < ls.length; i++) {
|
||||
ls[i] = ls[i] <= 9 ? '0' + ls[i] : ls[i] + ''
|
||||
}
|
||||
if (new Date().getFullYear() == ls[0]) return ls[1] + '月' + ls[2] + '日 ' + ls[3] +':'+ ls[4]
|
||||
else return ls[0] + '年' + ls[1] + '月' + ls[2] + '日 ' + ls[3] +':'+ ls[4]
|
||||
text = content.replace(/#(.*?)\s/g, '').replace(/\!?\[(.*?)\]\((.*?)\)/g, '').replace(/\{(.*?)\}/g, '')
|
||||
content = text.replace(/\[(.*?)\]\((.*?)\)/g, `<a href="$2" target="_blank">$1</a>`);
|
||||
if (imgs) {
|
||||
content += `<div class="resimg">`
|
||||
imgs.forEach(e => content += `<a href="${e}" class="img" data-thumb="${e}" data-lightbox="images"><img class="no-lazyload thumbnail-image" src="${e}"></a>`
|
||||
)
|
||||
content += '</div>'
|
||||
}
|
||||
return {
|
||||
content: content,
|
||||
tag: tag ? tag[0].replace(/#([^\s#]+?) /,'$1') : '日常',
|
||||
date: date,
|
||||
text: text.replace(/\[(.*?)\]\((.*?)\)/g, '[链接]' + `${imgs?'[图片]':''}`)
|
||||
}
|
||||
}
|
||||
Fancybox.bind("[data-fancybox]", {
|
||||
// Your custom options
|
||||
// 页面时间格式化
|
||||
function getTime(time) {
|
||||
let d = new Date(time),
|
||||
ls = [d.getFullYear(), d.getMonth() + 1, d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds()];
|
||||
for (let i = 0; i < ls.length; i++) {
|
||||
ls[i] = ls[i] <= 9 ? '0' + ls[i] : ls[i] + ''
|
||||
}
|
||||
if (new Date().getFullYear() == ls[0]) return ls[1] + '月' + ls[2] + '日 ' + ls[3] +':'+ ls[4]
|
||||
else return ls[0] + '年' + ls[1] + '月' + ls[2] + '日 ' + ls[3] +':'+ ls[4]
|
||||
}
|
||||
// 初始加载第一页
|
||||
loadMemos(currentPage);
|
||||
// 点击“加载更多”按钮时加载下一页
|
||||
document.getElementById('loadmore').addEventListener('click', function() {
|
||||
currentPage++;
|
||||
loadMemos(currentPage);
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
<style>
|
||||
div pre code {
|
||||
/* 迫使文字断行 */
|
||||
white-space: pre-wrap; /* CSS3 */
|
||||
@@ -149,7 +160,7 @@ img {
|
||||
.resimg {
|
||||
grid-template-columns: 1fr; /* 修改为一列 */
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</div>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Neodb 页面
|
||||
*
|
||||
* @package custom
|
||||
*/
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<?php $this->need('header.php'); ?>
|
||||
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/neodb.css'); ?>">
|
||||
<script src="<?php $this->options->themeUrl('assets/js/neodb.js'); ?>"></script>
|
||||
<section class="site--main">
|
||||
<header class="archive--header">
|
||||
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||
<h2 class="post--single__subtitle"><?php $this->content(); ?></h2>
|
||||
</header>
|
||||
<div class="site--main">
|
||||
<div class="neodb-container"></div>
|
||||
<?php $neodb = $this->fields->neodb ? $this->fields->neodb : 'https://neodb.imsun.org'; ?>
|
||||
<script>
|
||||
const neodb = new NeoDB({
|
||||
container: ".neodb-container",
|
||||
baseAPI: "<?php echo $neodb; ?>/api",
|
||||
types: ["book", "movie", "tv", "music", "game"],
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</section>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
@@ -12,18 +12,22 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<h2 class="post--single__subtitle"><?php $this->content(); ?> </h2>
|
||||
</header>
|
||||
<div class="post-content">
|
||||
<?php $this->widget('Widget_Metas_Tag_Cloud', 'sort=mid&ignoreZeroCount=1&desc=0')->to($tags); ?>
|
||||
<?php if($tags->have()): ?>
|
||||
<div class="archive--tagList">
|
||||
<?php while ($tags->next()): ?>
|
||||
<span class="archive--tagItem">
|
||||
<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(); ?> (<?php $tags->count(); ?>)</a>
|
||||
</span>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<p class="text-center pb-2"><?php _e('没有任何标签'); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php $this->widget('Widget_Metas_Tag_Cloud', 'sort=mid&ignoreZeroCount=1&desc=0')->to($tags); ?>
|
||||
<?php if($tags->have()): ?>
|
||||
<div class="archive--tagList">
|
||||
<?php while ($tags->next()): ?>
|
||||
<span class="archive--tagItem">
|
||||
<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(); ?> (<?php $tags->count(); ?>)
|
||||
</a>
|
||||
</span>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div style="display: grid; place-items: center;">
|
||||
<p style="padding-bottom: 2px;"><?php _e('暂无标签'); ?></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 说说页面 - 时光机
|
||||
*
|
||||
* @package custom
|
||||
*/
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<?php $this->need('header.php'); ?>
|
||||
<section class="site--main">
|
||||
<header class="archive--header">
|
||||
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||
<h2 class="post--single__subtitle"><?php $this->content(); ?> </h2>
|
||||
</header>
|
||||
<article class="post--single">
|
||||
<?php $this->need('times/dycomment.php'); ?>
|
||||
</article>
|
||||
</section>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
@@ -10,10 +10,8 @@
|
||||
</div>
|
||||
<!-- 判断如果禁止评论则不显示评论的div -->
|
||||
<?php if ($this->allow('comment')): ?>
|
||||
<?php $this->need('comments.php'); ?>
|
||||
<?php $this->need('./module/comments.php'); ?>
|
||||
<?php endif; ?>
|
||||
<!-- 可以使用第三方评论-->
|
||||
<?php $this->options->twikoo(); ?>
|
||||
</article>
|
||||
</section>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<?php $this->need('header.php'); ?>
|
||||
<style>
|
||||
#toc {font-size:14px;padding:10px 15px;background-color:var(--farallon-background-gray);border-radius:10px;margin-bottom:20px}
|
||||
#toc summary{cursor:pointer}
|
||||
#toc toc-title{font-weight:600}
|
||||
#toc ul{padding-left:10px;margin-bottom:10px}
|
||||
#toc ul li::before{content:"·";margin-right:5px}
|
||||
#toc ul li>ul{margin-left:10px;font-size:12px}
|
||||
</style>
|
||||
<style>#toc{font-size:14px;padding:10px 15px;background-color:var(--farallon-background-gray);border-radius:10px;margin-bottom:20px}#toc summary{cursor:pointer}#toc toc-title{font-weight:600}#toc ul{padding-left:10px;margin-bottom:10px}#toc ul li::before{content:"·";margin-right:5px}#toc ul li>ul{margin-left:10px;font-size:12px}</style>
|
||||
<main class="site--main">
|
||||
<article class="post--single">
|
||||
<ul class="meta">
|
||||
@@ -16,7 +9,7 @@
|
||||
<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><time class="humane--time"><?php $this->date('Y-m-d'); ?></time>
|
||||
</svg><time class="humane--time"><?php $options = Helper::options();if ($options->friendlyTime == '1') {echo time_ago($this->created);} else {$this->date('Y-m-d H:i'); }?></time>
|
||||
<svg class="icon" viewBox="0 0 1024 1024" width="16" height="16">
|
||||
<path
|
||||
d="M408.551619 97.52381a73.142857 73.142857 0 0 1 51.736381 21.430857L539.306667 197.973333A73.142857 73.142857 0 0 0 591.067429 219.428571H804.571429a73.142857 73.142857 0 0 1 73.142857 73.142858v560.761904a73.142857 73.142857 0 0 1-73.142857 73.142857H219.428571a73.142857 73.142857 0 0 1-73.142857-73.142857V170.666667a73.142857 73.142857 0 0 1 73.142857-73.142857h189.123048z m0 73.142857H219.428571v682.666666h585.142858V292.571429h-213.504a146.285714 146.285714 0 0 1-98.499048-38.13181L487.619048 249.734095 408.551619 170.666667zM365.714286 633.904762v73.142857h-73.142857v-73.142857h73.142857z m365.714285 0v73.142857H414.47619v-73.142857h316.952381z m-365.714285-195.047619v73.142857h-73.142857v-73.142857h73.142857z m365.714285 0v73.142857H414.47619v-73.142857h316.952381z">
|
||||
@@ -36,115 +29,91 @@
|
||||
</g>
|
||||
</svg> <a href="<?php $this->permalink() ?>#comments"><?php $this->commentsNum('0 ', '1 ', '%d '); ?></a>
|
||||
<?php if($this->user->hasLogin() && $this->user->pass('editor', true)): ?>
|
||||
<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 href="<?php $this->options->adminUrl('write-post.php?cid=' . $this->cid); ?>" target="_blank" title="编辑文章">Edit</a>
|
||||
<svg class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" fill="currentColor">
|
||||
<path d="M16.7574 2.99677L14.7574 4.99677H5V18.9968H19V9.23941L21 7.23941V19.9968C21 20.5491 20.5523 20.9968 20 20.9968H4C3.44772 20.9968 3 20.5491 3 19.9968V3.99677C3 3.44448 3.44772 2.99677 4 2.99677H16.7574ZM20.4853 2.09727L21.8995 3.51149L12.7071 12.7039L11.2954 12.7063L11.2929 11.2897L20.4853 2.09727Z">
|
||||
</path>
|
||||
</svg>
|
||||
<a href="<?php $this->options->adminUrl('write-post.php?cid=' . $this->cid); ?>" target="_blank" title="编辑文章">Edit</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<h2 class="post--single__title"><?php $this->title() ?></h2>
|
||||
<div class="post--single__content graph" ><?php $this->content(); ?></div>
|
||||
<?php if($this->options->donate): ?>
|
||||
<div class="post--single__content graph" ><?php //$this->content(); ?><?php echo ContentFilter::filterContent($this->content, $this, null); ?></div>
|
||||
<?php if($this->options->wxpay): ?>
|
||||
<!--打赏 -->
|
||||
<div class="post--single__action">
|
||||
<link rel="stylesheet" href="<?php $this->options->themeUrl('/dist/css/donate.css'); ?>">
|
||||
<script type="text/javascript" src="<?php $this->options->themeUrl('/dist/js/donate.js'); ?>"></script>
|
||||
<div class="donate-panel">
|
||||
<div id="donate-btn">
|
||||
<button class="button--like">
|
||||
<svg class="icon--default" viewBox="0 0 1024 1024" width="32" height="32">
|
||||
<path
|
||||
d="M332.8 249.6c38.4 0 83.2 19.2 108.8 44.8L467.2 320 512 364.8 556.8 320l25.6-25.6c32-32 70.4-44.8 108.8-44.8 19.2 0 38.4 6.4 57.6 12.8 44.8 25.6 70.4 57.6 76.8 108.8 6.4 44.8-6.4 89.6-38.4 121.6L512 774.4 236.8 492.8C204.8 460.8 185.6 416 192 371.2c6.4-44.8 38.4-83.2 76.8-108.8C288 256 313.6 249.6 332.8 249.6L332.8 249.6M332.8 185.6C300.8 185.6 268.8 192 243.2 204.8 108.8 275.2 89.6 441.6 185.6 537.6l281.6 281.6C480 832 499.2 838.4 512 838.4s32-6.4 38.4-19.2l281.6-281.6c96-96 76.8-262.4-57.6-332.8-25.6-12.8-57.6-19.2-89.6-19.2-57.6 0-115.2 25.6-153.6 64L512 275.2 486.4 249.6C448 211.2 390.4 185.6 332.8 185.6L332.8 185.6z">
|
||||
</path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div id="qrcode-panel" style="display: none;">
|
||||
<div class="qrcode-body">
|
||||
<div class="donate-memo">
|
||||
<span id="donate-close">关闭</span>
|
||||
</div>
|
||||
<div class="donate-qrpay">
|
||||
<img id="wxqr" src="<?php $this->options->donate() ?>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="button--like" onclick="openModal()">
|
||||
<svg class="icon--default" viewBox="0 0 1024 1024" width="32" height="32"><path d="M332.8 249.6c38.4 0 83.2 19.2 108.8 44.8L467.2 320 512 364.8 556.8 320l25.6-25.6c32-32 70.4-44.8 108.8-44.8 19.2 0 38.4 6.4 57.6 12.8 44.8 25.6 70.4 57.6 76.8 108.8 6.4 44.8-6.4 89.6-38.4 121.6L512 774.4 236.8 492.8C204.8 460.8 185.6 416 192 371.2c6.4-44.8 38.4-83.2 76.8-108.8C288 256 313.6 249.6 332.8 249.6L332.8 249.6M332.8 185.6C300.8 185.6 268.8 192 243.2 204.8 108.8 275.2 89.6 441.6 185.6 537.6l281.6 281.6C480 832 499.2 838.4 512 838.4s32-6.4 38.4-19.2l281.6-281.6c96-96 76.8-262.4-57.6-332.8-25.6-12.8-57.6-19.2-89.6-19.2-57.6 0-115.2 25.6-153.6 64L512 275.2 486.4 249.6C448 211.2 390.4 185.6 332.8 185.6L332.8 185.6z"></path></svg>
|
||||
</button>
|
||||
</div>
|
||||
<!-- 弹窗 -->
|
||||
<div class="modal" id="modal" onclick="closeModal()">
|
||||
<div class="modal-content" onclick="event.stopPropagation()">
|
||||
<span class="close-btn" onclick="closeModal()">×</span>
|
||||
<p>如果觉得文章对你有帮助,可以请作者喝杯咖啡 ☕️</p>
|
||||
<img src="<?php $this->options->wxpay() ?>" alt="微信二维码">
|
||||
<img src="<?php $this->options->alipay() ?>" alt="支付宝二维码">
|
||||
</div>
|
||||
</div>
|
||||
<script>function openModal(){document.getElementById('modal').style.display='flex'}function closeModal(){document.getElementById('modal').style.display='none'}</script>
|
||||
<style>.button--like{background:none;border:none;padding:0;cursor:pointer;transition:transform 0.3s ease;}.button--like:hover{transform:scale(1.1);}.icon--default{fill:#666;transition:fill 0.3s ease;}.button--like:hover .icon--default{fill:#ff4081;}.modal{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,0.1);justify-content:center;align-items:center;z-index:1000;}.modal-content{background-color:white;padding:20px;border-radius:10px;text-align:center;position:relative;}.modal-content img{width:200px;height:200px;margin-top:10px;}.close-btn{position:absolute;top:10px;right:10px;cursor:pointer;font-size:20px;color:#888;}</style>
|
||||
<?php endif; ?>
|
||||
<!-- 复制链接 -->
|
||||
<?php if($this->options->showshare): ?>
|
||||
<div class="post--share">
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<g>
|
||||
<path d="M18.36 5.64c-1.95-1.96-5.11-1.96-7.07 0L9.88 7.05 8.46 5.64l1.42-1.42c2.73-2.73 7.16-2.73 9.9 0 2.73 2.74 2.73 7.17 0 9.9l-1.42 1.42-1.41-1.42 1.41-1.41c1.96-1.96 1.96-5.12 0-7.07zm-2.12 3.53l-7.07 7.07-1.41-1.41 7.07-7.07 1.41 1.41zm-12.02.71l1.42-1.42 1.41 1.42-1.41 1.41c-1.96 1.96-1.96 5.12 0 7.07 1.95 1.96 5.11 1.96 7.07 0l1.41-1.41 1.42 1.41-1.42 1.42c-2.73 2.73-7.16 2.73-9.9 0-2.73-2.74-2.73-7.17 0-9.9z"></path>
|
||||
</g>
|
||||
</svg>
|
||||
<span class="text">复制链接</span>
|
||||
<span class="link" @click="copy" data-link="<?php $this->permalink(); ?>"><?php $this->permalink(); ?></span>
|
||||
<script src="<?php $this->options->themeUrl('/dist/js/vue.min.js'); ?>"></script>
|
||||
<script src="<?php $this->options->themeUrl('/dist/js/clipboard.min.js'); ?>"></script>
|
||||
<script>
|
||||
var app = new Vue({
|
||||
el: '.post--share',
|
||||
data() {
|
||||
return {
|
||||
msg: "<?php $this->permalink(); ?>",
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
//复制方法
|
||||
copy: function () {
|
||||
var that = this;
|
||||
//注意vue umd版本ClipboardJS,而ES包请使用Clipboard
|
||||
var clipboard = new ClipboardJS(".link",{
|
||||
text: function (trigger) {
|
||||
//返回字符串
|
||||
return that.msg;
|
||||
}});
|
||||
clipboard.on("success", (e) => {
|
||||
//复制成功,显示提示
|
||||
this.showCopySuccessToast();
|
||||
clipboard.destroy();
|
||||
});
|
||||
clipboard.on("error", (e) => {
|
||||
//复制失败
|
||||
clipboard.destroy();
|
||||
});
|
||||
},
|
||||
showCopySuccessToast: function() {
|
||||
const toast = document.createElement("div");
|
||||
toast.textContent = "复制成功!";
|
||||
toast.className = "notice--wrapper";
|
||||
document.body.appendChild(toast);
|
||||
|
||||
setTimeout(() => {
|
||||
document.body.removeChild(toast);
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<!-- TAG -->
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true"><g><path d="M18.36 5.64c-1.95-1.96-5.11-1.96-7.07 0L9.88 7.05 8.46 5.64l1.42-1.42c2.73-2.73 7.16-2.73 9.9 0 2.73 2.74 2.73 7.17 0 9.9l-1.42 1.42-1.41-1.42 1.41-1.41c1.96-1.96 1.96-5.12 0-7.07zm-2.12 3.53l-7.07 7.07-1.41-1.41 7.07-7.07 1.41 1.41zm-12.02.71l1.42-1.42 1.41 1.42-1.41 1.41c-1.96 1.96-1.96 5.12 0 7.07 1.95 1.96 5.11 1.96 7.07 0l1.41-1.41 1.42 1.41-1.42 1.42c-2.73 2.73-7.16 2.73-9.9 0-2.73-2.74-2.73-7.17 0-9.9z"></path></g></svg>
|
||||
<span class="cpoy" data-copy="<?php $this->permalink(); ?>">复制链接</span>
|
||||
<span class="link copy"><?php $this->permalink(); ?></span>
|
||||
<div class="notice--wrapper" id="copyTooltip" style="display: none;">复制成功!</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<!-- TAG -->
|
||||
<div class="tag--list artile--tag">
|
||||
<?php $this->tags(' ', true, ' '); ?>
|
||||
</div>
|
||||
<!-- 个人信息-->
|
||||
<?php if ($this->options->showProfile): ?>
|
||||
<?php $this->need('profile.php'); ?>
|
||||
<!-- 个人信息-->
|
||||
<?php if ($this->options->showProfile): ?>
|
||||
<?php $this->need('module/profile.php'); ?>
|
||||
<?php endif; ?>
|
||||
<!-- 分类-->
|
||||
<?php if ($this->options->showcate): ?>
|
||||
<?php
|
||||
// 初始化分类图片地址为空
|
||||
$categoryImage = '';
|
||||
// 检查文章是否有分类
|
||||
if ($this->categories) {
|
||||
// 获取第一个分类的信息
|
||||
$category = $this->categories[0];
|
||||
$categoryId = $category['mid'];
|
||||
$categoryName = $category['name'];
|
||||
$categoryDescription = $category['description']; // 如果分类有说明(描述)
|
||||
// 获取主题选项中的分类图片基本 URL
|
||||
$themeUrl = $this->options->midimg;
|
||||
// 生成分类图片地址
|
||||
$categoryImage = $themeUrl . $categoryId . '.jpg';
|
||||
}
|
||||
?>
|
||||
<!-- 显示分类信息 -->
|
||||
<?php if ($category): ?>
|
||||
<div class="category--card__list">
|
||||
<a href="<?php echo $category['permalink']; ?>" class="category--card">
|
||||
<div class="category--card__image">
|
||||
<img src="<?php echo htmlspecialchars($categoryImage); ?>" alt="<?php echo htmlspecialchars($categoryName); ?>">
|
||||
</div>
|
||||
<div class="category--card__content">
|
||||
<div class="category--card__title"><?php echo htmlspecialchars($categoryName); ?></div>
|
||||
<div class="category--card__description"><?php echo htmlspecialchars($categoryDescription); ?></div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<!-- 相关文章-->
|
||||
<?php if ($this->options->showrelated): ?>
|
||||
<?php $this->need('related.php'); ?>
|
||||
<?php $this->need('module/related.php'); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->allow('comment')): ?>
|
||||
<?php $this->need('module/comments.php'); ?>
|
||||
<?php endif; ?>
|
||||
<!-- 如果设置了第三方评论系统则使用第三方评论 -->
|
||||
<?php if($this->options->twikoo): ?>
|
||||
<?php $this->options->twikoo(); ?>
|
||||
<?php else: ?>
|
||||
<?php $this->need('comments.php'); ?>
|
||||
<?php endif; ?>
|
||||
<!--翻页-->
|
||||
<nav class="navigation post-navigation is-active">
|
||||
<div class="nav-links">
|
||||
@@ -159,75 +128,7 @@
|
||||
</ul>
|
||||
</article>
|
||||
</main>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
const targetClassElement = document.querySelector('.post--single__title');
|
||||
const postContent = document.querySelector('.post--single__content');
|
||||
if (!postContent) return;
|
||||
|
||||
let found = false;
|
||||
for (let i = 1; i <= 6 &&!found; i++) {
|
||||
if (postContent.querySelector(`h${i}`)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found) return;
|
||||
|
||||
const heads = postContent.querySelectorAll('h1, h2, h3, h4, h5, h6');
|
||||
const toc = document.createElement('div');
|
||||
toc.id = 'toc';
|
||||
toc.innerHTML = '<details class="toc" open><summary class="toc-title">目录</summary><nav id="TableOfContents"><ul></ul></nav></details>';
|
||||
|
||||
// 插入到指定 class 元素之后
|
||||
if (targetClassElement) {
|
||||
targetClassElement.parentNode.insertBefore(toc, targetClassElement.nextSibling);
|
||||
}
|
||||
|
||||
let currentLevel = 0;
|
||||
let currentList = toc.querySelector('ul');
|
||||
let levelCounts = [0];
|
||||
|
||||
heads.forEach((head, index) => {
|
||||
const level = parseInt(head.tagName.substring(1));
|
||||
if (levelCounts[level] === undefined) {
|
||||
levelCounts[level] = 1;
|
||||
} else {
|
||||
levelCounts[level]++;
|
||||
}
|
||||
// 重置下级标题的计数器
|
||||
levelCounts = levelCounts.slice(0, level + 1);
|
||||
if (currentLevel === 0) {
|
||||
currentLevel = level;
|
||||
}
|
||||
while (level > currentLevel) {
|
||||
let newList = document.createElement('ul');
|
||||
if (!currentList.lastElementChild) {
|
||||
currentList.appendChild(newList);
|
||||
} else {
|
||||
currentList.lastElementChild.appendChild(newList);
|
||||
}
|
||||
currentList = newList;
|
||||
currentLevel++;
|
||||
levelCounts[currentLevel] = 1;
|
||||
}
|
||||
while (level < currentLevel) {
|
||||
currentList = currentList.parentElement;
|
||||
if (currentList.tagName.toLowerCase() === 'li') {
|
||||
currentList = currentList.parentElement;
|
||||
}
|
||||
currentLevel--;
|
||||
}
|
||||
const anchor = head.textContent.trim().replace(/\s+/g, '-');
|
||||
head.id = anchor;
|
||||
const item = document.createElement('li');
|
||||
const link = document.createElement('a');
|
||||
link.href = `#${anchor}`;
|
||||
link.textContent = `${head.textContent}`;
|
||||
link.style.textDecoration = 'none';
|
||||
item.appendChild(link);
|
||||
currentList.appendChild(item);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="<?php $this->options->themeUrl('assets/js/post.js'); ?>"></script>
|
||||
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/lightbox.min.css'); ?>">
|
||||
<script src="<?php $this->options->themeUrl('assets/js/lightbox-plus-jquery.min.js'); ?>"></script>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
@@ -1,189 +0,0 @@
|
||||
<?php
|
||||
//确保退出安全
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
||||
|
||||
/** 文章置顶 */
|
||||
$sticky = $this->options->sticky ; //置顶的文章id,多个用|隔开
|
||||
|
||||
if ($sticky) {
|
||||
$sticky_cids = array_filter(explode('|', $sticky)); //分割文本并过滤空值
|
||||
$sticky_html = " <span class=sticky--post> 置顶 </span> "; //置顶标题的 html
|
||||
|
||||
$db = Typecho_Db::get();
|
||||
$pageSize = $this->options->pageSize;
|
||||
|
||||
// 构建置顶文章的查询
|
||||
$selectSticky = $this->select()->where('type = ?', 'post');
|
||||
foreach ($sticky_cids as $i => $cid) {
|
||||
if($i == 0)
|
||||
$selectSticky->where('cid = ?', $cid);
|
||||
else
|
||||
$selectSticky->orWhere('cid = ?', $cid);
|
||||
}
|
||||
|
||||
// 清空原有文章的列队
|
||||
$this->row = [];
|
||||
$this->stack = [];
|
||||
$this->length = 0;
|
||||
|
||||
// 只在首页第一页展示置顶文章
|
||||
if (($this->_currentPage || $this->currentPage) == 1) {
|
||||
$stickyPosts = $db->fetchAll($selectSticky);
|
||||
foreach ($stickyPosts as $stickyPost) {
|
||||
$stickyPost['title'] = $stickyPost['title'] . $sticky_html;
|
||||
$this->push($stickyPost); //压入列队
|
||||
}
|
||||
}
|
||||
|
||||
// 构建普通文章的查询,排除置顶文章的 CID
|
||||
$selectNormal = $this->select()
|
||||
->where('type = ?', 'post')
|
||||
->where('status = ?', 'publish')
|
||||
->where('created < ?', time())
|
||||
->order('created', Typecho_Db::SORT_DESC)
|
||||
->page($this->_currentPage, $pageSize);
|
||||
|
||||
foreach ($sticky_cids as $cid) {
|
||||
$selectNormal->where('table.contents.cid != ?', $cid);
|
||||
}
|
||||
|
||||
// 登录用户显示私密文章
|
||||
if ($this->user->hasLogin()) {
|
||||
$uid = $this->user->uid;
|
||||
if ($uid) {
|
||||
$selectNormal->orWhere('authorId = ? AND status = ?', $uid, 'private');
|
||||
}
|
||||
}
|
||||
|
||||
$normalPosts = $db->fetchAll($selectNormal);
|
||||
foreach ($normalPosts as $normalPost) {
|
||||
$this->push($normalPost); //压入列队
|
||||
}
|
||||
|
||||
// 设置总数(减去置顶文章数量,以进行正确的分页)
|
||||
$total = $this->getTotal() - count($sticky_cids);
|
||||
$this->setTotal(max($total, 0)); // 确保总数不为负数
|
||||
}
|
||||
?>
|
||||
<?php while($this->next()): ?>
|
||||
<article class="post--item">
|
||||
<div class="content">
|
||||
<h2 class="post--title">
|
||||
<a href="<?php $this->permalink() ?>">
|
||||
<?php $this->title() ?>
|
||||
<?php if((time() - $this->created) < 60*60*24*3): ?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
|
||||
class="icon--sticky" stroke="currentColor" stroke-width="2" stroke-linecap="round"
|
||||
stroke-linejoin="round" class="w-4 h-4 text-red-400">
|
||||
<path
|
||||
d="M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z">
|
||||
</path>
|
||||
</svg>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
</h2>
|
||||
<div class="description">
|
||||
<!-- 本功能实现 借助插件 AIsummary 实现 -->
|
||||
<?php
|
||||
// 判断是否存在自定义字段summary并输出,否则输出自动生成的摘要
|
||||
if($this->fields->summary){
|
||||
echo $this->fields->summary;
|
||||
} else {
|
||||
$this->excerpt(180);
|
||||
}?>
|
||||
</div>
|
||||
<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><time><?php $this->date('Y-m-d'); ?></time>
|
||||
|
||||
<svg class="icon" viewBox="0 0 1024 1024" width="16" height="16">
|
||||
<path
|
||||
d="M408.551619 97.52381a73.142857 73.142857 0 0 1 51.736381 21.430857L539.306667 197.973333A73.142857 73.142857 0 0 0 591.067429 219.428571H804.571429a73.142857 73.142857 0 0 1 73.142857 73.142858v560.761904a73.142857 73.142857 0 0 1-73.142857 73.142857H219.428571a73.142857 73.142857 0 0 1-73.142857-73.142857V170.666667a73.142857 73.142857 0 0 1 73.142857-73.142857h189.123048z m0 73.142857H219.428571v682.666666h585.142858V292.571429h-213.504a146.285714 146.285714 0 0 1-98.499048-38.13181L487.619048 249.734095 408.551619 170.666667zM365.714286 633.904762v73.142857h-73.142857v-73.142857h73.142857z m365.714285 0v73.142857H414.47619v-73.142857h316.952381z m-365.714285-195.047619v73.142857h-73.142857v-73.142857h73.142857z m365.714285 0v73.142857H414.47619v-73.142857h316.952381z">
|
||||
</path>
|
||||
</svg><?php $this->category(','); ?>
|
||||
<svg class="icon" viewBox="0 0 24 24" width="16" height="16" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9ZM11 12C11 11.4477 11.4477 11 12 11C12.5523 11 13 11.4477 13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12Z" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M21.83 11.2807C19.542 7.15186 15.8122 5 12 5C8.18777 5 4.45796 7.15186 2.17003 11.2807C1.94637 11.6844 1.94361 12.1821 2.16029 12.5876C4.41183 16.8013 8.1628 19 12 19C15.8372 19 19.5882 16.8013 21.8397 12.5876C22.0564 12.1821 22.0536 11.6844 21.83 11.2807ZM12 17C9.06097 17 6.04052 15.3724 4.09173 11.9487C6.06862 8.59614 9.07319 7 12 7C14.9268 7 17.9314 8.59614 19.9083 11.9487C17.9595 15.3724 14.939 17 12 17Z" />
|
||||
</svg>
|
||||
<span class="article--views"><?php get_post_view($this) ?></span>
|
||||
<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>
|
||||
<a href="<?php $this->permalink() ?>#comments"><?php $this->commentsNum('0 ', '1 ', '%d '); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$firstImage = img_postthumb($this->cid);
|
||||
$cover = $this->fields->cover;
|
||||
$imageToDisplay = !empty($cover) ? $cover : $firstImage;
|
||||
if($imageToDisplay): ?>
|
||||
<img src="<?php echo $imageToDisplay; ?>" alt="文章图片" class="cover"/>
|
||||
<?php endif; ?>
|
||||
</article>
|
||||
<?php endwhile; ?>
|
||||
<?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>
|
||||
@@ -1,54 +0,0 @@
|
||||
<?php
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
||||
class Content
|
||||
{
|
||||
public static function postCommentContent($content, $isLogin, $rememberEmail, $currentEmail, $parentEmail, $isTime = false)
|
||||
{
|
||||
//解析私密评论
|
||||
$flag = true;
|
||||
if (strpos($content, '[secret]') !== false) {//提高效率,避免每篇文章都要解析
|
||||
$pattern = self::get_shortcode_regex(array('secret'));
|
||||
$content = preg_replace_callback("/$pattern/", array('Content', 'secretContentParseCallback'), $content);
|
||||
if ($isLogin || ($currentEmail == $rememberEmail && $currentEmail != "") || ($parentEmail == $rememberEmail && $rememberEmail != "")) {
|
||||
$flag = true;
|
||||
} else {
|
||||
$flag = false;
|
||||
}
|
||||
}
|
||||
if ($flag) {
|
||||
$content = Content::parseContentPublic($content);
|
||||
return $content;
|
||||
} else {
|
||||
if ($isTime) {
|
||||
return '<div class="hideContent">此条为私密说说,仅发布者可见</div>';
|
||||
} else {
|
||||
return '<div class="hideContent">该评论仅登录用户及评论双方可见</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 解析时光机页面的评论内容
|
||||
* @param $content
|
||||
* @return string
|
||||
*/
|
||||
public static function timeMachineCommentContent($content)
|
||||
{
|
||||
return Content::parseContentPublic($content);
|
||||
}
|
||||
/**
|
||||
* 一些公用的解析,文章、评论、时光机公用的,与用户状态无关
|
||||
* @param $content
|
||||
* @return null|string|string[]
|
||||
*/
|
||||
public static function parseContentPublic($content)
|
||||
{
|
||||
$options = Helper::options();
|
||||
//倒计时
|
||||
if (strpos($content, '[countdown') !== false) {
|
||||
$pattern = self::get_shortcode_regex(array('countdown'));
|
||||
$content = preg_replace_callback("/$pattern/", array('Content', 'countdownParseCallback'),
|
||||
$content);
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
@@ -1,256 +0,0 @@
|
||||
<?php
|
||||
class UA{
|
||||
public $ua;
|
||||
public function __construct($ua = '')
|
||||
{
|
||||
$this->ua = $ua;
|
||||
}
|
||||
public function returnBrowser(){
|
||||
$ua = $this->ua;
|
||||
if(preg_match('/rv:(11.0)/i', $ua, $matches)){
|
||||
$title = 'Internet Explorer '. $matches[1];
|
||||
$icon = 'fa fa-internet-explorer';//ie11
|
||||
}elseif (preg_match('#MSIE ([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||
$title = 'Internet Explorer '. $matches[1];
|
||||
|
||||
if ( strpos($matches[1], '7') !== false || strpos($matches[1], '8') !== false)
|
||||
$icon = 'fa fa-internet-explorer';//ie8
|
||||
elseif ( strpos($matches[1], '9') !== false)
|
||||
$icon = 'fa fa-internet-explorer';//ie9
|
||||
elseif ( strpos($matches[1], '10') !== false)
|
||||
$icon = 'fa fa-internet-explorer';//ie10
|
||||
}elseif (preg_match('#Edge/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||
$title = 'Edge '. $matches[1];
|
||||
$icon = 'fa fa-edge';
|
||||
}elseif (preg_match('#TheWorld ([a-zA-Z0-9.]+)#i', $ua, $matches)){
|
||||
$title = 'TheWorld(世界之窗) '. $matches[1];
|
||||
$icon = 'iconfont icon-theworld';
|
||||
}elseif (preg_match('#JuziBrowser#i', $ua, $matches)){
|
||||
$title = 'Juzi(桔子) '.$matches[1];
|
||||
$icon = 'fa fa-globe';
|
||||
}elseif (preg_match('#KBrowser#i', $ua, $matches)){
|
||||
$title = 'KBrowser(超快) '.$matches[1];
|
||||
$icon = 'fa fa-globe';
|
||||
}elseif (preg_match('#MyIE#i', $ua, $matches)){
|
||||
$title = 'MyIE(蚂蚁) '.$matches[1];
|
||||
$icon = 'fa fa-globe';
|
||||
}elseif (preg_match('#(Firefox|Phoenix|Firebird|BonEcho|GranParadiso|Minefield|Iceweasel)/([a-zA-Z0-9.]+)#i', $ua, $matches)){
|
||||
$title = 'Firefox '. $matches[1];
|
||||
$icon = 'fa fa-firefox';
|
||||
}elseif (preg_match('#CriOS/([a-zA-Z0-9.]+)#i', $ua, $matches)){
|
||||
$title = 'Chrome for iOS '. $matches[1];
|
||||
$icon = 'fa fa-chrome';
|
||||
} elseif (preg_match('#LBBROWSER#i', $ua, $matches)) {
|
||||
$title = '猎豹';
|
||||
$icon = 'iconfont icon-liebaoliulanqi';
|
||||
}elseif (preg_match('#Opera.(.*)Version[ /]([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||
$title = 'Opera '. $matches[2];
|
||||
$icon = 'fa fa-opera';
|
||||
if (preg_match('#opera mini#i', $ua))
|
||||
$title = 'Opera Mini '. $matches[2];
|
||||
}elseif (preg_match('#Maxthon( |\/)([a-zA-Z0-9.]+)#i', $ua,$matches)) {
|
||||
$title = 'Maxthon(遨游) '. $matches[2];
|
||||
$icon = 'iconfont icon-liulanqi-aoyou';
|
||||
}elseif (preg_match('#360([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||
$title = '360 Browser '. $matches[1];
|
||||
$icon = 'iconfont icon-liulanqi-jisu';
|
||||
}elseif (preg_match('#SE 2([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||
$title = 'SouGou Browser 2 '.$matches[1];
|
||||
$icon = 'iconfont icon-liulanqi-sougou';
|
||||
}elseif (preg_match('#QQBrowser/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||
$title = 'QQBrowser '.$matches[1];
|
||||
$icon = 'iconfont icon-QQliulanqi';
|
||||
if (preg_match('#Mobile MQQBrowser/([a-zA-Z0-9.]+)#i', $ua,$matches)) {
|
||||
$title = 'Mobile MQQBrowser '. $matches[1];
|
||||
$icon = 'fa fa-qq';
|
||||
}elseif (preg_match('#MicroMessenger/([a-zA-Z0-9.]+)#i', $ua,$matches)) {
|
||||
$title = 'Wechat Browser '. $matches[1];
|
||||
$icon = 'weixin';
|
||||
}
|
||||
}elseif (preg_match('#QQ/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||
$title = 'QQ '.$matches[1];
|
||||
$icon = 'fa fa-qq';
|
||||
}elseif (preg_match('#YYE/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||
$title = 'YYE '.$matches[1];
|
||||
$icon = 'fa fa-globe';
|
||||
}elseif (preg_match('#115Browser/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||
$title = '115 '.$matches[1];
|
||||
$icon = 'fa fa-globe';
|
||||
}elseif (preg_match('#37abc/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||
$title = '37abc '.$matches[1];
|
||||
$icon = 'fa fa-globe';
|
||||
}elseif (preg_match('#TheWorld ([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||
$title = '世界之窗 '.$matches[1];
|
||||
$icon = 'iconfont icon-theworld';
|
||||
}elseif (preg_match('#UCWEB([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||
$title = 'UCWEB '. $matches[1];
|
||||
$icon = 'icon-win8 icon-ucliulanqi';
|
||||
}elseif (preg_match('#UBrowser/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||
$title = 'UBrowser '. $matches[1];
|
||||
$icon = 'iconfont icon-ucliulanqi';
|
||||
}elseif (preg_match('#Quark/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||
$title = 'Quark '. $matches[1];
|
||||
$icon = 'iconfont icon-ucliulanqi'; //
|
||||
}elseif (preg_match('#2345Explorer/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||
$title = '2345Explorer '. $matches[1];
|
||||
$icon = 'fa fa-globe';
|
||||
}elseif (preg_match('#XiaoMi/MiuiBrowser/([0-9.]+)#i', $ua, $matches)) {
|
||||
$title = '小米 '. $matches[1];
|
||||
$icon = 'iconfont icon-xiaomi';
|
||||
}elseif (preg_match('/WeiBo/i', $ua, $matches)) {
|
||||
$title = '微博 '. $matches[1];
|
||||
$icon = 'iconfont icon-weibo';
|
||||
}elseif (preg_match('/BIDU/i', $ua, $matches)) {
|
||||
$title = '百度 '. $matches[1];
|
||||
$icon = 'iconfont icon-setting';
|
||||
}elseif (preg_match('/mailapp/i', $ua, $matches)) {
|
||||
$title = 'EmailApp '. $matches[1];
|
||||
$icon = 'fa fa-globe';
|
||||
}elseif (preg_match('/Sleipnir/i', $ua, $matches)) {
|
||||
$title = '神马 '. $matches[1];
|
||||
$icon = 'iconfont icon-weibiaoti--';
|
||||
}elseif (preg_match('/MZBrowser/i', $ua, $matches)) {
|
||||
$title = '魅族 '. $matches[1];
|
||||
$icon = 'iconfont icon-meizu';
|
||||
}elseif (preg_match('/VivoBrowser/i', $ua, $matches)) {
|
||||
$title = 'Vivo '. $matches[1];
|
||||
$icon = 'iconfont icon-VIVO';
|
||||
}elseif (preg_match('/mixia/i', $ua, $matches)) {
|
||||
$title = '米侠 '. $matches[1];
|
||||
$icon = 'fa fa-globe';
|
||||
}elseif (preg_match('/CoolMarket/i', $ua, $matches)) {
|
||||
$title = '酷安 '. $matches[1];
|
||||
$icon = 'iconfont icon-coolapk';
|
||||
}elseif (preg_match('/YaBrowser/i', $ua, $matches)) {
|
||||
$title = 'Yandex '. $matches[1];
|
||||
$icon = 'iconfont icon-yandex';
|
||||
}elseif (preg_match('/Kraitnabo\/([^\s|;]+)/i', $ua, $matches)) {
|
||||
$title = '南博 '. $matches[1];
|
||||
$icon = 'anzhuo';
|
||||
}elseif (preg_match('#Chrome/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||
$title = 'Google Chrome '. $matches[1];
|
||||
$icon = 'fa fa-chrome';
|
||||
if (preg_match('#OPR/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||
$title = 'Opera '. $matches[1];
|
||||
$icon = 'fa fa-opera';
|
||||
}
|
||||
}elseif (preg_match('#Safari/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||
$title = 'Safari '. $matches[1];
|
||||
$icon = 'fa fa-safari';
|
||||
}
|
||||
return array("title"=>$title,
|
||||
"icon"=>$icon);
|
||||
}
|
||||
public function returnOS(){
|
||||
$ua = $this->ua;
|
||||
$title = "未知浏览器";
|
||||
$icon = "";
|
||||
if (preg_match('/win/i', $ua)) {
|
||||
if (preg_match('/Windows NT 6.1/i', $ua)) {
|
||||
$title = "Windows 7";
|
||||
$icon = "iconfont icon-win";
|
||||
}elseif (preg_match('/Windows 98/i', $ua)) {
|
||||
$title = "Windows 98";
|
||||
$icon = "iconfont icon-win2";
|
||||
}elseif (preg_match('/Windows NT 5.0/i', $ua)) {
|
||||
$title = "Windows 2000";
|
||||
$icon = "iconfont icon-win2";
|
||||
}elseif (preg_match('/Windows NT 5.1/i', $ua)) {
|
||||
$title = "Windows XP";
|
||||
$icon = "iconfont icon-win";
|
||||
}elseif (preg_match('/Windows NT 5.2/i', $ua)) {
|
||||
if (preg_match('/Win64/i', $ua)) {
|
||||
$title = "Windows XP 64 bit";
|
||||
} else {
|
||||
$title = "Windows Server 2003";
|
||||
}
|
||||
$icon = 'iconfont icon-win';
|
||||
}elseif (preg_match('/Windows NT 6.0/i', $ua)) {
|
||||
$title = "Windows Vista";
|
||||
$icon = "fa fa-windows";
|
||||
}elseif (preg_match('/Windows NT 6.2/i', $ua)) {
|
||||
$title = "Windows 8";
|
||||
$icon = "iconfont icon-win8";
|
||||
}elseif (preg_match('/Windows NT 6.3/i', $ua)) {
|
||||
$title = "Windows 8.1";
|
||||
$icon = "iconfont icon-win8";
|
||||
}elseif (preg_match('/Windows NT 10.0/i', $ua)) {
|
||||
$title = "Windows 10";
|
||||
$icon = "iconfont icon-win3";
|
||||
}elseif (preg_match('/Windows Phone/i', $ua)) {
|
||||
$matches = explode(';',$ua);
|
||||
$title = $matches[2];
|
||||
$icon = "iconfont icon-winphone";
|
||||
}
|
||||
} elseif (preg_match('#iPod.*.CPU.([a-zA-Z0-9.( _)]+)#i', $ua, $matches)) {
|
||||
$title = "iPod ";//.$matches[1]
|
||||
$icon = "iconfont icon-ipod";
|
||||
} elseif (preg_match('/iPhone OS ([_0-9]+)/i', $ua, $matches)) {
|
||||
$title = "Iphone ";//.$matches[1]
|
||||
$icon = "iconfont icon-iphone";
|
||||
} elseif (preg_match('/iPad; CPU OS ([_0-9]+)/i', $ua, $matches)) {
|
||||
$title = "iPad ";//.$matches[1]
|
||||
$icon = "iconfont icon-ipad";
|
||||
} elseif (preg_match('/Mac OS X ([0-9_]+)/i', $ua, $matches)) {
|
||||
if(count(explode(7,$matches[1]))>1) $matches[1] = 'Lion '.$matches[1];
|
||||
elseif(count(explode(8,$matches[1]))>1) $matches[1] = 'Mountain Lion '.$matches[1];
|
||||
$title = "Mac OSX";
|
||||
$icon = "iconfont icon-macosdeicon";
|
||||
} elseif (preg_match('/Macintosh/i', $ua)) {
|
||||
$title = "Mac OS";
|
||||
$icon = "iconfont icon-iconmacos";
|
||||
} elseif (preg_match('/CrOS/i', $ua)){
|
||||
$title = "Google Chrome OS";
|
||||
$icon = "iconfont icon-iconchromeos";
|
||||
} elseif (preg_match('/Linux/i', $ua)) {
|
||||
$title = 'Linux';
|
||||
$icon = 'fa fa-linux';
|
||||
if (preg_match('/Ubuntu/i', $ua)) {
|
||||
$title = "Ubuntu Linux";
|
||||
$icon = "iconfont icon-ubuntu";
|
||||
}elseif(preg_match('#Debian#i', $ua)) {
|
||||
$title = "Debian GNU/Linux";
|
||||
$icon = "iconfont icon-debian";
|
||||
}elseif (preg_match('#Fedora#i', $ua)) {
|
||||
$title = "Fedora Linux";
|
||||
$icon = "iconfont icon-fedora";
|
||||
}elseif (preg_match('/Kraitnabo\/([^\s|;]+)/i', $ua, $matches)) {
|
||||
$title = '南博app '. $matches[1];
|
||||
$icon = 'anzhuo';
|
||||
}elseif (preg_match('/Android.([0-9. _]+)/i',$ua, $matches)) {
|
||||
$title= "Android";
|
||||
$icon = "iconfont icon-android";
|
||||
}
|
||||
} elseif (preg_match('/Android.([0-9. _]+)/i',$ua, $matches)) {
|
||||
$title= "Android";
|
||||
$icon = "iconfont icon-android";
|
||||
}
|
||||
return array("title"=>$title,
|
||||
"icon"=>$icon);
|
||||
}
|
||||
/**
|
||||
* 时光机页面ua,如果是手机设备,只显示设备类型,如果是电脑设备只显示电脑设备类型,如果是扩展发送,显示发送自「扩展」,如果是微信公众号,显示
|
||||
*/
|
||||
public function returnTimeUa(){
|
||||
if ($this->ua == "weixin" || $this->ua == "weChat"){
|
||||
return array("title"=>("微信公众号"),
|
||||
"icon"=>"weixin");
|
||||
}elseif ($this->ua == "crx"){
|
||||
return array("title"=>("Chrome扩展"),
|
||||
"icon"=>"liulanqi");
|
||||
}elseif ($this->ua == "yearcross"){
|
||||
return array("title"=>("YearCross"),
|
||||
"icon"=>"QQ");
|
||||
}elseif ($this->ua == "Kraitnabo"){
|
||||
return array("title"=>("南博app"),
|
||||
"icon"=>"anzhuo");
|
||||
}elseif ($this->ua == "python"){
|
||||
return array("title"=>("python脚本"),
|
||||
"icon"=>"python");
|
||||
}else{
|
||||
$ua = $this->returnOS();
|
||||
$ua["icon"] = "anzhuo";
|
||||
return $ua;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
<?php
|
||||
require_once 'UA.php';
|
||||
require_once 'Content.php';
|
||||
if ($this->user->hasLogin()){
|
||||
$GLOBALS['isLogin'] = true;
|
||||
}else{
|
||||
$GLOBALS['isLogin'] = false;
|
||||
}
|
||||
function threadedComments($comments, $options)
|
||||
{
|
||||
$db = Typecho_Db::get();
|
||||
?>
|
||||
<article class='post--item post--item__status'>
|
||||
<div class='content'>
|
||||
<header>
|
||||
<?php $ua = new UA($comments->agent); ?>
|
||||
<div class="comment--avatar"><?php echo $comments->gravatar('48', ''); ?></div>
|
||||
<?php $comments->author(); ?>
|
||||
<span class="dot"></span>
|
||||
<p class="humane--time"><?php $comments->date('Y年m月d日 H:i'); ?></p>
|
||||
<span class="dot"></span>
|
||||
<?php echo "发自" . $ua->returnTimeUa()['title'];?>
|
||||
</header>
|
||||
<div class="description" itemprop="about">
|
||||
<?php echo Content::postCommentContent(Content::timeMachineCommentContent($comments->text),$GLOBALS['isLogin'] ,"","","",true); ?>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<?php } ?>
|
||||
<?php $this->comments()->to($comments); ?>
|
||||
<input type="hidden" class="j-comment-url" value="<?php $this->commentUrl() ?>">
|
||||
<?php if ($this->user->hasLogin()) : ?>
|
||||
<div class="respond" id="comments">
|
||||
<div class="comments--title">有什么新鲜事想告诉大家?</div>
|
||||
<form method="post" id="textarea" class="comment-form" action="<?php $this->commentUrl() ?>">
|
||||
<p class="comment-form-comment">
|
||||
<textarea name="text" id="j-dynamic-form-text" class="textarea" autocomplete="off" rows="3" placeholder="发表您的新鲜事儿..."></textarea>
|
||||
<input type="hidden" value="<?php $this->user->screenName(); ?>" name="author" />
|
||||
<input type="hidden" value="<?php $this->user->mail(); ?>" name="mail" />
|
||||
<input type="hidden" value="<?php $this->options->siteUrl(); ?>" name="url" />
|
||||
<input type="hidden" name="_" value="<?php Typecho_Widget::widget('Widget_Security')->to($security);
|
||||
echo $security->getToken($this->request->getRequestUrl()); ?>">
|
||||
</p>
|
||||
<p class="form-submit">
|
||||
<button type="submit" class="submit"><?php _e('发表(Ctrl+Enter)'); ?></button>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php $comments->listComments(['commentUrl'=>$this->commentUrl,'class'=>$this]); ?>
|
||||
<?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'
|
||||
)
|
||||
);
|
||||
?>
|
||||
<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>
|
||||