加个好物页面
This commit is contained in:
parent
ae64c25228
commit
12ee26cdfe
4
404.php
4
404.php
|
@ -4,9 +4,7 @@
|
|||
<section class="template--404">
|
||||
<div class="error--text">404</div>
|
||||
<div class="error--posts">
|
||||
|
||||
<article class="post--error" itemtype="http://schema.org/Article" itemscope="itemscope">
|
||||
|
||||
<div class="content">
|
||||
<h2 class="post--title" itemprop="headline">
|
||||
<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">
|
||||
</path>
|
||||
</svg>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
|
14
README.md
14
README.md
|
@ -2,7 +2,8 @@
|
|||
|
||||
移植自 `bigfa `大大的 `hugo-theme-farallon` 原汁原味,可以直接使用 原主题的CSS
|
||||
精简部分 JS.
|
||||
感谢
|
||||
|
||||
|
||||
- 2024.6.4 v0.5.1
|
||||
|
||||
更改了设置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
|
||||
|
||||
根据 https://www.imsun.org/archives/1643.html#toc3 获得API地址
|
||||
根据 https://www.imsun.org/archives/1643.html#toc3
|
||||
获得API地址
|
||||
|
||||
在自定义字段中填入`tooot`值为Mastodon API 地址
|
||||
|
||||
## 预览地址
|
||||
|
|
|
@ -53,12 +53,10 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
|||
<nav>
|
||||
<ul>
|
||||
<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 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>
|
||||
<!-- 这年头谁会用站内的搜索啊 -->
|
||||
|
@ -69,9 +67,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
|||
</label>
|
||||
<button type="submit" class="search-submit submit">搜索</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<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');
|
||||
?>
|
||||
<main class="site--main">
|
||||
|
||||
<div class="articleList">
|
||||
<?php $this->need('postlist.php'); ?>
|
||||
</div>
|
||||
|
|
|
@ -12,8 +12,8 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
|||
<?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; ?>
|
||||
<h3><?php echo allwords(); ?></h3>
|
||||
<?php endif; ?>
|
||||
</header>
|
||||
<div class="page--archive">
|
||||
<?php
|
||||
|
|
|
@ -9,6 +9,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
|||
<div 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>
|
||||
<section class="category--list">
|
||||
<?php $this->widget('Widget_Metas_Category_List')->parse('
|
||||
|
|
|
@ -9,7 +9,7 @@ $this->need('header.php');
|
|||
<section class="site--main">
|
||||
<header class="archive--header">
|
||||
<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>
|
||||
<article class="post--single">
|
||||
<div class="graph u-marginBottom30">
|
||||
|
|
|
@ -42,14 +42,12 @@ class APIHandler {
|
|||
this.token = token;
|
||||
this._create();
|
||||
}
|
||||
|
||||
on(event, selector, handler) {
|
||||
const elements = document.querySelectorAll(selector);
|
||||
elements.forEach(element => {
|
||||
element.addEventListener(event, handler);
|
||||
});
|
||||
}
|
||||
|
||||
_fetchGenres() {
|
||||
document.querySelector(".db--genres").innerHTML = "";
|
||||
fetch(`${this.baseAPI}genres?token=${this.token}&type=${this.type}`)
|
||||
|
@ -61,7 +59,6 @@ class APIHandler {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
_handleGenreClick() {
|
||||
this.on("click", ".db--genreItem", event => {
|
||||
const target = event.currentTarget;
|
||||
|
@ -85,14 +82,12 @@ class APIHandler {
|
|||
this._fetchData();
|
||||
});
|
||||
}
|
||||
|
||||
_renderGenre() {
|
||||
document.querySelector(".db--genres").innerHTML = this.genre_list.map(genre =>
|
||||
`<span class="db--genreItem${this.genre.includes(genre.name) ? " is-active" : ""}">${genre.name}</span>`
|
||||
).join("");
|
||||
this._handleGenreClick();
|
||||
}
|
||||
|
||||
_fetchData() {
|
||||
fetch(`${this.baseAPI}faves?token=${this.token}&type=${this.type}&paged=${this.paged}&genre=${JSON.stringify(this.genre)}`)
|
||||
.then(response => response.json())
|
||||
|
@ -127,7 +122,6 @@ class APIHandler {
|
|||
}
|
||||
return result;
|
||||
}, {});
|
||||
|
||||
let html = ``;
|
||||
for (let key in result) {
|
||||
const date = key.split("-");
|
||||
|
@ -156,7 +150,6 @@ class APIHandler {
|
|||
}
|
||||
document.querySelector(".db--list").innerHTML = html;
|
||||
}
|
||||
|
||||
_renderListTemplate() {
|
||||
document.querySelector(".db--list").innerHTML = this.subjects.map(subject =>
|
||||
`<div class="db--item">
|
||||
|
@ -173,7 +166,6 @@ class APIHandler {
|
|||
</div>`
|
||||
).join("");
|
||||
}
|
||||
|
||||
_handleScroll() {
|
||||
window.addEventListener("scroll", () => {
|
||||
const scrollY = window.scrollY || window.pageYOffset;
|
||||
|
@ -185,7 +177,6 @@ class APIHandler {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
_handleNavClick() {
|
||||
this.on("click", ".db--navItem", event => {
|
||||
if (event.currentTarget.classList.contains("current")) return;
|
||||
|
@ -207,7 +198,6 @@ class APIHandler {
|
|||
this._fetchData();
|
||||
});
|
||||
}
|
||||
|
||||
_create() {
|
||||
if (document.querySelector(".db--container")) {
|
||||
const container = document.querySelector(".db--container");
|
||||
|
@ -273,7 +263,6 @@ class APIHandler {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
_fetchCollection(collection) {
|
||||
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}`)
|
||||
|
@ -339,7 +328,6 @@ class APIHandler {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 在页面加载完成后实例化APIHandler类
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
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">
|
||||
<header class="archive--header">
|
||||
<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>
|
||||
|
||||
<div class="graph u-marginBottom30">
|
||||
<?php $this->content(); ?>
|
||||
</div>
|
||||
|
@ -30,5 +29,4 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
|||
<?php endif; ?>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<?php $this->need('footer.php'); ?>
|
|
@ -9,7 +9,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
|||
<div class="site--main">
|
||||
<header class="archive--header">
|
||||
<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>
|
||||
<?php
|
||||
// 检查是否存在自定义字段 'memos' 和 'memosID'
|
||||
|
@ -50,14 +50,12 @@ if (99) {
|
|||
</article>
|
||||
`;
|
||||
});
|
||||
|
||||
document.getElementById('talk').innerHTML = html;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
// 这里可以添加一些用户提示错误发生的 HTML 更新
|
||||
});
|
||||
|
||||
// 页面内容格式化
|
||||
function Format(item) {
|
||||
let date = getTime(new Date(item.createdTs * 1000).toString()),
|
||||
|
@ -144,7 +142,6 @@ div p a {
|
|||
grid-template-columns: repeat(2, 1fr); /* 修改为两列 */
|
||||
}
|
||||
}
|
||||
|
||||
/* 当屏幕宽度小于400px时 */
|
||||
@media (max-width: 400px) {
|
||||
.resimg {
|
||||
|
|
|
@ -9,6 +9,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
|||
<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="post-content">
|
||||
<?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>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
<?php $this->need('footer.php'); ?>
|
1
page.php
1
page.php
|
@ -8,7 +8,6 @@
|
|||
<div class="graph u-marginBottom30">
|
||||
<?php $this->content(); ?>
|
||||
</div>
|
||||
|
||||
<!-- 判断如果禁止评论则不显示评论的div -->
|
||||
<?php if ($this->allow('comment')): ?>
|
||||
<?php $this->need('comments.php'); ?>
|
||||
|
|
15
post.php
15
post.php
|
@ -133,12 +133,12 @@
|
|||
<?php if ($this->options->showrelated): ?>
|
||||
<?php $this->need('related.php'); ?>
|
||||
<?php endif; ?>
|
||||
<!-- 判断如果禁止评论则不显示评论的div -->
|
||||
<?php if ($this->allow('comment')): ?>
|
||||
<?php $this->need('comments.php'); ?>
|
||||
<?php endif; ?>
|
||||
<!-- 可以使用第三方评论-->
|
||||
<?php $this->options->twikoo(); ?>
|
||||
<!-- 如果设置了第三方评论系统则使用第三方评论 -->
|
||||
<?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">
|
||||
|
@ -166,7 +166,6 @@ document.addEventListener('DOMContentLoaded', (event) => {
|
|||
}
|
||||
}
|
||||
if (!found) return;
|
||||
|
||||
const heads = postContent.querySelectorAll('h1, h2, h3, h4, h5, h6');
|
||||
const toc = document.createElement('div');
|
||||
toc.id = 'toc';
|
||||
|
@ -183,10 +182,8 @@ document.addEventListener('DOMContentLoaded', (event) => {
|
|||
} else {
|
||||
levelCounts[level]++;
|
||||
}
|
||||
|
||||
// 重置下级标题的计数器
|
||||
levelCounts = levelCounts.slice(0, level + 1);
|
||||
|
||||
if (currentLevel === 0) {
|
||||
currentLevel = level;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
<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(); ?>">
|
||||
|
|
Loading…
Reference in New Issue