加个好物页面
This commit is contained in:
parent
ae64c25228
commit
12ee26cdfe
4
404.php
4
404.php
|
@ -4,9 +4,7 @@
|
||||||
<section class="template--404">
|
<section class="template--404">
|
||||||
<div class="error--text">404</div>
|
<div class="error--text">404</div>
|
||||||
<div class="error--posts">
|
<div class="error--posts">
|
||||||
|
|
||||||
<article class="post--error" itemtype="http://schema.org/Article" itemscope="itemscope">
|
<article class="post--error" itemtype="http://schema.org/Article" itemscope="itemscope">
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h2 class="post--title" itemprop="headline">
|
<h2 class="post--title" itemprop="headline">
|
||||||
<a href="<?php $this->options->siteUrl(); ?>">
|
<a href="<?php $this->options->siteUrl(); ?>">
|
||||||
|
@ -19,11 +17,9 @@
|
||||||
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">
|
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>
|
</path>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
|
|
14
README.md
14
README.md
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
移植自 `bigfa `大大的 `hugo-theme-farallon` 原汁原味,可以直接使用 原主题的CSS
|
移植自 `bigfa `大大的 `hugo-theme-farallon` 原汁原味,可以直接使用 原主题的CSS
|
||||||
精简部分 JS.
|
精简部分 JS.
|
||||||
感谢
|
|
||||||
|
|
||||||
- 2024.6.4 v0.5.1
|
- 2024.6.4 v0.5.1
|
||||||
|
|
||||||
更改了设置memos的方式
|
更改了设置memos的方式
|
||||||
|
@ -40,13 +41,6 @@ https://github.com/bigfa/hugo-theme-farallon
|
||||||
|
|
||||||
|
|
||||||
### 豆瓣观影
|
### 豆瓣观影
|
||||||
~~* 能力有限原项目功能无法实现~~
|
|
||||||
|
|
||||||
~~目前只能配合`DoubanBoard`插件使用~~
|
|
||||||
|
|
||||||
~~项目地址~~
|
|
||||||
~~https://github.com/AlanDecode/Typecho-Plugin-DoubanBoard~~
|
|
||||||
~~!!记得重命名文件夹为`DoubanBoard`~~
|
|
||||||
|
|
||||||
使用原版的获取方式
|
使用原版的获取方式
|
||||||
|
|
||||||
|
@ -76,7 +70,9 @@ https://github.com/bigfa/hugo-theme-farallon
|
||||||
|
|
||||||
### 说说 by Mastodon
|
### 说说 by Mastodon
|
||||||
|
|
||||||
根据 https://www.imsun.org/archives/1643.html#toc3 获得API地址
|
根据 https://www.imsun.org/archives/1643.html#toc3
|
||||||
|
获得API地址
|
||||||
|
|
||||||
在自定义字段中填入`tooot`值为Mastodon API 地址
|
在自定义字段中填入`tooot`值为Mastodon API 地址
|
||||||
|
|
||||||
## 预览地址
|
## 预览地址
|
||||||
|
|
|
@ -53,12 +53,10 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
<li class="whome"><a <?php if($this->is('index')): ?> class="current"<?php endif; ?> href="<?php $this->options->siteUrl(); ?>"><?php _e('首页'); ?></a></li>
|
<li class="whome"><a <?php if($this->is('index')): ?> class="current"<?php endif; ?> href="<?php $this->options->siteUrl(); ?>"><?php _e('首页'); ?></a></li>
|
||||||
|
|
||||||
<?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
|
<?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
|
||||||
<?php while($pages->next()): ?>
|
<?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>
|
<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; ?>
|
<?php endwhile; ?>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<!-- 这年头谁会用站内的搜索啊 -->
|
<!-- 这年头谁会用站内的搜索啊 -->
|
||||||
|
@ -69,9 +67,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||||
</label>
|
</label>
|
||||||
<button type="submit" class="search-submit submit">搜索</button>
|
<button type="submit" class="search-submit submit">搜索</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<svg class="svgIcon" width="25" height="25" data-action="show-search">
|
<svg class="svgIcon" width="25" height="25" data-action="show-search">
|
||||||
|
|
|
@ -10,7 +10,6 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
||||||
$this->need('header.php');
|
$this->need('header.php');
|
||||||
?>
|
?>
|
||||||
<main class="site--main">
|
<main class="site--main">
|
||||||
|
|
||||||
<div class="articleList">
|
<div class="articleList">
|
||||||
<?php $this->need('postlist.php'); ?>
|
<?php $this->need('postlist.php'); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -13,7 +13,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||||
<h2 class="post--single__subtitle">共包含 <?php $quantity->publishedPostsNum(); ?> 篇文章</h2>
|
<h2 class="post--single__subtitle">共包含 <?php $quantity->publishedPostsNum(); ?> 篇文章</h2>
|
||||||
<?php if ($this->options->showallwords): ?>
|
<?php if ($this->options->showallwords): ?>
|
||||||
<h3><?php echo allwords(); ?></h3>
|
<h3><?php echo allwords(); ?></h3>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</header>
|
</header>
|
||||||
<div class="page--archive">
|
<div class="page--archive">
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -9,6 +9,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||||
<div class="site--main">
|
<div class="site--main">
|
||||||
<header class="archive--header">
|
<header class="archive--header">
|
||||||
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||||
|
<h2 class="post--single__subtitle"><?php $this->content(); ?> </h2>
|
||||||
</header>
|
</header>
|
||||||
<section class="category--list">
|
<section class="category--list">
|
||||||
<?php $this->widget('Widget_Metas_Category_List')->parse('
|
<?php $this->widget('Widget_Metas_Category_List')->parse('
|
||||||
|
|
|
@ -9,7 +9,7 @@ $this->need('header.php');
|
||||||
<section class="site--main">
|
<section class="site--main">
|
||||||
<header class="archive--header">
|
<header class="archive--header">
|
||||||
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||||
<h2 class="archive--title__year"> </h2>
|
<h2 class="post--single__subtitle"><?php $this->content(); ?> </h2>
|
||||||
</header>
|
</header>
|
||||||
<article class="post--single">
|
<article class="post--single">
|
||||||
<div class="graph u-marginBottom30">
|
<div class="graph u-marginBottom30">
|
||||||
|
|
|
@ -42,14 +42,12 @@ class APIHandler {
|
||||||
this.token = token;
|
this.token = token;
|
||||||
this._create();
|
this._create();
|
||||||
}
|
}
|
||||||
|
|
||||||
on(event, selector, handler) {
|
on(event, selector, handler) {
|
||||||
const elements = document.querySelectorAll(selector);
|
const elements = document.querySelectorAll(selector);
|
||||||
elements.forEach(element => {
|
elements.forEach(element => {
|
||||||
element.addEventListener(event, handler);
|
element.addEventListener(event, handler);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_fetchGenres() {
|
_fetchGenres() {
|
||||||
document.querySelector(".db--genres").innerHTML = "";
|
document.querySelector(".db--genres").innerHTML = "";
|
||||||
fetch(`${this.baseAPI}genres?token=${this.token}&type=${this.type}`)
|
fetch(`${this.baseAPI}genres?token=${this.token}&type=${this.type}`)
|
||||||
|
@ -61,7 +59,6 @@ class APIHandler {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleGenreClick() {
|
_handleGenreClick() {
|
||||||
this.on("click", ".db--genreItem", event => {
|
this.on("click", ".db--genreItem", event => {
|
||||||
const target = event.currentTarget;
|
const target = event.currentTarget;
|
||||||
|
@ -85,14 +82,12 @@ class APIHandler {
|
||||||
this._fetchData();
|
this._fetchData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_renderGenre() {
|
_renderGenre() {
|
||||||
document.querySelector(".db--genres").innerHTML = this.genre_list.map(genre =>
|
document.querySelector(".db--genres").innerHTML = this.genre_list.map(genre =>
|
||||||
`<span class="db--genreItem${this.genre.includes(genre.name) ? " is-active" : ""}">${genre.name}</span>`
|
`<span class="db--genreItem${this.genre.includes(genre.name) ? " is-active" : ""}">${genre.name}</span>`
|
||||||
).join("");
|
).join("");
|
||||||
this._handleGenreClick();
|
this._handleGenreClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
_fetchData() {
|
_fetchData() {
|
||||||
fetch(`${this.baseAPI}faves?token=${this.token}&type=${this.type}&paged=${this.paged}&genre=${JSON.stringify(this.genre)}`)
|
fetch(`${this.baseAPI}faves?token=${this.token}&type=${this.type}&paged=${this.paged}&genre=${JSON.stringify(this.genre)}`)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
|
@ -127,7 +122,6 @@ class APIHandler {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
let html = ``;
|
let html = ``;
|
||||||
for (let key in result) {
|
for (let key in result) {
|
||||||
const date = key.split("-");
|
const date = key.split("-");
|
||||||
|
@ -156,7 +150,6 @@ class APIHandler {
|
||||||
}
|
}
|
||||||
document.querySelector(".db--list").innerHTML = html;
|
document.querySelector(".db--list").innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
_renderListTemplate() {
|
_renderListTemplate() {
|
||||||
document.querySelector(".db--list").innerHTML = this.subjects.map(subject =>
|
document.querySelector(".db--list").innerHTML = this.subjects.map(subject =>
|
||||||
`<div class="db--item">
|
`<div class="db--item">
|
||||||
|
@ -173,7 +166,6 @@ class APIHandler {
|
||||||
</div>`
|
</div>`
|
||||||
).join("");
|
).join("");
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleScroll() {
|
_handleScroll() {
|
||||||
window.addEventListener("scroll", () => {
|
window.addEventListener("scroll", () => {
|
||||||
const scrollY = window.scrollY || window.pageYOffset;
|
const scrollY = window.scrollY || window.pageYOffset;
|
||||||
|
@ -185,7 +177,6 @@ class APIHandler {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleNavClick() {
|
_handleNavClick() {
|
||||||
this.on("click", ".db--navItem", event => {
|
this.on("click", ".db--navItem", event => {
|
||||||
if (event.currentTarget.classList.contains("current")) return;
|
if (event.currentTarget.classList.contains("current")) return;
|
||||||
|
@ -207,7 +198,6 @@ class APIHandler {
|
||||||
this._fetchData();
|
this._fetchData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_create() {
|
_create() {
|
||||||
if (document.querySelector(".db--container")) {
|
if (document.querySelector(".db--container")) {
|
||||||
const container = document.querySelector(".db--container");
|
const container = document.querySelector(".db--container");
|
||||||
|
@ -273,7 +263,6 @@ class APIHandler {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_fetchCollection(collection) {
|
_fetchCollection(collection) {
|
||||||
const style = collection.dataset.style ? collection.dataset.style : "card";
|
const style = collection.dataset.style ? collection.dataset.style : "card";
|
||||||
fetch(`${this.baseAPI}v1/movies?type=${collection.dataset.type}&paged=1&genre=&start_time=${collection.dataset.start}&end_time=${collection.dataset.end}`)
|
fetch(`${this.baseAPI}v1/movies?type=${collection.dataset.type}&paged=1&genre=&start_time=${collection.dataset.start}&end_time=${collection.dataset.end}`)
|
||||||
|
@ -339,7 +328,6 @@ class APIHandler {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 在页面加载完成后实例化APIHandler类
|
// 在页面加载完成后实例化APIHandler类
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
const token = "<?php $this->options->doubanID() ?>"; // 替换为你的API令牌
|
const token = "<?php $this->options->doubanID() ?>"; // 替换为你的API令牌
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* 好物页面
|
||||||
|
*
|
||||||
|
* @package custom
|
||||||
|
*/
|
||||||
|
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||||
|
<?php $this->need('header.php'); ?>
|
||||||
|
<div class="site--main site--main__gears">
|
||||||
|
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||||
|
<h2 class="post--single__subtitle"><?php $this->content(); ?></h2>
|
||||||
|
<div class="good--list">
|
||||||
|
<div id=goods></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
|
memoGoods();
|
||||||
|
});
|
||||||
|
function memoGoods(e) {
|
||||||
|
let t = e || 12;
|
||||||
|
var n = "https://memos.imsun.org",
|
||||||
|
s = n + "/api/v1/memo?creatorId=1&limit=" + t + "&tag=好物";
|
||||||
|
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 +
|
||||||
|
'"></a></div><div class="good--name"><div class="brand">'
|
||||||
|
+ d + '<br>' + u +
|
||||||
|
'</div>'
|
||||||
|
+ m +
|
||||||
|
'</div></div>';
|
||||||
|
}
|
||||||
|
let f = document.querySelector("#goods");
|
||||||
|
f.innerHTML = c;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<?php $this->need('footer.php'); ?>
|
||||||
|
|
|
@ -9,9 +9,8 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||||
<section class="site--main">
|
<section class="site--main">
|
||||||
<header class="archive--header">
|
<header class="archive--header">
|
||||||
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||||
<h2 class="archive--title__year"> </h2>
|
<h2 class="post--single__subtitle"><?php $this->content(); ?> </h2>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="graph u-marginBottom30">
|
<div class="graph u-marginBottom30">
|
||||||
<?php $this->content(); ?>
|
<?php $this->content(); ?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -30,5 +29,4 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</article>
|
</article>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<?php $this->need('footer.php'); ?>
|
<?php $this->need('footer.php'); ?>
|
|
@ -9,7 +9,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||||
<div class="site--main">
|
<div class="site--main">
|
||||||
<header class="archive--header">
|
<header class="archive--header">
|
||||||
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||||
<h2 class="archive--title__year"><?php $this->content(); ?> </h2>
|
<h2 class="post--single__subtitle"><?php $this->content(); ?> </h2>
|
||||||
</header>
|
</header>
|
||||||
<?php
|
<?php
|
||||||
// 检查是否存在自定义字段 'memos' 和 'memosID'
|
// 检查是否存在自定义字段 'memos' 和 'memosID'
|
||||||
|
@ -50,14 +50,12 @@ if (99) {
|
||||||
</article>
|
</article>
|
||||||
`;
|
`;
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById('talk').innerHTML = html;
|
document.getElementById('talk').innerHTML = html;
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error('Error:', error);
|
console.error('Error:', error);
|
||||||
// 这里可以添加一些用户提示错误发生的 HTML 更新
|
// 这里可以添加一些用户提示错误发生的 HTML 更新
|
||||||
});
|
});
|
||||||
|
|
||||||
// 页面内容格式化
|
// 页面内容格式化
|
||||||
function Format(item) {
|
function Format(item) {
|
||||||
let date = getTime(new Date(item.createdTs * 1000).toString()),
|
let date = getTime(new Date(item.createdTs * 1000).toString()),
|
||||||
|
@ -144,7 +142,6 @@ div p a {
|
||||||
grid-template-columns: repeat(2, 1fr); /* 修改为两列 */
|
grid-template-columns: repeat(2, 1fr); /* 修改为两列 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 当屏幕宽度小于400px时 */
|
/* 当屏幕宽度小于400px时 */
|
||||||
@media (max-width: 400px) {
|
@media (max-width: 400px) {
|
||||||
.resimg {
|
.resimg {
|
||||||
|
|
|
@ -9,6 +9,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||||
<section class="site--main">
|
<section class="site--main">
|
||||||
<header class="archive--header">
|
<header class="archive--header">
|
||||||
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||||
|
<h2 class="post--single__subtitle"><?php $this->content(); ?> </h2>
|
||||||
</header>
|
</header>
|
||||||
<div class="post-content">
|
<div class="post-content">
|
||||||
<?php $this->widget('Widget_Metas_Tag_Cloud', 'sort=mid&ignoreZeroCount=1&desc=0')->to($tags); ?>
|
<?php $this->widget('Widget_Metas_Tag_Cloud', 'sort=mid&ignoreZeroCount=1&desc=0')->to($tags); ?>
|
||||||
|
@ -24,6 +25,5 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||||
<p class="text-center pb-2"><?php _e('没有任何标签'); ?></p>
|
<p class="text-center pb-2"><?php _e('没有任何标签'); ?></p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
<?php $this->need('footer.php'); ?>
|
<?php $this->need('footer.php'); ?>
|
1
page.php
1
page.php
|
@ -8,7 +8,6 @@
|
||||||
<div class="graph u-marginBottom30">
|
<div class="graph u-marginBottom30">
|
||||||
<?php $this->content(); ?>
|
<?php $this->content(); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 判断如果禁止评论则不显示评论的div -->
|
<!-- 判断如果禁止评论则不显示评论的div -->
|
||||||
<?php if ($this->allow('comment')): ?>
|
<?php if ($this->allow('comment')): ?>
|
||||||
<?php $this->need('comments.php'); ?>
|
<?php $this->need('comments.php'); ?>
|
||||||
|
|
11
post.php
11
post.php
|
@ -133,12 +133,12 @@
|
||||||
<?php if ($this->options->showrelated): ?>
|
<?php if ($this->options->showrelated): ?>
|
||||||
<?php $this->need('related.php'); ?>
|
<?php $this->need('related.php'); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<!-- 判断如果禁止评论则不显示评论的div -->
|
<!-- 如果设置了第三方评论系统则使用第三方评论 -->
|
||||||
<?php if ($this->allow('comment')): ?>
|
<?php if($this->options->twikoo): ?>
|
||||||
|
<?php $this->options->twikoo(); ?>
|
||||||
|
<?php else: ?>
|
||||||
<?php $this->need('comments.php'); ?>
|
<?php $this->need('comments.php'); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<!-- 可以使用第三方评论-->
|
|
||||||
<?php $this->options->twikoo(); ?>
|
|
||||||
<!--翻页-->
|
<!--翻页-->
|
||||||
<nav class="navigation post-navigation is-active">
|
<nav class="navigation post-navigation is-active">
|
||||||
<div class="nav-links">
|
<div class="nav-links">
|
||||||
|
@ -166,7 +166,6 @@ document.addEventListener('DOMContentLoaded', (event) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) return;
|
if (!found) return;
|
||||||
|
|
||||||
const heads = postContent.querySelectorAll('h1, h2, h3, h4, h5, h6');
|
const heads = postContent.querySelectorAll('h1, h2, h3, h4, h5, h6');
|
||||||
const toc = document.createElement('div');
|
const toc = document.createElement('div');
|
||||||
toc.id = 'toc';
|
toc.id = 'toc';
|
||||||
|
@ -183,10 +182,8 @@ document.addEventListener('DOMContentLoaded', (event) => {
|
||||||
} else {
|
} else {
|
||||||
levelCounts[level]++;
|
levelCounts[level]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重置下级标题的计数器
|
// 重置下级标题的计数器
|
||||||
levelCounts = levelCounts.slice(0, level + 1);
|
levelCounts = levelCounts.slice(0, level + 1);
|
||||||
|
|
||||||
if (currentLevel === 0) {
|
if (currentLevel === 0) {
|
||||||
currentLevel = level;
|
currentLevel = level;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
<h3 class="related--posts__title">相关文章</h3>
|
<h3 class="related--posts__title">相关文章</h3>
|
||||||
<div class="post--single__related">
|
<div class="post--single__related">
|
||||||
<?php $this->related(6)->to($relatedPosts); ?>
|
<?php $this->related(6)->to($relatedPosts); ?>
|
||||||
|
|
||||||
<?php while ($relatedPosts->next()): ?>
|
<?php while ($relatedPosts->next()): ?>
|
||||||
<div class="post--single__related__item">
|
<div class="post--single__related__item">
|
||||||
<a href="<?php $relatedPosts->permalink(); ?>">
|
<a href="<?php $relatedPosts->permalink(); ?>">
|
||||||
|
|
Loading…
Reference in New Issue