Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a880c019d | |||
| ce1b8c4378 | |||
| aa30ed95f8 | |||
| bc3056bc4c |
@@ -3,12 +3,16 @@
|
||||
移植自 `bigfa `大大的 `hugo-theme-farallon` 原汁原味,可以直接使用 原主题的CSS
|
||||
精简部分 JS.
|
||||
感谢
|
||||
- 2024.6.4 v0.5.1
|
||||
|
||||
- 2024.6.3
|
||||
更改了设置memos的方式
|
||||
新增了Mastodon 的 说说 页面
|
||||
|
||||
- 2024.6.3 v0.5.0
|
||||
|
||||
还是抄了原版的豆瓣获取方式
|
||||
|
||||
- 2024.5.26
|
||||
- 2024.5.26 v0.4.1
|
||||
|
||||
抄了个网站统计页面
|
||||
|
||||
@@ -24,7 +28,7 @@ https://github.com/bigfa/hugo-theme-farallon
|
||||
|
||||
## 移植进度
|
||||
|
||||
95%
|
||||
96%
|
||||
|
||||
## 功能
|
||||
|
||||
@@ -45,7 +49,12 @@ https://github.com/bigfa/hugo-theme-farallon
|
||||
~~!!记得重命名文件夹为`DoubanBoard`~~
|
||||
|
||||
使用原版的获取方式
|
||||
https://node.wpista.com/
|
||||
|
||||
>豆瓣收藏使用方法
|
||||
微信扫码登录https://node.wpista.com/
|
||||
输入你的豆瓣数字 id,点击保存即可自动同步豆瓣记录。
|
||||
点击 Get integration token 会生成一个 token。
|
||||
|
||||
获取`token`之后填入主题设置项中
|
||||
|
||||
### 友情链接
|
||||
@@ -58,6 +67,17 @@ https://node.wpista.com/
|
||||
|
||||
若使用AI摘要插件则显示AI摘要,不使用则显示默认字数摘要
|
||||
|
||||
### 说说 by Memos
|
||||
|
||||
使用自定义字段设置memos
|
||||
在自定义字段中填入`memos`值为memos地址,不带`/`
|
||||
在自定义字段中填入`memosID`默认值为`1`,不为`1`时才需要设置
|
||||
在自定义字段中填入`memosnum`默认值为`20`,默认获取20条最近的memo
|
||||
|
||||
### 说说 by Mastodon
|
||||
|
||||
根据 https://www.imsun.org/archives/1643.html#toc3 获得API地址
|
||||
在自定义字段中填入`tooot`值为Mastodon API 地址
|
||||
|
||||
## 预览地址
|
||||
|
||||
|
||||
+42
-5
@@ -12,7 +12,6 @@
|
||||
<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">
|
||||
@@ -55,7 +54,7 @@
|
||||
'...',
|
||||
array(
|
||||
'wrapTag' => 'div',
|
||||
'wrapClass' => 'cat_pagination_page',
|
||||
'wrapClass' => 'pagination_page',
|
||||
'itemTag' => '',
|
||||
'textTag' => 'a',
|
||||
'currentClass' => 'active',
|
||||
@@ -63,8 +62,7 @@
|
||||
'nextClass' => 'next'
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
?>
|
||||
<!-- 搜索结果 -->
|
||||
<?php else: ?>
|
||||
<main class="site--main">
|
||||
@@ -76,5 +74,44 @@
|
||||
</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('footer.php'); ?>
|
||||
@@ -27,10 +27,6 @@ function themeConfig($form) {
|
||||
$form->addInput($cnavatar);
|
||||
$donate = new Typecho_Widget_Helper_Form_Element_Text('donate', NULL, 'https://blogcdn.loliko.cn/donate/wx.png', _t('赞赏二维码'), _t('不填写则不显示'));
|
||||
$form->addInput($donate);
|
||||
$memos = new Typecho_Widget_Helper_Form_Element_Text('memos', NULL, 'https://m.loliko.cn', _t('memos地址'), _t('结尾不带"/"'));
|
||||
$form->addInput($memos);
|
||||
$memosID = new Typecho_Widget_Helper_Form_Element_Text('memosID', NULL, '1', _t('memosID'), _t('数字ID'));
|
||||
$form->addInput($memosID);
|
||||
$doubanID = new Typecho_Widget_Helper_Form_Element_Text('doubanID', NULL, '322dba2a3a27524b97c06d941d9631d153fc', _t('豆瓣页面必需Token'), _t('从<a href="https://node.wpista.com/" target="_blank">https://node.wpista.com/</a>获得token'));
|
||||
$form->addInput($doubanID);
|
||||
$twikoo = new Typecho_Widget_Helper_Form_Element_Textarea('twikoo', NULL, NULL, _t('引用第三方评论'), _t('不填写则不显示'));
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* 移植自HUGO主题`farallon`原作者`bigfa`
|
||||
* @package farallon
|
||||
* @author 老孙
|
||||
* @version 0.5.0
|
||||
* @version 0.5.1
|
||||
* @link https://imsun.org
|
||||
*/
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
/**
|
||||
* 说说页面 - Mastodon
|
||||
*
|
||||
* @package custom
|
||||
*/
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<?php $this->need('header.php'); ?>
|
||||
<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>
|
||||
<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" />
|
||||
<div id="memos-container"></div>
|
||||
<div class="nav-links" id="loadmore">
|
||||
<span class="loadmore">加载更多</span>
|
||||
</div>
|
||||
</article>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
let offset = 0; // 初始偏移量
|
||||
const limit = 20; // 每次加载的数量
|
||||
function formatHTML(toots) {
|
||||
let htmlString = '';
|
||||
toots.forEach(toot => {
|
||||
const { content, account, created_at, media_attachments} = toot;
|
||||
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>`;
|
||||
}
|
||||
});
|
||||
}
|
||||
// 使用 marked 转换 markdown 内容为 HTML
|
||||
const htmlContent = marked.parse(content);
|
||||
// 创建 HTML 字符串
|
||||
htmlString += `
|
||||
<article class='post--item post--item__status'>
|
||||
<div class='content'>
|
||||
<header>
|
||||
<img src="${account.avatar}" class="avatar" width="48" height="48" />
|
||||
<a class="humane--time" href="${account.url}" target="_blank">${new Date(created_at).toLocaleString()}</a>
|
||||
</header>
|
||||
<div class="description" itemprop="about">
|
||||
${htmlContent}
|
||||
<div class="resimg">${mediaHTML}</div>
|
||||
</div>
|
||||
</div>
|
||||
</article>`;
|
||||
});
|
||||
return htmlString;
|
||||
}
|
||||
function fetchToots() {
|
||||
return fetch('<?php echo $tooot; ?>')
|
||||
.then(response => response.json())
|
||||
.catch(error => {
|
||||
console.error('Error fetching toots:', error);
|
||||
return [];
|
||||
});
|
||||
}
|
||||
function fetchAndDisplayToots() {
|
||||
fetchToots().then(data => {
|
||||
const memosContainer = document.getElementById('memos-container');
|
||||
const tootsToShow = data.slice(offset, offset + limit); // 选择要显示的toots
|
||||
memosContainer.innerHTML += formatHTML(tootsToShow);
|
||||
offset += limit; // 更新偏移量
|
||||
// 如果没有更多的toots,隐藏“加载更多”按钮
|
||||
if (offset >= data.length) {
|
||||
document.getElementById('loadmore').style.display = 'none';
|
||||
}
|
||||
});
|
||||
}
|
||||
// 在页面加载完成后获取并展示 toots
|
||||
fetchAndDisplayToots();
|
||||
// 绑定“加载更多”按钮的点击事件
|
||||
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; /* 老版本的浏览器 */
|
||||
overflow-wrap: break-word;
|
||||
/* 指定如何断行 */
|
||||
word-break: break-all;
|
||||
word-break: break-word;
|
||||
}
|
||||
div p a {
|
||||
word-break: break-all;
|
||||
word-break: break-word;
|
||||
}
|
||||
.thumbnail-image {
|
||||
width:100%;
|
||||
height: 200px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
.resimg {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
column-gap: 10px;
|
||||
row-gap: 10px;
|
||||
}
|
||||
.thumbnail-image img {
|
||||
width:100%;
|
||||
height:170px;
|
||||
object-fit:cover;
|
||||
border-radius:4px;
|
||||
transition:transform .3s ease;
|
||||
cursor:zoom-in
|
||||
}
|
||||
/* 当屏幕宽度小于732px时 */
|
||||
@media (max-width: 732px) {
|
||||
.resimg {
|
||||
grid-template-columns: repeat(2, 1fr); /* 修改为两列 */
|
||||
}
|
||||
}
|
||||
/* 当屏幕宽度小于400px时 */
|
||||
@media (max-width: 400px) {
|
||||
.resimg {
|
||||
grid-template-columns: 1fr; /* 修改为一列 */
|
||||
}
|
||||
}
|
||||
.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'); ?>
|
||||
+11
-3
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* 说说页面
|
||||
* 说说页面 - memos
|
||||
*
|
||||
* @package custom
|
||||
*/
|
||||
@@ -11,14 +11,22 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<h1 class="post--single__title"><?php $this->title() ?></h1>
|
||||
<h2 class="archive--title__year"><?php $this->content(); ?> </h2>
|
||||
</header>
|
||||
<?php
|
||||
// 检查是否存在自定义字段 'memos' 和 'memosID'
|
||||
$memos = $this->fields->memos ? $this->fields->memos : 'https://memos.loliko.cn';
|
||||
$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" />
|
||||
<div id="talk"></div>
|
||||
</article>
|
||||
<script>
|
||||
if (99) {
|
||||
let url = '<?php $this->options->memos() ?>';
|
||||
fetch(url + '/api/v1/memo?creatorId=<?php $this->options->memosID() ?>&rowStatus=NORMAL&limit=20')
|
||||
let url = '<?php echo $memos; ?>';
|
||||
fetch(url + '/api/v1/memo?creatorId=<?php echo $memosID; ?>&rowStatus=NORMAL&limit=<?php echo $memosnum; ?>')
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
let html = '';
|
||||
|
||||
Reference in New Issue
Block a user